diff --git a/openbb_terminal/forecast/rnn_model.py b/openbb_terminal/forecast/rnn_model.py index 5f860bb43e0..8744ef98338 100644 --- a/openbb_terminal/forecast/rnn_model.py +++ b/openbb_terminal/forecast/rnn_model.py @@ -36,6 +36,7 @@ def get_rnn_data( input_chunk_size: int = 14, force_reset: bool = True, save_checkpoints: bool = True, + metric: str = "mape", ) -> Tuple[ Optional[List[type[TimeSeries]]], Optional[List[type[TimeSeries]]], @@ -77,6 +78,8 @@ def get_rnn_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 ------- @@ -145,4 +148,5 @@ def get_rnn_data( train_split, forecast_horizon, n_predict, + metric, ) diff --git a/openbb_terminal/forecast/rnn_view.py b/openbb_terminal/forecast/rnn_view.py index 31f25916575..cbf1360f8cd 100644 --- a/openbb_terminal/forecast/rnn_view.py +++ b/openbb_terminal/forecast/rnn_view.py @@ -42,6 +42,7 @@ def display_rnn_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 RNN forecast @@ -94,6 +95,10 @@ def display_rnn_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 predictions. Defaults to False. + metric: str + The metric to use for the forecast. Defaults to "mape". external_axes: Optional[List[plt.axes]] External axes to plot on """ @@ -124,6 +129,7 @@ def display_rnn_forecast( input_chunk_size=input_chunk_size, force_reset=force_reset, save_checkpoints=save_checkpoints, + metric=metric, ) if ticker_series == []: return @@ -148,6 +154,7 @@ def display_rnn_forecast( forecast_only=forecast_only, naive=naive, export_pred_raw=export_pred_raw, + metric=metric, external_axes=external_axes, ) if residuals: