module statsforecast.core
class GroupedArray
method __init__
method cross_validation
method fit
method fit_predict
method forecast
method predict
method split
method split_fm
method take
class ParallelBackend
method cross_validation
method forecast
class StatsForecast
method __init__
models(List[Any]): List of instantiated objects models.StatsForecast.freq(str or int): Frequency of the data. Must be a valid pandas or polars offset alias, or an integer.n_jobs(int): Number of jobs used in the parallel processing, use -1 for all cores. Defaults to 1.df(pandas or polars DataFrame): DataFrame with ids, times, targets and exogenous.fallback_model(Any, optional): Model to be used if a model fails. Only works with theforecastandcross_validationmethods. Defaults to None.verbose(bool): Prints TQDM progress bar whenn_jobs=1. Defaults to True.
method cross_validation
method cross_validation_fitted_values
StatsForecast.cross_validation, you can access the insample prediction values for each model and window. To get them, you need to pass fitted=True to the StatsForecast.cross_validation method and then use the StatsForecast.cross_validation_fitted_values method.
Returns:
pandas or polars DataFrame: DataFrame with insamplemodelscolumns for point predictions and probabilistic predictions for all fittedmodels.
method fit
models to a large set of time series from DataFrame df and store fitted models for later inspection.
Args:
df(pandas or polars DataFrame): DataFrame with ids, times, targets and exogenous.prediction_intervals(ConformalIntervals, optional): Configuration to calibrate prediction intervals (Conformal Prediction). Defaults to None.id_col(str): Column that identifies each serie. Defaults to ‘unique_id’.time_col(str): Column that identifies each timestep, its values can be timestamps or integers. Defaults to ‘ds’.target_col(str): Column that contains the target. Defaults to ‘y’.
StatsForecast: Returns with storedStatsForecastfittedmodels.
method fit_predict
fit_predict without storing information. It requires the forecast horizon h in advance.
In contrast to StatsForecast.forecast this method stores partial models outputs.
Args:
h(int): Forecast horizon.df(pandas or polars DataFrame): DataFrame with ids, times, targets and exogenous.X_df(pandas or polars DataFrame, optional): DataFrame with ids, times and future exogenous. Defaults to None.level(List[float], optional): Confidence levels between 0 and 100 for prediction intervals. Defaults to None.prediction_intervals(ConformalIntervals, optional): Configuration to calibrate prediction intervals (Conformal Prediction). Defaults to None.id_col(str): Column that identifies each serie. Defaults to ‘unique_id’.time_col(str): Column that identifies each timestep, its values can be timestamps or integers. Defaults to ‘ds’.target_col(str): Column that contains the target. Defaults to ‘y’.
pandas or polars DataFrame: DataFrame withmodelscolumns for point predictions and probabilistic predictions for all fittedmodels.
method forecast
method forecast_fitted_values
method load
path(str or pathlib.Path): Path to saved StatsForecast file.
StatsForecast: Previously saved StatsForecast
method plot
df(pandas or polars DataFrame): DataFrame with ids, times, targets and exogenous.forecasts_df(pandas or polars DataFrame, optional): DataFrame ids, times and models. Defaults to None.unique_ids(list of str, optional): ids to plot. If None, they’re selected randomly. Defaults to None.plot_random(bool): Select time series to plot randomly. Defaults to True.models(List[str], optional): List of models to plot. Defaults to None.level(List[float], optional): List of prediction intervals to plot if paseed. Defaults to None.max_insample_length(int, optional): Max number of train/insample observations to be plotted. Defaults to None.plot_anomalies(bool): Plot anomalies for each prediction interval. Defaults to False.engine(str): Library used to plot. ‘plotly’, ‘plotly-resampler’ or ‘matplotlib’. Defaults to ‘matplotlib’.id_col(str): Column that identifies each serie. Defaults to ‘unique_id’.time_col(str): Column that identifies each timestep, its values can be timestamps or integers. Defaults to ‘ds’.target_col(str): Column that contains the target. Defaults to ‘y’.resampler_kwargs(dict): Kwargs to be passed to plotly-resampler constructor. For further custumization (“show_dash”) call the method, store the plotting object and add the extra arguments to itsshow_dashmethod.
method predict
models to predict large set of time series from DataFrame df.
Args:
h(int): Forecast horizon.X_df(pandas or polars DataFrame, optional): DataFrame with ids, times and future exogenous. Defaults to None.level(List[float], optional): Confidence levels between 0 and 100 for prediction intervals. Defaults to None.
pandas or polars DataFrame: DataFrame withmodelscolumns for point predictions and probabilistic predictions for all fittedmodels.
method save
path(str or pathlib.Path, optional): Path of the file to be saved. IfNonewill create one in the current directory using the current UTC timestamp. Defaults to None.max_size(str, optional): StatsForecast object should not exceed this size.Available byte naming: [‘B’, ‘KB’, ‘MB’, ‘GB’]. Defaults to None.trim(bool): Delete any attributes not needed for inference. Defaults to False.

