Skip to content

Commit a687050

Browse files
authored
docs: add snippet to forecast future time series in the Forecast a single time series with a univariate model tutorial (#1271)
* docs: add snippet to forecast future time series for a univariate model * quick fix * separate snippets
1 parent a7cbf39 commit a687050

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎samples/snippets/create_single_timeseries_forecasting_model_test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,22 @@ def test_create_single_timeseries() -> None:
9191
# 3 0 1 1 False -2470.632377 4945.264753 44319.379307 ['WEEKLY'] False False True
9292
# 4 2 1 1 True -2463.671247 4937.342493 42633.299513 ['WEEKLY'] False False True
9393
# [END bigquery_dataframes_single_timeseries_forecasting_model_tutorial_evaluate]
94+
95+
# [START bigquery_dataframes_single_timeseries_forecasting_model_tutorial_forecast]
96+
prediction = model.predict(horizon=30, confidence_level=0.8)
97+
98+
print(prediction.peek())
99+
# Expected output:
100+
# forecast_timestamp forecast_value standard_error confidence_level prediction_interval_lower_bound prediction_interval_upper_bound confidence_interval_lower_bound confidence_interval_upper_bound
101+
# 11 2017-08-13 00:00:00+00:00 1845.439732 328.060405 0.8 1424.772257 2266.107208 1424.772257 2266.107208
102+
# 29 2017-08-31 00:00:00+00:00 2615.993932 431.286628 0.8 2062.960849 3169.027015 2062.960849 3169.027015
103+
# 7 2017-08-09 00:00:00+00:00 2639.285993 300.301186 0.8 2254.213792 3024.358193 2254.213792 3024.358193
104+
# 25 2017-08-27 00:00:00+00:00 1853.735689 410.596551 0.8 1327.233216 2380.238162 1327.233216 2380.238162
105+
# 1 2017-08-03 00:00:00+00:00 2621.33159 241.093355 0.8 2312.180802 2930.482379 2312.180802 2930.482379
106+
# [END bigquery_dataframes_single_timeseries_forecasting_model_tutorial_forecast]
94107
assert coef is not None
95108
assert summary is not None
96109
assert model is not None
97110
assert parsed_date is not None
111+
assert prediction is not None
98112
assert total_visits is not None

0 commit comments

Comments
 (0)