Skip to main content

regr

Perform Regression Forecasting

Source Code: [link]

openbb.forecast.regr(data: Union[pd.Series, pd.DataFrame], target_column: str = "close", n_predict: int = 5, past_covariates: Optional[str] = None, train_split: float = 0.85, forecast_horizon: int = 5, output_chunk_length: int = 5, lags: Union[int, List[int]] = 14, metric: str = "mape")

Parameters

NameTypeDescriptionDefaultOptional
dataUnion[pd.Series, pd.DataFrame]Input DataNoneFalse
n_predictintDays to predict. Defaults to 5.5True
target_columnstrTarget column to forecast. Defaults to "close".closeTrue
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
output_chunk_lengthintThe length of the forecast of the model. Defaults to 1.5True
lagsUnion[int, List[int]]lagged target values to predict the next time step14True
metricstrMetric to use for evaluation. Defaults to "mape".mapeTrue

Returns

TypeDescription
Tuple[List[TimeSeries], List[TimeSeries], List[TimeSeries], float, type[RegressionModel]]Adjusted Data series,
Historical forecast by best RNN model,
list of Predictions,
Mean average precision error,
Best Regression Model.