plotting
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_entities(y, **kwargs)
Given panel DataFrame of observed values y
,
returns bar chart of entity counts, which is the number of observed values per entity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
DataFrame | LazyFrame
|
Panel DataFrame of observed values. |
required |
**kwargs |
Additional keyword arguments to pass to a |
{}
|
Returns:
Name | Type | Description |
---|---|---|
figure |
Figure
|
Plotly bar chart. |
plot_forecasts(*, y_true, y_pred, num_series=None, num_cols=None, num_points=None, seed=None, layout_kwargs=None, line_kwargs=None)
Given panel DataFrames of observed values y
and forecasts y_pred
,
returns subplots for each individual entity / time-series.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
Union[DataFrame, LazyFrame]
|
Panel DataFrame of observed values. |
required |
num_series |
Optional[int]
|
Number of entities / time-series to plot. If |
None
|
num_points |
Optional[int]
|
Plot |
None
|
num_cols |
Optional[int]
|
Number of columns to arrange subplots. Defaults to 2. |
None
|
seed |
Optional[int]
|
Random seed for sampling entities / time-series. Defaults to None. |
None
|
layout_kwargs |
Optional[Dict[str, Any]]
|
Additional keyword arguments to pass to |
None
|
line_kwargs |
Optional[Dict[str, Any]]
|
Additional keyword arguments to pass to a |
None
|
Returns:
Name | Type | Description |
---|---|---|
figure |
Figure
|
Plotly instance of |
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_panel(y, *, num_series=None, num_cols=None, num_points=None, seed=None, layout_kwargs=None, line_kwargs=None)
Given panel DataFrames of observed values y
,
returns subplots for each individual entity / time-series.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
Union[DataFrame, LazyFrame]
|
Panel DataFrame of observed values. |
required |
num_series |
Optional[int]
|
Number of entities / time-series to plot. If |
None
|
num_points |
Optional[int]
|
Plot |
None
|
num_cols |
Optional[int]
|
Number of columns to arrange subplots. Defaults to 2. |
None
|
seed |
Optional[int]
|
Random seed for sampling entities / time-series. Defaults to |
None
|
layout_kwargs |
Optional[Dict[str, Any]]
|
Additional keyword arguments to pass to a |
None
|
line_kwargs |
Optional[Dict[str, Any]]
|
Additional keyword arguments to pass to a |
None
|
Returns:
Name | Type | Description |
---|---|---|
figure |
Figure
|
Plotly instance of |
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 |
Union[DataFrame, LazyFrame]
|
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. |