Local
Auto
source
AutoRandomForest
Structure to hold a model and its search space
Type | Default | Details | |
---|---|---|---|
config | Optional | None | function that takes an optuna trial and produces a configuration |
source
AutoElasticNet
Structure to hold a model and its search space
Type | Default | Details | |
---|---|---|---|
config | Optional | None | function that takes an optuna trial and produces a configuration |
source
AutoLasso
Structure to hold a model and its search space
Type | Default | Details | |
---|---|---|---|
config | Optional | None | function that takes an optuna trial and produces a configuration |
source
AutoRidge
Structure to hold a model and its search space
Type | Default | Details | |
---|---|---|---|
config | Optional | None | function that takes an optuna trial and produces a configuration |
source
AutoLinearRegression
Structure to hold a model and its search space
Type | Default | Details | |
---|---|---|---|
config | Optional | None | function that takes an optuna trial and produces a configuration |
source
AutoCatboost
Structure to hold a model and its search space
Type | Default | Details | |
---|---|---|---|
config | Optional | None | function that takes an optuna trial and produces a configuration |
source
AutoXGBoost
Structure to hold a model and its search space
Type | Default | Details | |
---|---|---|---|
config | Optional | None | function that takes an optuna trial and produces a configuration |
source
AutoLightGBM
Structure to hold a model and its search space
Type | Default | Details | |
---|---|---|---|
config | Optional | None | function that takes an optuna trial and produces a configuration |
source
random_forest_space
source
elastic_net_space
source
lasso_space
source
ridge_space
source
linear_regression_space
source
catboost_space
source
xgboost_space
source
lightgbm_space
source
AutoModel
Structure to hold a model and its search space
Type | Details | |
---|---|---|
model | BaseEstimator | scikit-learn compatible regressor |
config | Callable | function that takes an optuna trial and produces a configuration |
source
AutoMLForecast
Hyperparameter optimization helper
Type | Default | Details | |
---|---|---|---|
models | Union | Auto models to be optimized. | |
freq | Union | pandas’ or polars’ offset alias or integer denoting the frequency of the series. | |
season_length | Optional | None | Length of the seasonal period. This is used for producing the feature space. Only required if init_config is None. |
init_config | Optional | None | Function that takes an optuna trial and produces a configuration passed to the MLForecast constructor. |
fit_config | Optional | None | Function that takes an optuna trial and produces a configuration passed to the MLForecast fit method. |
num_threads | int | 1 | Number of threads to use when computing the features. |
source
AutoMLForecast.fit
Carry out the optimization process. Each model is optimized independently and the best one is trained on all data
Type | Default | Details | |
---|---|---|---|
df | Union | Series data in long format. | |
n_windows | int | Number of windows to evaluate. | |
h | int | Forecast horizon. | |
num_samples | int | Number of trials to run | |
step_size | Optional | None | Step size between each cross validation window. If None it will be equal to h . |
input_size | Optional | None | Maximum training samples per serie in each window. If None, will use an expanding window. |
refit | Union | False | 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 every refit windows. |
loss | Optional | None | Function that takes the validation and train dataframes and produces a float. If None will use the average SMAPE across series. |
id_col | str | unique_id | Column that identifies each serie. |
time_col | str | ds | Column that identifies each timestep, its values can be timestamps or integers. |
target_col | str | y | Column that contains the target. |
study_kwargs | Optional | None | Keyword arguments to be passed to the optuna.Study constructor. |
optimize_kwargs | Optional | None | Keyword arguments to be passed to the optuna.Study.optimize method. |
fitted | bool | False | Whether to compute the fitted values when retraining the best model. |
prediction_intervals | Optional | None | Configuration to calibrate prediction intervals when retraining the best model. |
Returns | AutoMLForecast | object with best models and optimization results |
source
AutoMLForecast.predict
“Compute forecasts
Type | Default | Details | |
---|---|---|---|
h | int | Number of periods to predict. | |
X_df | Union | None | Dataframe with the future exogenous features. Should have the id column and the time column. |
level | Optional | None | Confidence levels between 0 and 100 for prediction intervals. |
Returns | Union | Predictions for each serie and timestep, with one column per model. |
source
AutoMLForecast.save
Save AutoMLForecast objects
Type | Details | |
---|---|---|
path | Union | Directory where artifacts will be stored. |
Returns | None |
source
AutoMLForecast.forecast_fitted_values
Access in-sample predictions.
Type | Default | Details | |
---|---|---|---|
level | Optional | None | Confidence levels between 0 and 100 for prediction intervals. |
Returns | Union | Dataframe with predictions for the training set |
unique_id | ds | lgb | lgb-lo-80 | lgb-hi-80 | ridge | ridge-lo-80 | ridge-hi-80 | |
---|---|---|---|---|---|---|---|---|
0 | W1 | 2180 | 35529.435224 | 35061.835362 | 35997.035086 | 36110.921202 | 35880.445097 | 36341.397307 |
1 | W1 | 2181 | 35521.764894 | 34973.035617 | 36070.494171 | 36195.175757 | 36051.013811 | 36339.337702 |
2 | W1 | 2182 | 35537.417268 | 34960.050939 | 36114.783596 | 36107.528852 | 35784.062169 | 36430.995536 |
3 | W1 | 2183 | 35538.058206 | 34823.640706 | 36252.475705 | 36027.139248 | 35612.635725 | 36441.642771 |
4 | W1 | 2184 | 35614.611211 | 34627.023739 | 36602.198683 | 36092.858489 | 35389.690977 | 36796.026000 |
… | … | … | … | … | … | … | … | … |
4662 | W99 | 2292 | 15071.536978 | 14484.617399 | 15658.456557 | 15319.146221 | 14869.410567 | 15768.881875 |
4663 | W99 | 2293 | 15058.145278 | 14229.686322 | 15886.604234 | 15299.549555 | 14584.269352 | 16014.829758 |
4664 | W99 | 2294 | 15042.493434 | 14096.380636 | 15988.606232 | 15271.744712 | 14365.349338 | 16178.140086 |
4665 | W99 | 2295 | 15042.144846 | 14037.053904 | 16047.235787 | 15250.070504 | 14403.428791 | 16096.712216 |
4666 | W99 | 2296 | 15038.729044 | 13944.821480 | 16132.636609 | 15232.127800 | 14325.059776 | 16139.195824 |
unique_id | ds | y | lgb | lgb-lo-95 | lgb-hi-95 | ridge | ridge-lo-95 | ridge-hi-95 | |
---|---|---|---|---|---|---|---|---|---|
0 | W1 | 15 | 1071.06 | 1060.584344 | 599.618355 | 1521.550334 | 1076.990151 | 556.535492 | 1597.444810 |
1 | W1 | 16 | 1073.73 | 1072.669242 | 611.703252 | 1533.635232 | 1083.633276 | 563.178617 | 1604.087936 |
2 | W1 | 17 | 1066.97 | 1072.452128 | 611.486139 | 1533.418118 | 1084.724311 | 564.269652 | 1605.178970 |
3 | W1 | 18 | 1066.17 | 1065.837828 | 604.871838 | 1526.803818 | 1080.127197 | 559.672538 | 1600.581856 |
4 | W1 | 19 | 1064.43 | 1065.214681 | 604.248691 | 1526.180671 | 1080.636826 | 560.182167 | 1601.091485 |
… | … | … | … | … | … | … | … | … | … |
361881 | W99 | 2279 | 15738.54 | 15887.661228 | 15721.237195 | 16054.085261 | 15927.918181 | 15723.222760 | 16132.613603 |
361882 | W99 | 2280 | 15388.13 | 15755.943789 | 15589.519756 | 15922.367823 | 15841.599064 | 15636.903642 | 16046.294485 |
361883 | W99 | 2281 | 15187.62 | 15432.224701 | 15265.800668 | 15598.648735 | 15584.462232 | 15379.766811 | 15789.157654 |
361884 | W99 | 2282 | 15172.27 | 15177.040831 | 15010.616797 | 15343.464864 | 15396.243223 | 15191.547801 | 15600.938644 |
361885 | W99 | 2283 | 15101.03 | 15162.090803 | 14995.666770 | 15328.514836 | 15335.982465 | 15131.287044 | 15540.677887 |
unique_id | ds | ridge | ridge-lo-80 | ridge-hi-80 |
---|---|---|---|---|
str | i64 | f64 | f64 | f64 |
”W1” | 2180 | 35046.096663 | 34046.69521 | 36045.498116 |
”W1” | 2181 | 34743.269216 | 33325.847975 | 36160.690457 |
”W1” | 2182 | 34489.591086 | 32591.254559 | 36387.927614 |
”W1” | 2183 | 34270.768179 | 32076.507727 | 36465.02863 |
”W1” | 2184 | 34124.021857 | 31352.454121 | 36895.589593 |
… | … | … | … | … |
”W99” | 2292 | 14719.457096 | 13983.308582 | 15455.605609 |
”W99” | 2293 | 14631.552077 | 13928.874336 | 15334.229818 |
”W99” | 2294 | 14532.905239 | 13642.840118 | 15422.97036 |
”W99” | 2295 | 14446.065443 | 13665.088667 | 15227.04222 |
”W99” | 2296 | 14363.049604 | 13654.220051 | 15071.879157 |
unique_id | ds | y | ridge | ridge-lo-95 | ridge-hi-95 |
---|---|---|---|---|---|
str | i64 | f64 | f64 | f64 | f64 |
”W1” | 14 | 1061.96 | 1249.326428 | 488.765249 | 2009.887607 |
”W1” | 15 | 1071.06 | 1246.067836 | 485.506657 | 2006.629015 |
”W1” | 16 | 1073.73 | 1254.027897 | 493.466718 | 2014.589076 |
”W1” | 17 | 1066.97 | 1254.475948 | 493.914769 | 2015.037126 |
”W1” | 18 | 1066.17 | 1248.306754 | 487.745575 | 2008.867933 |
… | … | … | … | … | … |
”W99” | 2279 | 15738.54 | 15754.558812 | 15411.968645 | 16097.148979 |
”W99” | 2280 | 15388.13 | 15655.780865 | 15313.190698 | 15998.371032 |
”W99” | 2281 | 15187.62 | 15367.498468 | 15024.908301 | 15710.088635 |
”W99” | 2282 | 15172.27 | 15172.591423 | 14830.001256 | 15515.18159 |
”W99” | 2283 | 15101.03 | 15141.032886 | 14798.44272 | 15483.623053 |