plotting
plot_backtests(y_true, y_preds, n_cols=2, last_n=DEFAULT_LAST_N, **kwargs)
Given panel DataFrame of observed values y
and backtests across splits y_pred
,
returns subplots for each individual entity / time-series.
Note: if you have over 10 entities / time-series, we recommend using
the rank_
functions in functime.evaluation
then df.head()
before plotting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y_true |
DataFrame
|
Panel DataFrame of observed values. |
required |
y_preds |
DataFrame
|
Panel DataFrame of backtested values. |
required |
n_cols |
int
|
Number of columns to arrange subplots. Defaults to 2. |
2
|
last_n |
int
|
Plot |
DEFAULT_LAST_N
|
Returns:
Name | Type | Description |
---|---|---|
figure |
Figure
|
Plotly subplots. |
plot_comet(y_train, y_test, y_pred, scoring=None, **kwargs)
Given a train-test-split of panel data (y_train
, y_test
) and forecast y_pred
,
returns a Comet plot i.e. scatterplot of volatility per entity in y_train
against the forecast scores.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y_train |
DataFrame
|
Panel DataFrame of train dataset. |
required |
y_test |
DataFrame
|
Panel DataFrame of test dataset. |
required |
y_pred |
DataFrame
|
Panel DataFrame of forecasted values to score against |
required |
scoring |
Optional[metric]
|
If None, defaults to SMAPE. |
None
|
Returns:
Name | Type | Description |
---|---|---|
figure |
Figure
|
Plotly scatterplot. |
plot_forecasts(y_true, y_pred, n_cols=2, last_n=DEFAULT_LAST_N, **kwargs)
Given panel DataFrames of observed values y
and forecasts y_pred
,
returns subplots for each individual entity / time-series.
Note: if you have over 10 entities / time-series, we recommend using
the rank_
functions in functime.evaluation
then df.head()
before plotting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y_true |
DataFrame
|
Panel DataFrame of observed values. |
required |
y_pred |
DataFrame
|
Panel DataFrame of forecasted values. |
required |
n_cols |
int
|
Number of columns to arrange subplots. Defaults to 2. |
2
|
last_n |
int
|
Plot |
DEFAULT_LAST_N
|
Returns:
Name | Type | Description |
---|---|---|
figure |
Figure
|
Plotly subplots. |
plot_fva(y_true, y_pred, y_pred_bench, scoring=None, **kwargs)
Given two panel data forecasts y_pred
and y_pred_bench
,
returns scatterplot of benchmark scores against forecast scores.
Each dot represents a single entity / time-series.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y_true |
DataFrame
|
Panel DataFrame of test dataset. |
required |
y_pred |
DataFrame
|
Panel DataFrame of forecasted values. |
required |
y_pred_bench |
DataFrame
|
Panel DataFrame of benchmark forecast values. |
required |
scoring |
Optional[metric]
|
If None, defaults to SMAPE. |
None
|
Returns:
Name | Type | Description |
---|---|---|
figure |
Figure
|
Plotly scatterplot. |
plot_residuals(y_resids, n_bins=None, **kwargs)
Given panel DataFrame of residuals across splits y_resids
,
returns binned counts plot of forecast residuals colored by entity / time-series.
Useful for residuals analysis (bias and normality) at scale.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y_resids |
DataFrame
|
Panel DataFrame of forecast residuals (i.e. observed less forecast). |
required |
n_bins |
int
|
Number of bins. |
None
|
Returns:
Name | Type | Description |
---|---|---|
figure |
Figure
|
Plotly histogram. |