Skip to content

Commit c22126b

Browse files
authored
docs: add snippet to explain the univariate model's forecast result in the Forecast a single time series with a univariate model tutorial (#1272)
* docs: add snippet to explain the univariate model's forecast result * docs: add snippet to explain the univariate model's forecast result
1 parent e2382b2 commit c22126b

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

samples/snippets/create_multiple_timeseries_forecasting_model_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def test_multiple_timeseries_forecasting_model(random_model_id: str) -> None:
1717
your_model_id = random_model_id
1818

1919
# [START bigquery_dataframes_bqml_arima_multiple_step_2_visualize]
20+
2021
import bigframes.pandas as bpd
2122

2223
df = bpd.read_gbq("bigquery-public-data.new_york.citibike_trips")

samples/snippets/create_single_timeseries_forecasting_model_test.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,22 @@ def test_create_single_timeseries() -> None:
104104
# 25 2017-08-27 00:00:00+00:00 1853.735689 410.596551 0.8 1327.233216 2380.238162 1327.233216 2380.238162
105105
# 1 2017-08-03 00:00:00+00:00 2621.33159 241.093355 0.8 2312.180802 2930.482379 2312.180802 2930.482379
106106
# [END bigquery_dataframes_single_timeseries_forecasting_model_tutorial_forecast]
107+
108+
# [START bigquery_dataframes_single_timeseries_forecasting_model_tutorial_explain_forecast]
109+
ex_pred = model.predict_explain(horizon=30, confidence_level=0.8)
110+
111+
print(ex_pred.head(4))
112+
# Expected output:
113+
# time_series_timestamp time_series_type time_series_data time_series_adjusted_data standard_error confidence_level prediction_interval_lower_bound prediction_interval_upper_bound trend seasonal_period_yearly seasonal_period_quarterly seasonal_period_monthly seasonal_period_weekly seasonal_period_daily holiday_effect spikes_and_dips step_changes residual
114+
# 0 2016-08-01 00:00:00+00:00 history 1711.0 505.716474 206.939556 <NA> <NA> <NA> 0.0 <NA> <NA> <NA> 169.611938 <NA> <NA> <NA> 1205.283526 336.104536
115+
# 1 2016-08-02 00:00:00+00:00 history 2140.0 623.137701 206.939556 <NA> <NA> <NA> 336.104428 <NA> <NA> <NA> 287.033273 <NA> <NA> <NA> 1205.283526 311.578773
116+
# 2 2016-08-03 00:00:00+00:00 history 2890.0 1008.655091 206.939556 <NA> <NA> <NA> 563.514213 <NA> <NA> <NA> 445.140878 <NA> <NA> <NA> 1205.283526 676.061383
117+
# 3 2016-08-04 00:00:00+00:00 history 3161.0 1389.40959 206.939556 <NA> <NA> <NA> 986.317236 <NA> <NA> <NA> 403.092354 <NA> <NA> <NA> 1205.283526 566.306884
118+
# 4 2016-08-05 00:00:00+00:00 history 2702.0 1394.395741 206.939556 <NA> <NA> <NA> 1248.707386 <NA> <NA> <NA> 145.688355 <NA> <NA> <NA> 1205.283526 102.320733
119+
# 5 2016-08-06 00:00:00+00:00 history 1663.0 437.09243 206.939556 <NA> <NA> <NA> 1188.59004 <NA> <NA> <NA> -751.49761 <NA> <NA> <NA> 1205.283526 20.624044
120+
# [END bigquery_dataframes_single_timeseries_forecasting_model_tutorial_explain_forecast]
107121
assert coef is not None
122+
assert ex_pred is not None
108123
assert summary is not None
109124
assert model is not None
110125
assert parsed_date is not None

0 commit comments

Comments
 (0)