Skip to content

Commit

Permalink
docs: Fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
uadnan committed Oct 8, 2024
1 parent 9b6e23e commit 6f5a2dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 6 additions & 3 deletions docs/examples/air_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def inverse_transform(df):
)

df_forecast = inverse_transform(forecast.to_dataframe(dataset_pm_univariate, conf=None))
print(forecast.plot(df_forecast, max_num_groups=3, split_dt=SPLIT_DT))
print(forecast.plot(df_forecast, max_num_groups=3, split_dt=SPLIT_DT, time_colname='time', group_colname='group'))

# %% [markdown]
# #### Evaluating Performance: Expanding Window
Expand Down Expand Up @@ -185,7 +185,10 @@ def inverse_transform(df):
# In our case this unfortunately won't work: we have log-transformed our measures. This seems like it was the right choice (i.e. our residuals look reasonably normal and i.i.d):

# %%
pred_4step.plot(pred_4step.to_dataframe(dataset_pm_multivariate, type='components').query("process=='residuals'"))
pred_4step.plot(
pred_4step.to_dataframe(dataset_pm_multivariate, type='components').query("process=='residuals'"),
time_colname='time', group_colname='group'
)


# %% [markdown]
Expand Down Expand Up @@ -308,7 +311,7 @@ def mc_preds_to_dataframe(preds: Predictions,
)
pred_4step.plot(
pred_4step.to_dataframe(dataset_pm_lm, type='components').query("process.str.contains('lm')"),
split_dt=SPLIT_DT
split_dt=SPLIT_DT, time_colname='time', group_colname='group'
)

# %% [markdown]
Expand Down
7 changes: 5 additions & 2 deletions docs/quick_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,13 @@
# The `Predictions` class comes with a `plot` classmethod for getting simple plots of forecasted vs. actual:

# %%
print(pred.plot(df_pred.query("group=='Changping'"), split_dt=SPLIT_DT))
print(pred.plot(df_pred.query("group=='Changping'"), split_dt=SPLIT_DT, time_colname='time', group_colname='group'))

# %% [markdown]
# Finally you can produce dataframes that decompose the predictions into the underlying `processes` that produced them:

# %%
pred.plot(pred.to_dataframe(dataset_all, type='components').query("group=='Changping'"), split_dt=SPLIT_DT)
pred.plot(
pred.to_dataframe(dataset_all, type='components').query("group=='Changping'"), split_dt=SPLIT_DT,
time_colname='time', group_colname='group'
)

0 comments on commit 6f5a2dc

Please sign in to comment.