Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add snippet to forecast future time series in the Forecast a single time series with a univariate model tutorial #1271

Merged
merged 14 commits into from
Jan 15, 2025
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,22 @@ def test_create_single_timeseries() -> None:
# 3 0 1 1 False -2470.632377 4945.264753 44319.379307 ['WEEKLY'] False False True
# 4 2 1 1 True -2463.671247 4937.342493 42633.299513 ['WEEKLY'] False False True
# [END bigquery_dataframes_single_timeseries_forecasting_model_tutorial_evaluate]

# [START bigquery_dataframes_single_timeseries_forecasting_model_tutorial_forecast]
prediction = model.predict(horizon=30, confidence_level=0.8)

print(prediction.peek())
# Expected output:
# forecast_timestamp forecast_value standard_error confidence_level prediction_interval_lower_bound prediction_interval_upper_bound confidence_interval_lower_bound confidence_interval_upper_bound
# 11 2017-08-13 00:00:00+00:00 1845.439732 328.060405 0.8 1424.772257 2266.107208 1424.772257 2266.107208
# 29 2017-08-31 00:00:00+00:00 2615.993932 431.286628 0.8 2062.960849 3169.027015 2062.960849 3169.027015
# 7 2017-08-09 00:00:00+00:00 2639.285993 300.301186 0.8 2254.213792 3024.358193 2254.213792 3024.358193
# 25 2017-08-27 00:00:00+00:00 1853.735689 410.596551 0.8 1327.233216 2380.238162 1327.233216 2380.238162
# 1 2017-08-03 00:00:00+00:00 2621.33159 241.093355 0.8 2312.180802 2930.482379 2312.180802 2930.482379
# [END bigquery_dataframes_single_timeseries_forecasting_model_tutorial_forecast]
assert coef is not None
assert summary is not None
assert model is not None
assert parsed_date is not None
assert prediction is not None
assert total_visits is not None
Loading