tcn metrics

This commit is contained in:
martinb-bb
2023-02-08 14:40:05 -05:00
parent bd20473594
commit 56eba54a3e
2 changed files with 11 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ def get_tcn_data(
model_save_name: str = "tcn_model",
force_reset: bool = True,
save_checkpoints: bool = True,
metric: str = "mape",
) -> Tuple[
List[Optional[TimeSeries]],
List[Optional[TimeSeries]],
@@ -86,6 +87,8 @@ def get_tcn_data(
save_checkpoints: bool
Whether or not to automatically save the untrained model and checkpoints from training.
Defaults to True.
metric: str
Metric to use for model selection. Defaults to "mape".
Returns
-------
@@ -166,4 +169,5 @@ def get_tcn_data(
train_split,
forecast_horizon,
n_predict,
metric,
)

View File

@@ -44,6 +44,7 @@ def display_tcn_forecast(
end_date: Optional[datetime] = None,
naive: bool = False,
export_pred_raw: bool = False,
metric: str = "mape",
external_axes: Optional[List[plt.axes]] = None,
):
"""Display TCN forecast
@@ -104,6 +105,10 @@ def display_tcn_forecast(
naive: bool
Whether to show the naive baseline. This just assumes the closing price will be the same
as the previous day's closing price. Defaults to False.
export_pred_raw: bool
Whether to export the raw predicted values. Defaults to False.
metric: str
The metric to use for the model. Defaults to "mape".
external_axes: Optional[List[plt.axes]]
External axes to plot on
"""
@@ -141,6 +146,7 @@ def display_tcn_forecast(
model_save_name=model_save_name,
force_reset=force_reset,
save_checkpoints=save_checkpoints,
metric=metric,
)
if ticker_series == []:
return
@@ -165,6 +171,7 @@ def display_tcn_forecast(
naive=naive,
export_pred_raw=export_pred_raw,
external_axes=external_axes,
metric=metric,
)
if residuals:
helpers.plot_residuals(