Change Log¶
All significant changes to this project are documented in this release file.
[0.10.1] - [2023-09-26]¶
This is a minor release to fix a bug when using grid_search_forecaster, random_search_forecaster or bayesian_search_forecaster with a Forecaster that includes differentiation.
Added
Changed
Fixed
- Bug fix
grid_search_forecaster,random_search_forecasterorbayesian_search_forecasterwith a Forecaster that includes differentiation.
[0.10.0] - [2023-09-07]¶
The main changes in this release are:
-
New
Sarimax.Sarimaxmodel. A wrapper ofstatsmodels.SARIMAXthat follows the scikit-learn API and can be used with theForecasterSarimax. -
Added
differentiationargument toForecasterAutoregandForecasterAutoregCustomto model the n-order differentiated time series using the new skforecast preprocessorTimeSeriesDifferentiator.
Added
-
New
Sarimax.Sarimaxmodel. A wrapper ofstatsmodels.SARIMAXthat follows the scikit-learn API. -
Added
skforecast.preprocessing.TimeSeriesDifferentiatorto preprocess time series by differentiating or integrating them (reverse differentiation). -
Added
differentiationargument toForecasterAutoregandForecasterAutoregCustomto model the n-order differentiated time series.
Changed
-
Refactor
ForecasterSarimaxto work with both skforecast Sarimax and pmdarima ARIMA models. -
Replace
setup.pywithpyproject.toml.
Fixed
[0.9.1] - [2023-07-14]¶
The main changes in this release are:
- Fix imports in
skforecast.utilsmodule to correctly importsklearn.linear_modelinto theselect_n_jobs_backtestingandselect_n_jobs_fit_forecasterfunctions.
Added
Changed
Fixed
- Fix imports in
skforecast.utilsmodule to correctly importsklearn.linear_modelinto theselect_n_jobs_backtestingandselect_n_jobs_fit_forecasterfunctions.
[0.9.0] - [2023-07-09]¶
The main changes in this release are:
-
ForecasterAutoregDirectandForecasterAutoregMultiVariateinclude then_jobsargument in theirfitmethod, allowing multi-process parallelization for improved performance. -
All backtesting and grid search functions have been extended to include the
n_jobsargument, allowing multi-process parallelization for improved performance. -
Argument
refitnow can be also anintegerin all backtesting dependent functions in modulesmodel_selection,model_selection_multiseries, andmodel_selection_sarimax. This allows the Forecaster to be trained every this number of iterations. -
ForecasterAutoregMultiSeriesandForecasterAutoregMultiSeriesCustomcan be trained using series of different lengths. This means that the model can handle datasets with different numbers of data points in each series.
Added
-
Support for
scikit-learn 1.3.x. -
Argument
n_jobs='auto'tofitmethod inForecasterAutoregDirectandForecasterAutoregMultiVariateto allow multi-process parallelization. -
Argument
n_jobs='auto'to all backtesting dependent functions in modulesmodel_selection,model_selection_multiseriesandmodel_selection_sarimaxto allow multi-process parallelization. -
Argument
refitnow can be also anintegerin all backtesting dependent functions in modulesmodel_selection,model_selection_multiseries, andmodel_selection_sarimax. This allows the Forecaster to be trained every this number of iterations. -
ForecasterAutoregMultiSeriesandForecasterAutoregMultiSeriesCustomallow to use series of different lengths for training. -
Added
show_progressto grid search functions. -
Added functions
select_n_jobs_backtestingandselect_n_jobs_fit_forecastertoutilsto select the number of jobs to use during multi-process parallelization.
Changed
-
Remove
get_feature_importancein favor ofget_feature_importancesin all Forecasters, (deprecated since 0.8.0). -
The
model_selection._create_backtesting_foldsfunction now also returns the last window indices and whether or not to train the forecaster. -
The
model_selectionfunctions_backtesting_forecaster_refitand_backtesting_forecaster_no_refithave been unified in_backtesting_forecaster. -
The
model_selection_multiseriesfunctions_backtesting_forecaster_multiseries_refitand_backtesting_forecaster_multiseries_no_refithave been unified in_backtesting_forecaster_multiseries. -
The
model_selection_sarimaxfunctions_backtesting_refit_sarimaxand_backtesting_no_refit_sarimaxhave been unified in_backtesting_sarimax. -
utils.preprocess_yallows a pandas DataFrame as input.
Fixed
-
Ensure reproducibility of Direct Forecasters when using
predict_bootstrapping,predict_distandpredict_intervalwith alistof steps. -
The
create_train_X_ymethod returns a dict of pandas Series asy_traininForecasterAutoregDirectandForecasterAutoregMultiVariate. This ensures that each series has the appropriate index according to the step to be trained. -
The
filter_train_X_y_for_stepmethod inForecasterAutoregDirectandForecasterAutoregMultiVariatenow updates the index ofX_train_stepto ensure correct alignment withy_train_step.
[0.8.1] - [2023-05-27]¶
Added
- Argument
store_in_sample_residuals=Trueinfitmethod added to all forecasters to speed up functions such as backtesting.
Changed
- Refactor
utils.exog_to_directandutils.exog_to_direct_numpyto increase performance.
Fixed
utils.check_exog_dtypesnow compares thedtype.nameinstead of thedtype. (suggested by Metaming https://github.com/Metaming)
[0.8.0] - [2023-05-16]¶
Added
-
Added the
fit_kwargsargument to all forecasters to allow the inclusion of additional keyword arguments passed to the regressor'sfitmethod. -
Added the
set_fit_kwargsmethod to set thefit_kwargsattribute. -
Support for
pandas 2.0.x. -
Added
exceptionsmodule with custom warnings. -
Added function
utils.check_exog_dtypesto issue a warning if exogenous variables are one of typeinit,float, orcategory. Raise Exception ifexoghas categorical columns with non integer values. -
Added function
utils.get_exog_dtypesto get the data types of the exogenous variables included during the training of the forecaster model. -
Added function
utils.cast_exog_dtypesto cast data types of the exogenous variables using a dictionary as a mapping. -
Added function
utils.check_select_fit_kwargsto check if the argumentfit_kwargsis a dictionary and select only the keys used by thefitmethod of the regressor. -
Added function
model_selection._create_backtesting_foldsto provide train/test indices (position) for backtesting functions. -
Added argument
gapto functions inmodel_selection,model_selection_multiseriesandmodel_selection_sarimaxto omit observations between training and prediction. -
Added argument
show_progressto functionsmodel_selection.backtesting_forecaster,model_selection_multiseries.backtesting_forecaster_multiseriesandmodel_selection_sarimax.backtesting_forecaster_sarimaxto indicate weather to show a progress bar. -
Added argument
remove_suffix, defaultFalse, to the methodfilter_train_X_y_for_step()inForecasterAutoregDirectandForecasterAutoregMultiVariate. Ifremove_suffix=Truethe suffix "_step_i" will be removed from the column names of the training matrices.
Changed
-
Rename optional dependency package
statsmodelstosarimax. Now onlypmdarimawill be installed,statsmodelsis no longer needed. -
Rename
get_feature_importance()toget_feature_importances()in all Forecasters.get_feature_importance()method will me removed in skforecast 0.9.0. -
Refactor
get_feature_importances()in all Forecasters. -
Remove
model_selection_statsmodelsin favor ofForecasterSarimaxandmodel_selection_sarimax, (deprecated since 0.7.0). -
Remove attributes
create_predictorsandsource_code_create_predictorsin favor offun_predictorsandsource_code_fun_predictorsinForecasterAutoregCustom, (deprecated since 0.7.0). -
The
utils.check_exogfunction now includes a new optional parameter,allow_nan, that controls whether a warning should be issued if the inputexogcontains NaN values. -
utils.check_exogis applied before and afterexogtransformations. -
The
utils.preprocess_yfunction now includes a new optional parameter,return_values, that controls whether to return a numpy ndarray with the values of y or not. This new option is intended to avoid copying data when it is not necessary. -
The
utils.preprocess_exogfunction now includes a new optional parameter,return_values, that controls whether to return a numpy ndarray with the values of y or not. This new option is intended to avoid copying data when it is not necessary. -
Replaced
tqdm.tqdmbytqdm.auto.tqdm. -
Refactor
utils.exog_to_direct.
Fixed
- The dtypes of exogenous variables are maintained when generating the training matrices with the
create_train_X_ymethod in all the Forecasters.
[0.7.0] - [2023-03-21]¶
Added
-
Class
ForecasterAutoregMultiSeriesCustom. -
Class
ForecasterSarimaxandmodel_selection_sarimax(wrapper of pmdarima). -
Method
predict_interval()toForecasterAutoregDirectandForecasterAutoregMultiVariate. -
Method
predict_bootstrapping()to all forecasters, generate multiple forecasting predictions using a bootstrapping process. -
Method
predict_dist()to all forecasters, fit a given probability distribution for each step using a bootstrapping process. -
Function
plot_prediction_distributionin moduleplot. -
Alias
backtesting_forecaster_multivariateforbacktesting_forecaster_multiseriesinmodel_selection_multiseriesmodule. -
Alias
grid_search_forecaster_multivariateforgrid_search_forecaster_multiseriesinmodel_selection_multiseriesmodule. -
Alias
random_search_forecaster_multivariateforrandom_search_forecaster_multiseriesinmodel_selection_multiseriesmodule. -
Attribute
forecaster_idto all Forecasters.
Changed
-
Deprecated
python 3.7compatibility. -
Added
python 3.11compatibility. -
model_selection_statsmodelsis deprecated in favor ofForecasterSarimaxandmodel_selection_sarimax. It will be removed in version 0.8.0. -
Remove
levels_weightsargument ingrid_search_forecaster_multiseriesandrandom_search_forecaster_multiseries, deprecated since version 0.6.0. Useseries_weightsandweights_funcwhen creating the forecaster instead. -
Attributes
create_predictorsandsource_code_create_predictorsrenamed tofun_predictorsandsource_code_fun_predictorsinForecasterAutoregCustom. Old names will be removed in version 0.8.0. -
Remove engine
'skopt'inbayesian_search_forecasterin favor of engine'optuna'. To continue using it, use skforecast 0.6.0. -
in_sample_residualsandout_sample_residualsare stored as numpy ndarrays instead of pandas series. -
In
ForecasterAutoregMultiSeries,set_out_sample_residuals()is now expecting adictfor theresidualsargument instead of apandas DataFrame. -
Remove the
scikit-optimizedependency.
Fixed
-
Remove operator
**inset_params()method for all forecasters. -
Replace
getfullargspecin favor ofinspect.signature(contribution by @jordisilv).
[0.6.0] - [2022-11-30]¶
Added
-
Class
ForecasterAutoregMultivariate. -
Function
initialize_lagsinutilsmodule to create lags values in the initialization of forecasters (applies to all forecasters). -
Function
initialize_weightsinutilsmodule to check and initialize argumentsseries_weightsandweight_func(applies to all forecasters). -
Argument
weights_funcin all Forecasters to allow weighted time series forecasting. Individual time based weights can be assigned to each value of the series during the model training. -
Argument
series_weightsinForecasterAutoregMultiSeriesto define individual weights each series. -
Include argument
random_statein all Forecastersset_out_sample_residualsmethods for random sampling with reproducible output. -
In
ForecasterAutoregMultiSeries,predictandpredict_intervalmethods allow the simultaneous prediction of multiple levels. -
backtesting_forecaster_multiseriesallows backtesting multiple levels simultaneously. -
metricargument can be a list ingrid_search_forecaster_multiseries,random_search_forecaster_multiseries. Ifmetricis alist, multiple metrics will be calculated. (suggested by Pablo Dávila Herrero https://github.com/Pablo-Davila) -
Function
multivariate_time_series_corrin moduleutils. -
Function
plot_multivariate_time_series_corrin moduleplot.
Changed
-
ForecasterAutoregDirectallows to predict specific steps. -
Remove
ForecasterAutoregMultiOutputin favor ofForecasterAutoregDirect, (deprecated since 0.5.0). -
Rename function
exog_to_multi_outputtoexog_to_directinutilsmodule. -
In
ForecasterAutoregMultiSeries, rename parameterseries_levelstoseries_col_names. -
In
ForecasterAutoregMultiSerieschange type ofout_sample_residualsto adictof numpy ndarrays. -
In
ForecasterAutoregMultiSeries, delete argumentlevelfrom methodset_out_sample_residuals. -
In
ForecasterAutoregMultiSeries,levelargument ofpredictandpredict_intervalrenamed tolevels. -
In
backtesting_forecaster_multiseries,levelargument ofpredictandpredict_intervalrenamed tolevels. -
In
check_predict_inputfunction, argumentlevelrenamed tolevelsandseries_levelsrenamed toseries_col_names. -
In
backtesting_forecaster_multiseries,metrics_levelsoutput is now a pandas DataFrame. -
In
grid_search_forecaster_multiseriesandrandom_search_forecaster_multiseries, argumentlevels_weightsis deprecated since version 0.6.0, and will be removed in version 0.7.0. Useseries_weightsandweights_funcwhen creating the forecaster instead. -
Refactor
_create_lags_inForecasterAutoreg,ForecasterAutoregDirectandForecasterAutoregMultiSeries. (suggested by Bennett https://github.com/Bennett561) -
Refactor
backtesting_forecasterandbacktesting_forecaster_multiseries. -
In
ForecasterAutoregDirect,filter_train_X_y_for_stepnow starts at 1 (before 0). -
In
ForecasterAutoregDirect, DataFramey_trainnow start with 1,y_step_1(beforey_step_0). -
Remove
cv_forecasterfrom modulemodel_selection.
Fixed
-
In
ForecasterAutoregMultiSeries, argumentlast_windowpredict method now works when it is a pandas DataFrame. -
In
ForecasterAutoregMultiSeries, fix bug transformers initialization.
[0.5.1] - [2022-10-05]¶
Added
-
Check that
exogandyhave the same length in_evaluate_grid_hyperparametersandbayesian_search_forecasterto avoid fit exception whenreturn_best. -
Check that
exogandserieshave the same length in_evaluate_grid_hyperparameters_multiseriesto avoid fit exception whenreturn_best.
Changed
- Argument
levels_listingrid_search_forecaster_multiseries,random_search_forecaster_multiseriesand_evaluate_grid_hyperparameters_multiseriesrenamed tolevels.
Fixed
-
ForecasterAutoregMultiOutputupdated to matchForecasterAutoregDirect. -
Fix Exception to raise when
level_weightsdoes not add up to a number close to 1.0 (before was exactly 1.0) ingrid_search_forecaster_multiseries,random_search_forecaster_multiseriesand_evaluate_grid_hyperparameters_multiseries. -
Create_train_X_yinForecasterAutoregMultiSeriesnow works when the forecaster is not fitted.
[0.5.0] - [2022-09-23]¶
Added
-
New arguments
transformer_y(transformer_seriesfor multiseries) andtransformer_exogin all forecaster classes. It is for transforming (scaling, max-min, ...) the modeled time series and exogenous variables inside the forecaster. -
Functions in utils
transform_seriesandtransform_dataframeto carry out the transformation of the modeled time series and exogenous variables. -
Functions
_backtesting_forecaster_verbose,random_search_forecaster,_evaluate_grid_hyperparameters,bayesian_search_forecaster,_bayesian_search_optunaand_bayesian_search_skoptin model_selection. -
Created
ForecasterAutoregMultiSeriesclass for modeling multiple time series simultaneously. -
Created module
model_selection_multiseries. Functions:_backtesting_forecaster_multiseries_refit,_backtesting_forecaster_multiseries_no_refit,backtesting_forecaster_multiseries,grid_search_forecaster_multiseries,random_search_forecaster_multiseriesand_evaluate_grid_hyperparameters_multiseries. -
Function
_check_intervalin utils. (suggested by Thomas Karaouzene https://github.com/tkaraouzene) -
metriccan be a list inbacktesting_forecaster,grid_search_forecaster,random_search_forecaster,backtesting_forecaster_multiseries. Ifmetricis alist, multiple metrics will be calculated. (suggested by Pablo Dávila Herrero https://github.com/Pablo-Davila) -
Skforecast works with python 3.10.
-
Functions
save_forecasterandload_forecasterto module utils. -
get_feature_importance()method checks if the forecast is fitted.
Changed
-
backtesting_forecasterchange default value of argumentfixed_train_size: bool=True. -
Remove argument
set_out_sample_residualsin functionbacktesting_forecaster(deprecated since 0.4.2). -
backtesting_forecasterverbose now includes fold size. -
grid_search_forecasterresults include the name of the used metric as column name. -
Remove
get_coefmethod fromForecasterAutoreg,ForecasterAutoregCustomandForecasterAutoregMultiOutput(deprecated since 0.4.3). -
_get_metricnow allowsmean_squared_log_error. -
ForecasterAutoregMultiOutputhas been renamed toForecasterAutoregDirect.ForecasterAutoregMultiOutputwill be removed in version 0.6.0. -
check_predict_inputupdated to checkForecasterAutoregMultiSeriesinputs. -
set_out_sample_residualshas a new argumenttransformto transform the residuals before being stored.
Fixed
-
fitnow storeslast_windowvalues with len = forecaster.max_lag in ForecasterAutoreg and ForecasterAutoregCustom. -
in_sample_residualsstored as apd.Serieswhenlen(residuals) > 1000.
[0.4.3] - [2022-03-18]¶
Added
-
Checks if all elements in lags are
intwhen creating ForecasterAutoreg and ForecasterAutoregMultiOutput. -
Add
fixed_train_size: bool=Falseargument tobacktesting_forecasterandbacktesting_sarimax
Changed
-
Rename
get_metricto_get_metric. -
Functions in model_selection module allow custom metrics.
-
Functions in model_selection_statsmodels module allow custom metrics.
-
Change function
set_out_sample_residuals(ForecasterAutoreg and ForecasterAutoregCustom),residualsargument must be apandas Series(wasnumpy ndarray). -
Returned value of backtesting functions (model_selection and model_selection_statsmodels) is now a
float(wasnumpy ndarray). -
get_coefandget_feature_importancemethods unified inget_feature_importance.
Fixed
-
Requirements versions.
-
Method
fitdoesn't removeout_sample_residualseach time the forecaster is fitted. -
Added random seed to residuals downsampling (ForecasterAutoreg and ForecasterAutoregCustom)
[0.4.2] - [2022-01-08]¶
Added
-
Increased verbosity of function
backtesting_forecaster(). -
Random state argument in
backtesting_forecaster().
Changed
-
Function
backtesting_forecaster()do not modify the original forecaster. -
Deprecated argument
set_out_sample_residualsin functionbacktesting_forecaster(). -
Function
model_selection.time_series_spliterrenamed tomodel_selection.time_series_splitter
Fixed
- Methods
get_coefandget_feature_importanceofForecasterAutoregMultiOutputclass return proper feature names.
[0.4.1] - [2021-12-13]¶
Added
Changed
Fixed
fitandpredicttransform pandas series and dataframes to numpy arrays if regressor is XGBoost.
[0.4.0] - [2021-12-10]¶
Version 0.4 has undergone a huge code refactoring. Main changes are related to input-output formats (only pandas series and dataframes are allowed although internally numpy arrays are used for performance) and model validation methods (unified into backtesting with and without refit).
Added
ForecasterBaseas parent class
Changed
-
Argument
ymust be pandas Series. Numpy ndarrays are not allowed anymore. -
Argument
exogmust be pandas Series or pandas DataFrame. Numpy ndarrays are not allowed anymore. -
Output of
predictis a pandas Series with index according to the steps predicted. -
Scikitlearn pipelines are allowed as regressors.
-
backtesting_forecasterandbacktesting_forecaster_intervalshave been combined in a single function.- It is possible to backtest forecasters already trained.
ForecasterAutoregMultiOutputallows incomplete folds.- It is possible to update
out_sample_residualswith backtesting residuals.
-
cv_forecasterhas the option to updateout_sample_residualswith backtesting residuals. -
backtesting_sarimax_statsmodelsandcv_sarimax_statsmodelshave been combined in a single function. -
gridsearch_forecasteruse backtesting as validation strategy with the option of refit. -
Extended information when printing
Forecasterobject. -
All static methods for checking and preprocessing inputs moved to module utils.
-
Remove deprecated class
ForecasterCustom.
Fixed
[0.3.0] - [2021-09-01]¶
Added
-
New module model_selection_statsmodels to cross-validate, backtesting and grid search AutoReg and SARIMAX models from statsmodels library:
backtesting_autoreg_statsmodelscv_autoreg_statsmodelsbacktesting_sarimax_statsmodelscv_sarimax_statsmodelsgrid_search_sarimax_statsmodels
-
Added attribute window_size to
ForecasterAutoregandForecasterAutoregCustom. It is equal tomax_lag.
Changed
cv_forecasterreturns cross-validation metrics and cross-validation predictions.- Added an extra column for each parameter in the dataframe returned by
grid_search_forecaster. - statsmodels 0.12.2 added to requirements
Fixed
[0.2.0] - [2021-08-26]¶
Added
-
Multiple exogenous variables can be passed as pandas DataFrame.
-
Documentation at https://joaquinamatrodrigo.github.io/skforecast/
-
New unit test
-
Increased typing
Changed
- New implementation of
ForecasterAutoregMultiOutput. The training process in the new version creates a different X_train for each step. See Direct multi-step forecasting for more details. Old versión can be acces withskforecast.deprecated.ForecasterAutoregMultiOutput.
Fixed
[0.1.9] - [2021-07-27]¶
Added
-
Logging total number of models to fit in
grid_search_forecaster. -
Class
ForecasterAutoregCustom. -
Method
create_train_X_yto facilitate access to the training data matrix created fromyandexog.
Changed
-
New implementation of
ForecasterAutoregMultiOutput. The training process in the new version creates a different X_train for each step. See Direct multi-step forecasting for more details. Old versión can be acces withskforecast.deprecated.ForecasterAutoregMultiOutput. -
Class
ForecasterCustomhas been renamed toForecasterAutoregCustom. However,ForecasterCustomwill still remain to keep backward compatibility. -
Argument
metricincv_forecaster,backtesting_forecaster,grid_search_forecasterandbacktesting_forecaster_intervalschanged from 'neg_mean_squared_error', 'neg_mean_absolute_error', 'neg_mean_absolute_percentage_error' to 'mean_squared_error', 'mean_absolute_error', 'mean_absolute_percentage_error'. -
Check if argument
metricincv_forecaster,backtesting_forecaster,grid_search_forecasterandbacktesting_forecaster_intervalsis one of 'mean_squared_error', 'mean_absolute_error', 'mean_absolute_percentage_error'. -
time_series_spliterdoesn't include the remaining observations in the last complete fold but in a new one whenallow_incomplete_fold=True. Take in consideration that incomplete folds with few observations could overestimate or underestimate the validation metric.
Fixed
- Update lags of
ForecasterAutoregMultiOutputaftergrid_search_forecaster.
[0.1.8.1] - [2021-05-17]¶
Added
set_out_sample_residualsmethod to store or update out of sample residuals used bypredict_interval.
Changed
-
backtesting_forecaster_intervalsandbacktesting_forecasterprint number of steps per fold. -
Only stored up to 1000 residuals.
-
Improved verbose in
backtesting_forecaster_intervals.
Fixed
-
Warning of inclompleted folds when using
backtesting_forecastwith aForecasterAutoregMultiOutput. -
ForecasterAutoregMultiOutput.predictallow exog data longer than needed (steps). -
backtesting_forecastprints correctly the number of folds when remainder observations are cero. -
Removed named argument X in
self.regressor.predict(X)to allow using XGBoost regressor. -
Values stored in
self.last_windowwhen trainingForecasterAutoregMultiOutput.
[0.1.8] - [2021-04-02]¶
Added
- Class
ForecasterAutoregMultiOutput.py: forecaster with direct multi-step predictions. - Method
ForecasterCustom.predict_intervalandForecasterAutoreg.predict_interval: estimate prediction interval using bootstrapping. skforecast.model_selection.backtesting_forecaster_intervalsperform backtesting and return prediction intervals.
Changed
Fixed
[0.1.7] - [2021-03-19]¶
Added
- Class
ForecasterCustom: same functionalities asForecasterAutoregbut allows custom definition of predictors.
Changed
grid_search forecasteradapted to work with objectsForecasterCustomin addition toForecasterAutoreg.
Fixed
[0.1.6] - [2021-03-14]¶
Added
- Method
get_feature_importancestoskforecast.ForecasterAutoreg. - Added backtesting strategy in
grid_search_forecaster. - Added
backtesting_forecasttoskforecast.model_selection.
Changed
- Method
create_lagsreturn a matrix where the order of columns match the ascending order of lags. For example, column 0 contains the values of the minimum lag used as predictor. - Renamed argument
Xtolast_windowin methodpredict. - Renamed
ts_cv_forecastertocv_forecaster.
Fixed
[0.1.4] - [2021-02-15]¶
Added
- Method
get_coeftoskforecast.ForecasterAutoreg.
Changed
Fixed