Utilizing the linear regression model
To use our BigQuery ML model, we'll use the ML.PREDICT
function and the table that we've expressly created to host the records that we haven't used yet.
The following query will predict the label using the data in prediction_table
:
SELECT tripduration as actual_duration, predicted_label as predicted_duration, ABS(tripduration - predicted_label) difference_in_min FROM ML.PREDICT(MODEL `04_nyc_bike_sharing.trip_duration_by_stations_and_day`, ( SELECT start_station_name, end_station_name, IF (EXTRACT(DAYOFWEEK FROM starttime)=1 OR EXTRACT(DAYOFWEEK...