trans metric

This commit is contained in:
martinb-bb
2023-02-08 14:48:38 -05:00
parent fe074dd3c0
commit 168bb0a5d7
2 changed files with 11 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ def get_trans_data(
model_save_name: str = "trans_model",
force_reset: bool = True,
save_checkpoints: bool = True,
metric: str = "mape",
) -> Tuple[
Optional[List[TimeSeries]],
Optional[List[TimeSeries]],
@@ -94,6 +95,8 @@ def get_trans_data(
discarded). Defaults to True.
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
-------
@@ -176,4 +179,5 @@ def get_trans_data(
train_split,
forecast_horizon,
n_predict,
metric,
)

View File

@@ -47,6 +47,7 @@ def display_trans_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 Transformer forecast
@@ -112,6 +113,10 @@ def display_trans_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
"""
@@ -152,6 +157,7 @@ def display_trans_forecast(
model_save_name=model_save_name,
force_reset=force_reset,
save_checkpoints=save_checkpoints,
metric=metric,
)
if ticker_series == []:
return
@@ -176,6 +182,7 @@ def display_trans_forecast(
naive=naive,
export_pred_raw=export_pred_raw,
external_axes=external_axes,
metric=metric,
)
if residuals:
helpers.plot_residuals(