module mlforecast.auto
function lightgbm_space
function xgboost_space
function catboost_space
function linear_regression_space
function ridge_space
function lasso_space
function elastic_net_space
function random_forest_space
class AutoModel
Structure to hold a model and its search space
Args:
model(BaseEstimator): scikit-learn compatible regressorconfig(callable): function that takes an optuna trial and produces a configuration
method __init__
class AutoLightGBM
method __init__
class AutoXGBoost
method __init__
class AutoCatboost
method __init__
class AutoLinearRegression
method __init__
class AutoRidge
method __init__
class AutoLasso
method __init__
class AutoElasticNet
method __init__
class AutoRandomForest
method __init__
class AutoMLForecast
Hyperparameter optimization helper
Args:
models(list or dict): Auto models to be optimized.freq(str or int): pandas’ or polars’ offset alias or integer denoting the frequency of the series.season_length(int, optional): Length of the seasonal period. This is used for producing the feature space. Only required ifinit_configis None. Defaults to None.init_config(callable, optional): Function that takes an optuna trial and produces a configuration passed to the MLForecast constructor. Defaults to None.fit_config(callable, optional): Function that takes an optuna trial and produces a configuration passed to the MLForecast fit method. Defaults to None.num_threads(int): Number of threads to use when computing the features. Defaults to 1.
method __init__
method fit
df(pandas or polars DataFrame): Series data in long format.n_windows(int): Number of windows to evaluate.h(int): Forecast horizon.num_samples(int): Number of trials to runstep_size(int, optional): Step size between each cross validation window. If None it will be equal toh. Defaults to None.input_size(int, optional): Maximum training samples per serie in each window. If None, will use an expanding window. Defaults to None.refit(bool or int): Retrain model for each cross validation window. If False, the models are trained at the beginning and then used to predict each window. If positive int, the models are retrained everyrefitwindows. Defaults to False.loss(callable, optional): Function that takes the validation and train dataframes and produces a float. IfNonewill use the average SMAPE across series. 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’.study_kwargs(dict, optional): Keyword arguments to be passed to the optuna.Study constructor. Defaults to None.optimize_kwargs(dict, optional): Keyword arguments to be passed to the optuna.Study.optimize method. Defaults to None.fitted(bool): Whether to compute the fitted values when retraining the best model. Defaults to False.prediction_intervals: Configuration to calibrate prediction intervals when retraining the best model.
(AutoMLForecast): object with best models and optimization results
method forecast_fitted_values
level(list of ints or floats, optional): Confidence levels between 0 and 100 for prediction intervals. Defaults to None.
(pandas or polars DataFrame): Dataframe with predictions for the training set
method predict
h(int): Number of periods to predict.X_df(pandas or polars DataFrame, optional): Dataframe with the future exogenous features. Should have the id column and the time column. Defaults to None.level(list of ints or floats, optional): Confidence levels between 0 and 100 for prediction intervals. Defaults to None.
(pandas or polars DataFrame): Predictions for each serie and timestep, with one column per model.
method save
path(str or pathlib.Path): Directory where artifacts will be stored.

