From 477e4271db644b92acd8e496c984d348e6c0d775 Mon Sep 17 00:00:00 2001 From: martinb-bb <105685594+martinb-bb@users.noreply.github.com> Date: Wed, 8 Feb 2023 14:14:59 -0500 Subject: [PATCH] linregr metrics --- openbb_terminal/forecast/linregr_model.py | 4 ++++ openbb_terminal/forecast/linregr_view.py | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/openbb_terminal/forecast/linregr_model.py b/openbb_terminal/forecast/linregr_model.py index 5e4e4d91fc4..70a60654cd0 100644 --- a/openbb_terminal/forecast/linregr_model.py +++ b/openbb_terminal/forecast/linregr_model.py @@ -27,6 +27,7 @@ def get_linear_regression_data( output_chunk_length: int = 5, lags: Union[int, List[int]] = 14, random_state: Optional[int] = None, + metric: str = "mape", ) -> Tuple[ List[TimeSeries], List[TimeSeries], @@ -56,6 +57,8 @@ def get_linear_regression_data( lagged target values to predict the next time step random_state: Optional[int] The state for the model + metric: str + The metric to use for the model. Defaults to "mape". Returns ------- @@ -112,4 +115,5 @@ def get_linear_regression_data( train_split, forecast_horizon, n_predict, + metric, ) diff --git a/openbb_terminal/forecast/linregr_view.py b/openbb_terminal/forecast/linregr_view.py index 6bc09879edc..2b3815338cd 100644 --- a/openbb_terminal/forecast/linregr_view.py +++ b/openbb_terminal/forecast/linregr_view.py @@ -35,6 +35,7 @@ def display_linear_regression( naive: bool = False, explainability_raw: bool = False, export_pred_raw: bool = False, + metric: str = "mape", external_axes: Optional[List[plt.axes]] = None, ): """Display Linear Regression Forecasting @@ -74,6 +75,12 @@ def display_linear_regression( 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. + explainability_raw: bool + Whether to show the raw explainability data. Defaults to False. + export_pred_raw: bool + Whether to export the raw prediction data. 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 """ @@ -100,6 +107,7 @@ def display_linear_regression( forecast_horizon=forecast_horizon, output_chunk_length=output_chunk_length, lags=lags, + metric=metric, ) probabilistic = True @@ -121,6 +129,7 @@ def display_linear_regression( forecast_only=forecast_only, naive=naive, export_pred_raw=export_pred_raw, + metric=metric, external_axes=external_axes, ) if residuals: