From 3da3663442e2354a0f2015844a4145560669e898 Mon Sep 17 00:00:00 2001 From: Daniela Date: Wed, 2 Apr 2025 21:57:32 +0000 Subject: [PATCH] docs: add explain forecast snippet to multiple time series tutorial --- ...ate_multiple_timeseries_forecasting_model_test.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/samples/snippets/create_multiple_timeseries_forecasting_model_test.py b/samples/snippets/create_multiple_timeseries_forecasting_model_test.py index 4520984f47..0ce38e1a85 100644 --- a/samples/snippets/create_multiple_timeseries_forecasting_model_test.py +++ b/samples/snippets/create_multiple_timeseries_forecasting_model_test.py @@ -161,3 +161,15 @@ def test_multiple_timeseries_forecasting_model(random_model_id: str) -> None: # 20 2016-10-02 00:00:00+00:00 Central Park West & W 72 St 175.474862 40.940794 0.9 ... # 12 2016-10-01 00:00:00+00:00 W 106 St & Central Park West 63.88163 18.088868 0.9 ... # [END bigquery_dataframes_bqml_arima_multiple_step_6_forecast] + # [START bigquery_dataframes_bqml_arima_multiple_step_7_explain] + explain = model.predict_explain(horizon=3, confidence_level=0.9) + + print(explain.peek(5)) + # Expected output: + # time_series_timestamp start_station_name 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 + # 0 2013-07-01 00:00:00+00:00 Central Park S & 6 Ave history 69.0 154.168527 32.572948 0.0 35.477484 -28.402102 0.0 -85.168527 147.093145 + # 1 2013-07-01 00:00:00+00:00 Grand Army Plaza & Central Park S history 79.0 79.0 24.982769 0.0 43.46428 -30.01599 0.0 0.0 65.55171 + # 2 2013-07-02 00:00:00+00:00 Central Park S & 6 Ave history 180.0 204.045651 32.572948 147.093045 72.498327 -15.545721 0.0 -85.168527 61.122876 + # 3 2013-07-02 00:00:00+00:00 Grand Army Plaza & Central Park S history 129.0 99.556269 24.982769 65.551665 45.836432 -11.831828 0.0 0.0 29.443731 + # 4 2013-07-03 00:00:00+00:00 Central Park S & 6 Ave history 115.0 205.968236 32.572948 191.32754 59.220766 -44.580071 0.0 -85.168527 -5.799709 + # [END bigquery_dataframes_bqml_arima_multiple_step_7_explain]