mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
brnn metrics
This commit is contained in:
@@ -38,6 +38,7 @@ def get_brnn_data(
|
||||
model_save_name: str = "brnn_model",
|
||||
force_reset: bool = True,
|
||||
save_checkpoints: bool = True,
|
||||
metric: str = "mape",
|
||||
) -> Tuple[
|
||||
Optional[List[TimeSeries]],
|
||||
Optional[List[TimeSeries]],
|
||||
@@ -84,6 +85,8 @@ def get_brnn_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
|
||||
-------
|
||||
@@ -174,4 +177,5 @@ def get_brnn_data(
|
||||
train_split,
|
||||
forecast_horizon,
|
||||
n_predict,
|
||||
metric,
|
||||
)
|
||||
|
||||
@@ -43,6 +43,7 @@ def display_brnn_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 BRNN forecast
|
||||
@@ -102,6 +103,10 @@ def display_brnn_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
|
||||
"""
|
||||
@@ -137,6 +142,7 @@ def display_brnn_forecast(
|
||||
model_save_name=model_save_name,
|
||||
force_reset=force_reset,
|
||||
save_checkpoints=save_checkpoints,
|
||||
metric=metric,
|
||||
)
|
||||
if ticker_series == []:
|
||||
return
|
||||
@@ -160,6 +166,7 @@ def display_brnn_forecast(
|
||||
forecast_only=forecast_only,
|
||||
naive=naive,
|
||||
export_pred_raw=export_pred_raw,
|
||||
metric=metric,
|
||||
external_axes=external_axes,
|
||||
)
|
||||
if residuals:
|
||||
|
||||
@@ -2126,6 +2126,7 @@ class ForecastController(BaseController):
|
||||
end=True,
|
||||
naive=True,
|
||||
export_pred_raw=True,
|
||||
metric=True,
|
||||
)
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser,
|
||||
@@ -2155,6 +2156,7 @@ class ForecastController(BaseController):
|
||||
end_date=ns_parser.s_end_date,
|
||||
naive=ns_parser.naive,
|
||||
export_pred_raw=ns_parser.export_pred_raw,
|
||||
metric=ns_parser.metric,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -2187,6 +2189,7 @@ class ForecastController(BaseController):
|
||||
end=True,
|
||||
naive=True,
|
||||
export_pred_raw=True,
|
||||
metric=True,
|
||||
)
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser,
|
||||
@@ -2214,6 +2217,7 @@ class ForecastController(BaseController):
|
||||
end_date=ns_parser.s_end_date,
|
||||
naive=ns_parser.naive,
|
||||
export_pred_raw=ns_parser.export_pred_raw,
|
||||
metric=ns_parser.metric,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -2273,6 +2277,7 @@ class ForecastController(BaseController):
|
||||
end=True,
|
||||
naive=True,
|
||||
export_pred_raw=True,
|
||||
metric=True,
|
||||
)
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser,
|
||||
@@ -2309,6 +2314,7 @@ class ForecastController(BaseController):
|
||||
end_date=ns_parser.s_end_date,
|
||||
naive=ns_parser.naive,
|
||||
export_pred_raw=ns_parser.export_pred_raw,
|
||||
metric=ns_parser.metric,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -2385,6 +2391,7 @@ class ForecastController(BaseController):
|
||||
end=True,
|
||||
naive=True,
|
||||
export_pred_raw=True,
|
||||
metric=True,
|
||||
)
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser,
|
||||
@@ -2427,6 +2434,7 @@ class ForecastController(BaseController):
|
||||
end_date=ns_parser.s_end_date,
|
||||
naive=ns_parser.naive,
|
||||
export_pred_raw=ns_parser.export_pred_raw,
|
||||
metric=ns_parser.metric,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -2494,6 +2502,7 @@ class ForecastController(BaseController):
|
||||
end=True,
|
||||
naive=True,
|
||||
export_pred_raw=True,
|
||||
metric=True,
|
||||
)
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser,
|
||||
@@ -2537,6 +2546,7 @@ class ForecastController(BaseController):
|
||||
end_date=ns_parser.s_end_date,
|
||||
naive=ns_parser.naive,
|
||||
export_pred_raw=ns_parser.export_pred_raw,
|
||||
metric=ns_parser.metric,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -2644,6 +2654,7 @@ class ForecastController(BaseController):
|
||||
naive=True,
|
||||
explainability_raw=True,
|
||||
export_pred_raw=True,
|
||||
metric=True,
|
||||
)
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser,
|
||||
@@ -2677,6 +2688,7 @@ class ForecastController(BaseController):
|
||||
naive=ns_parser.naive,
|
||||
explainability_raw=ns_parser.explainability_raw,
|
||||
export_pred_raw=ns_parser.export_pred_raw,
|
||||
metric=ns_parser.metric,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -2728,6 +2740,7 @@ class ForecastController(BaseController):
|
||||
end=True,
|
||||
naive=True,
|
||||
export_pred_raw=True,
|
||||
metric=True,
|
||||
)
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser,
|
||||
@@ -2769,6 +2782,7 @@ class ForecastController(BaseController):
|
||||
end_date=ns_parser.s_end_date,
|
||||
naive=ns_parser.naive,
|
||||
export_pred_raw=ns_parser.export_pred_raw,
|
||||
metric=ns_parser.metric,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -2856,6 +2870,7 @@ class ForecastController(BaseController):
|
||||
end=True,
|
||||
naive=True,
|
||||
export_pred_raw=True,
|
||||
metric=True,
|
||||
)
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser,
|
||||
@@ -2899,6 +2914,7 @@ class ForecastController(BaseController):
|
||||
end_date=ns_parser.s_end_date,
|
||||
naive=ns_parser.naive,
|
||||
export_pred_raw=ns_parser.export_pred_raw,
|
||||
metric=ns_parser.metric,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -2972,6 +2988,7 @@ class ForecastController(BaseController):
|
||||
end=True,
|
||||
naive=True,
|
||||
export_pred_raw=True,
|
||||
metric=True,
|
||||
)
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser,
|
||||
@@ -3015,6 +3032,7 @@ class ForecastController(BaseController):
|
||||
end_date=ns_parser.s_end_date,
|
||||
naive=ns_parser.naive,
|
||||
export_pred_raw=ns_parser.export_pred_raw,
|
||||
metric=ns_parser.metric,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -3106,6 +3124,7 @@ class ForecastController(BaseController):
|
||||
end=True,
|
||||
naive=True,
|
||||
export_pred_raw=True,
|
||||
metric=True,
|
||||
)
|
||||
ns_parser = self.parse_known_args_and_warn(
|
||||
parser,
|
||||
@@ -3150,6 +3169,7 @@ class ForecastController(BaseController):
|
||||
end_date=ns_parser.s_end_date,
|
||||
naive=ns_parser.naive,
|
||||
export_pred_raw=ns_parser.export_pred_raw,
|
||||
metric=ns_parser.metric,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
|
||||
Reference in New Issue
Block a user