Skip to main content

brnn

Performs Block RNN forecasting

Source Code: [link]

openbb.forecast.brnn(data: Union[pd.Series, pd.DataFrame], target_column: str = "close", n_predict: int = 5, train_split: float = 0.85, past_covariates: str = None, forecast_horizon: int = 5, input_chunk_length: int = 14, output_chunk_length: int = 5, model_type: str = "LSTM", n_rnn_layers: int = 1, dropout: float = 0.0, batch_size: int = 32, n_epochs: int = 100, learning_rate: float = 0.001, model_save_name: str = "brnn_model", force_reset: bool = True, save_checkpoints: bool = True)

Parameters

NameTypeDescriptionDefaultOptional
dataUnion[pd.Series, pd.DataFrame]Input DataNoneFalse
target_columnstrTarget column to forecast. Defaults to "close".closeTrue
n_predictintDays to predict. Defaults to 5.5True
train_splitfloatTrain/val split. Defaults to 0.85.0.85True
past_covariatesstrMultiple secondary columns to factor in when forecasting. Defaults to None.NoneTrue
forecast_horizonintForecast horizon when performing historical forecasting. Defaults to 5.5True
input_chunk_lengthintNumber of past time steps that are fed to the forecasting module at prediction time. Defaults to 14.14True
output_chunk_lengthintThe length of the forecast of the model. Defaults to 5.5True
model_typestrEither a string specifying the RNN module type ("RNN", "LSTM" or "GRU"). Defaults to "LSTM".LSTMTrue
n_rnn_layersintNumber of layers in the RNN module. Defaults to 1.1True
dropoutfloatFraction of neurons affected by Dropout. Defaults to 0.0.0.0True
batch_sizeintNumber of time series (input and output sequences) used in each training pass. Defaults to 32.32True
n_epochsintNumber of epochs over which to train the model. Defaults to 100.100True
learning_ratefloatDefaults to 1e-3.0.001True
model_save_namestrName for model. Defaults to "brnn_model".brnn_modelTrue
force_resetboolIf set to True, any previously-existing model with the same name will be reset (all checkpoints will be
discarded). Defaults to True.
TrueTrue
save_checkpointsboolWhether or not to automatically save the untrained model and checkpoints from training. Defaults to True.TrueTrue

Returns

TypeDescription
E501Adjusted Data series,
Historical forecast by best RNN model,
list of Predictions,
Mean average precision error,
Best BRNN Model.