Changelog¶
All significant changes to this project are documented in this release file.
Legend | |
---|---|
Feature | New feature |
Enhancement | Improvement in existing functionality |
API Change | Changes in the API |
Fix | Bug fix |
0.14.0 Nov 11, 2024¶
The main changes in this release are:
This release has undergone a major refactoring to improve the performance of the library. Visit the migration guide section for more information.
-
Feature Window features can be added to the training matrix using the
window_features
argument in all forecasters. You can use theRollingFeatures
class to create these features or create your own object. Create window and custom features. -
Feature
model_selection
functions now have a new argumentcv
. This argument expect an object of typeTimeSeriesFold
(backtesting) orOneStepAheadFold
which allows to define the validation strategy using the argumentsinitial_train_size
,steps
,gap
,refit
,fixed_train_size
,skip_folds
andallow_incomplete_folds
. -
Feature Hyperparameter search now allows to follow a one-step-ahead validation strategy using a
OneStepAheadFold
ascv
argument in themodel_selection
functions. -
Enhancement Refactor the prediction process in
ForecasterRecursiveMultiSeries
to improve performance when predicting multiple series. -
Enhancement The bootstrapping process in the
predict_bootstrapping
method of all forecasters has been optimized to improve performance. This may result in slightly different results when using the same seed as in previous versions. -
Enhancement Exogenous variables can be added to the training matrix if they do not contain the first window size observations. This is useful when exogenous variables are not available in early historical data. Visit the exogenous variables section for more information.
-
API Change Package structure has been changed to improve code organization. The forecasters have been grouped into the
recursive
,direct
amddeep_learning
modules. Visit the migration guide section for more information. -
API Change
ForecasterAutoregCustom
has been deprecated. Window features can be added using thewindow_features
argument in theForecasterRecursive
. -
API Change Refactor the
set_out_sample_residuals
method in all forecasters, it now expectsy_true
andy_pred
as arguments instead ofresiduals
. This method is used to store the residuals of the out-of-sample predictions. -
API Change The
pmdarima.ARIMA
regressor is no longer supported by theForecasterSarimax
. You can use the skforecastSarimax
model or, to continue using it, use skforecast 0.13.0 or lower. -
Fix Fixed a bug where the
create_predict_X
method in recursive Forecasters did not correctly generate the matrix correctly when using transformations and/or differentiations
Added
-
Added
numba>=0.59
as hard dependency. -
Added
window_features
argument to all forecasters. This argument allows the user to add window features to the training matrix. SeeRollingFeatures
. -
Hyperparameter search now allows to follow a one-step-ahead validation strategy using a
OneStepAheadFold
ascv
argument in themodel_selection
functions. -
Differentiation has been extended to all forecasters. The
differentiation
argument has been added to all forecasters to model the n-order differentiated time series. -
Create
transform_numpy
function in theutils
module to carry out the transformation of the modeled time series and exogenous variables as numpy arrays. -
random_state
argument in thefit
method ofForecasterRecursive
to set a seed for the random generator so that the stored sample residuals are always deterministic. -
New private method
_train_test_split_one_step_ahead
in all forecasters. -
New private function
_calculate_metrics_one_step_ahead
tomodel_selection
module to calculate the metrics when predicting one step ahead. -
The
steps
argument in the predict method of theForecasterRecursive
can now be a str or a pandas datetime. If so, the method will predict up to the specified date. (contribution by @imMoya #811). -
Exogenous variables can be added to the training matrix if they do not contain the first window size observations. This is useful when exogenous variables are not available in early historical data.
-
Added support for different activation functions in the
create_and_compile_model
function. (contribution by @pablorodriper #824).
Changed
-
ForecasterAutoregCustom
has been deprecated. Window features can be added using thewindow_features
argument in theForecasterRecursive
. -
Refactor
recursive_predict
inForecasterRecursiveMultiSeries
to predict all series at once and include option of adding residuals. This improves performance when predicting multiple series. -
Refactor
predict_bootstrapping
in all Forecasters. The bootstrapping process has been optimized to improve performance. This may result in slightly different results when using the same seed as in previous versions. -
Change the default value of
encoding
toordinal
inForecasterRecursiveMultiSeries
. This will avoid conflicts if the regressor does not support categorical variables by default. -
Removed argument
engine
frombayesian_search_forecaster
andbayesian_search_forecaster_multiseries
. -
The
pmdarima.ARIMA
regressor is no longer supported by theForecasterSarimax
. You can use the skforecastSarimax
model or, to continue using it, use skforecast 0.13.0 or lower. -
initialize_lags
inutils
now returns the maximum lag,max_lag
. -
Removed attribute
window_size_diff
from all Forecasters. The window size extended by the order of differentiation is now calculated onwindow_size
. -
lags
can beNone
when initializing any Forecaster that includes window features. -
model_selection
module has been divided internally into different modules to improve code organization (_validation
,_search
,_split
). -
Functions from
model_selection_multiseries
andmodel_selection_sarimax
modules have been moved to themodel_selection
module. -
model_selection
functions now have a new argumentcv
. This argument expect an object of typeTimeSeriesFold
orOneStepAheadFold
which allows to define the validation strategy using the argumentsinitial_train_size
,steps
,gap
,refit
,fixed_train_size
,skip_folds
andallow_incomplete_folds
. -
Added
feature_selection
module. The functionsselect_features
andselect_features_multiseries
have been moved to this module. -
The functions
select_features
andselect_features_multiseries
now have 3 returns:selected_lags
,selected_window_features
andselected_exog
. -
Refactor the
set_out_sample_residuals
method in all forecasters, it now expectsy_true
andy_pred
as arguments instead ofresiduals
. -
exog_to_direct
andexog_to_direct_numpy
inutils
now returns a the names of the columns of the transformed exogenous variables. -
Renamed attributes in all Forecasters:
-
encoding_mapping
has been renamed toencoding_mapping_
. -
last_window
has been renamed tolast_window_
. -
index_type
has been renamed toindex_type_
. -
index_freq
has been renamed toindex_freq_
. -
training_range
has been renamed totraining_range_
. -
series_col_names
has been renamed toseries_names_in_
. -
included_exog
has been renamed toexog_in_
. -
exog_type
has been renamed toexog_type_in_
. -
exog_dtypes
has been renamed toexog_dtypes_in_
. -
exog_col_names
has been renamed toexog_names_in_
. -
series_X_train
has been renamed toX_train_series_names_in_
. -
X_train_col_names
has been renamed toX_train_features_names_out_
. -
binner_intervals
has been renamed tobinner_intervals_
. -
in_sample_residuals
has been renamed toin_sample_residuals_
. -
out_sample_residuals
has been renamed toout_sample_residuals_
. -
fitted
has been renamed tois_fitted
.
-
-
Renamed arguments in different functions and methods:
-
in_sample_residuals
has been renamed touse_in_sample_residuals
. -
binned_residuals
has been renamed touse_binned_residuals
. -
series_col_names
has been renamed toseries_names_in_
in thecheck_predict_input
,check_preprocess_exog_multiseries
andinitialize_transformer_series
functions in theutils
module. -
series_X_train
has been renamed toX_train_series_names_in_
in theprepare_levels_multiseries
function in theutils
module. -
exog_col_names
has been renamed toexog_names_in_
in thecheck_predict_input
andcheck_preprocess_exog_multiseries
functions in theutils
module. -
index_type
has been renamed toindex_type_
in thecheck_predict_input
function in theutils
module. -
index_freq
has been renamed toindex_freq_
in thecheck_predict_input
function in theutils
module. -
included_exog
has been renamed toexog_in_
in thecheck_predict_input
function in theutils
module. -
exog_type
has been renamed toexog_type_in_
in thecheck_predict_input
function in theutils
module. -
exog_dtypes
has been renamed toexog_dtypes_in_
in thecheck_predict_input
function in theutils
module. -
fitted
has been renamed tois_fitted
in thecheck_predict_input
function in theutils
module. -
use_in_sample
has been renamed touse_in_sample_residuals
in theprepare_residuals_multiseries
function in theutils
module. -
in_sample_residuals
has been renamed touse_in_sample_residuals
in thebacktesting_forecaster
,backtesting_forecaster_multiseries
andcheck_backtesting_input
(utils
module) functions.
-
-
binned_residuals
has been renamed touse_binned_residuals
in thebacktesting_forecaster
function.-
in_sample_residuals
has been renamed toin_sample_residuals_
in theprepare_residuals_multiseries
function in theutils
module. -
out_sample_residuals
has been renamed toout_sample_residuals_
in theprepare_residuals_multiseries
function in theutils
module. -
last_window
has been renamed tolast_window_
in thepreprocess_levels_self_last_window_multiseries
function in theutils
module.
-
Fixed
- Fixed a bug where the
create_predict_X
method in recursive Forecasters did not correctly generate the matrix correctly when using transformations and/or differentiations.
0.13.0 Aug 01, 2024¶
The main changes in this release are:
-
Feature Global Forecasters
ForecasterAutoregMultiSeries
andForecasterAutoregMultiSeriesCustom
are able to predict series not seen during training. This is useful when the user wants to predict a new series that was not included in the training data. -
Feature
encoding
can be set toNone
in Global ForecastersForecasterAutoregMultiSeries
andForecasterAutoregMultiSeriesCustom
. This option does not add the encoded series ids to the regressor training matrix. -
Feature New
create_predict_X
method in all recursive and direct Forecasters to allow the user to inspect the matrix passed to the predict method of the regressor. -
Feature New module
metrics
with functions to calculate metrics for time series forecasting such asmean_absolute_scaled_error
androot_mean_squared_scaled_error
. Visit Time Series Forecasting Metrics for more information. -
Feature New argument
add_aggregated_metric
inbacktesting_forecaster_multiseries
to include, in addition to the metrics for each level, the aggregated metric of all levels using the average (arithmetic mean), weighted average (weighted by the number of predicted values of each level) or pooling (the values of all levels are pooled and then the metric is calculated). -
Feature New argument
skip_folds
inmodel_selection
andmodel_selection_multiseries
functions. It allows the user to skip some folds during backtesting, which can be useful to speed up the backtesting process and thus the hyperparameter search. -
API Change backtesting procedures now pass the training series to the metric functions so it can be used to calculate metrics that depend on the training series.
-
API Change Changed the default value of the
transformer_series
argument toNone
in the Global ForecastersForecasterAutoregMultiSeries
andForecasterAutoregMultiSeriesCustom
. In most cases, tree-based models are used as regressors in these forecasters, so no transformation is applied by default as it is not necessary.
Added
-
Support for
python 3.12
. -
keras
has been added as an optional dependency, tag deeplearning, to use theForecasterRnn
. -
PyTorch
backend for theForecasterRnn
. -
New
create_predict_X
method in all recursive and direct Forecasters to allow the user to inspect the matrix passed to the predict method of the regressor. -
New
_create_predict_inputs
method in all Forecasters to unify the inputs of the predict methods. -
New plot function
plot_prediction_intervals
in theplot
module to plot predicted intervals. -
New module
metrics
with functions to calculate metrics for time series forecasting such asmean_absolute_scaled_error
androot_mean_squared_scaled_error
. -
New argument
skip_folds
inmodel_selection
andmodel_selection_multiseries
functions. It allows the user to skip some folds during backtesting, which can be useful to speed up the backtesting process and thus the hyperparameter search. -
New function
plot_prediction_intervals
in moduleplot
. -
Global Forecasters
ForecasterAutoregMultiSeries
andForecasterAutoregMultiSeriesCustom
are able to predict series not seen during training. This is useful when the user wants to predict a new series that was not included in the training data. -
encoding
can be set toNone
in Global ForecastersForecasterAutoregMultiSeries
andForecasterAutoregMultiSeriesCustom
. This option does not add the encoded series ids to the regressor training matrix. -
New argument
add_aggregated_metric
inbacktesting_forecaster_multiseries
to include, in addition to the metrics for each level, the aggregated metric of all levels using the average (arithmetic mean), weighted average (weighted by the number of predicted values of each level) or pooling (the values of all levels are pooled and then the metric is calculated). -
New argument
aggregate_metric
ingrid_search_forecaster_multiseries
,random_search_forecaster_multiseries
andbayesian_search_forecaster_multiseries
to select the aggregation method used to combine the metric(s) of all levels during the hyperparameter search. The available methods are: mean (arithmetic mean), weighted (weighted by the number of predicted values of each level) and pool (the values of all levels are pooled and then the metric is calculated). If more than one metric and/or aggregation method is used, all are reported in the results, but the first of each is used to select the best model. -
New class
DateTimeFeatureTransformer
and functioncreate_datetime_features
in thepreprocessing
module to create datetime and calendar features from a datetime index.
Changed
-
Deprecated
python 3.8
compatibility. -
Update project dependencies.
-
Change default value of
n_bins
when initializingForecasterAutoreg
from 15 to 10. -
Refactor
_recursive_predict
in all recursive forecasters. -
Change default value of
transformer_series
when initializingForecasterAutoregMultiSeries
andForecasterAutoregMultiSeriesCustom
fromStandardScaler()
toNone
. -
Function
_get_metric
moved frommodel_selection
tometrics
. -
Change information message when
verbose
isTrue
inbacktesting_forecaster
andbacktesting_forecaster_multiseries
. -
select_n_jobs_backtesting
andselect_n_jobs_fit
inutils
returnn_jobs = 1
if regressor isLGBMRegressor
. This is becauselightgbm
is highly optimized for gradient boosting and parallelizes operations at a very fine-grained level, making additional parallelization unnecessary and potentially harmful due to resource contention. -
metric_values
returned bybacktesting_forecaster
andbacktesting_sarimax
is apandas DataFrame
with one column per metric instead of alist
.
Fixed
- Bug fix in
backtesting_forecaster_multiseries
using aForecasterAutoregMultiSeries
orForecasterAutoregMultiSeriesCustom
that includes differentiation.
0.12.1 May 20, 2024¶
Fix This is a minor release to fix a bug.
Added
Changed
Fixed
- Bug fix when storing
last_window
using a [ForecasterAutoregMultiSeries
] that includes differentiation.
0.12.0 May 05, 2024¶
The main changes in this release are:
-
Feature Multiseries forecaster (Global Models) can be trained using series of different lengths and with different exogenous variables per series.
-
Feature New functionality to select features using scikit-learn selectors (
select_features
andselect_features_multiseries
). -
Feature Added new forecaster
ForecasterRnn
to create forecasting models based on deep learning (RNN and LSTM). -
Feature New method to predict intervals conditioned on the range of the predicted values. This is can help to improve the interval coverage when the residuals are not homoscedastic (
ForecasterAutoreg
). -
Enhancement Bayesian hyperparameter search is now available for all multiseries forecasters using
optuna
as the search engine. -
Enhancement All Recursive Forecasters are now able to differentiate the time series before modeling it.
-
API Change Changed the default value of the
transformer_series
argument to use aStandardScaler()
in the Global Forecasters (ForecasterAutoregMultiSeries
,ForecasterAutoregMultiSeriesCustom
andForecasterAutoregMultiVariate
).
Added
-
Added
bayesian_search_forecaster_multiseries
function tomodel_selection_multiseries
module. This function performs a Bayesian hyperparameter search for theForecasterAutoregMultiSeries
,ForecasterAutoregMultiSeriesCustom
, andForecasterAutoregMultiVariate
usingoptuna
as the search engine. -
ForecasterAutoregMultiVariate
allows to include None when lags is a dict so that a series does not participate in the construction of X_train. -
The
output_file
argument has been added to the hyperparameter search functions in themodel_selection
,model_selection_multiseries
andmodel_selection_sarimax
modules to save the results of the hyperparameter search in a tab-separated values (TSV) file. -
New argument
binned_residuals
in methodpredict_interval
allows to condition the bootstraped residuals on range of the predicted values. -
Added
save_custom_functions
argument to thesave_forecaster
function in theutils
module. IfTrue
, save custom functions used in the forecaster (fun_predictors
andweight_func
) as .py files. Custom functions must be available in the environment where the forecaster is loaded. -
Added
select_features
andselect_features_multiseries
functions to themodel_selection
andmodel_selection_multiseries
modules to perform feature selection using scikit-learn selectors. -
Added
sort_importance
argument toget_feature_importances
method in all Forecasters. IfTrue
, sort the feature importances in descending order. -
Added
initialize_lags_grid
function tomodel_selection
module. This function initializes the lags to be used in the hyperparameter search functions inmodel_selection
andmodel_selection_multiseries
. -
Added
_initialize_levels_model_selection_multiseries
function tomodel_selection_multiseries
module. This function initializes the levels of the series to be used in the model selection functions. -
Added
set_dark_theme
function to theplot
module to set a dark theme for matplotlib plots. -
Allow tuple type for
lags
argument in all Forecasters. -
Argument
differentiation
in all Forecasters to model the n-order differentiated time series. -
Added
window_size_diff
attribute to all Forecasters. It stores the size of the window (window_size
) extended by the order of differentiation. Added to all Forecasters for API consistency. -
Added
store_last_window
parameter tofit
method in Forecasters. IfTrue
, store the last window of the training data. -
Added
utils.set_skforecast_warnings
function to set the warnings of the skforecast package. -
Added new forecaster
ForecasterRnn
to create forecasting models based on deep learning (RNN and LSTM). -
Added new function
create_and_compile_model
to moduleskforecast.ForecasterRnn.utils
to help to create and compile a RNN or LSTM models to be used inForecasterRnn
.
Changed
-
Deprecated argument
lags_grid
inbayesian_search_forecaster
. Usesearch_space
to define the candidate values for the lags. This allows the lags to be optimized along with the other hyperparameters of the regressor in the bayesian search. -
n_boot
argument inpredict_interval
changed from 500 to 250. -
Changed the default value of the
transformer_series
argument to use aStandardScaler()
in the Global Forecasters (ForecasterAutoregMultiSeries
,ForecasterAutoregMultiSeriesCustom
andForecasterAutoregMultiVariate
). -
Refactor
utils.select_n_jobs_backtesting
to use the forecaster directly instead offorecaster_name
andregressor_name
. -
Remove
_backtesting_forecaster_verbose
in model_selection in favor of_create_backtesting_folds
, (deprecated since 0.8.0).
Fixed
- Small bug in
utils.select_n_jobs_backtesting
, renameForecasterAutoregMultiseries
toForecasterAutoregMultiSeries
.
0.11.0 Nov 16, 2023¶
The main changes in this release are:
-
New
predict_quantiles
method in all Autoreg Forecasters to calculate the specified quantiles for each step. -
Create
ForecasterBaseline.ForecasterEquivalentDate
, a Forecaster to create simple model that serves as a basic reference for evaluating the performance of more complex models.
Added
-
Added
skforecast.datasets
module. It contains functions to load data for our examples and user guides. -
Added
predict_quantiles
method to all Autoreg Forecasters. -
Added
SkforecastVersionWarning
to theexception
module. This warning notify that the skforecast version installed in the environment differs from the version used to initialize the forecaster when usingload_forecaster
. -
Create
ForecasterBaseline.ForecasterEquivalentDate
, a Forecaster to create simple model that serves as a basic reference for evaluating the performance of more complex models.
Changed
- Enhance the management of internal copying in skforecast to minimize the number of copies, thereby accelerating data processing.
Fixed
-
Rename
self.skforcast_version
attribute toself.skforecast_version
in all Forecasters. -
Fixed a bug where the
create_train_X_y
method did not correctly align lags and exogenous variables when the index was not a Pandas index in all Forecasters.
0.10.1 Sep 26, 2023¶
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_forecaster
orbayesian_search_forecaster
with a Forecaster that includes differentiation.
0.10.0 Sep 07, 2023¶
The main changes in this release are:
-
New
Sarimax.Sarimax
model. A wrapper ofstatsmodels.SARIMAX
that follows the scikit-learn API and can be used with theForecasterSarimax
. -
Added
differentiation
argument toForecasterAutoreg
andForecasterAutoregCustom
to model the n-order differentiated time series using the new skforecast preprocessorTimeSeriesDifferentiator
.
Added
-
New
Sarimax.Sarimax
model. A wrapper ofstatsmodels.SARIMAX
that follows the scikit-learn API. -
Added
skforecast.preprocessing.TimeSeriesDifferentiator
to preprocess time series by differentiating or integrating them (reverse differentiation). -
Added
differentiation
argument toForecasterAutoreg
andForecasterAutoregCustom
to model the n-order differentiated time series.
Changed
-
Refactor
ForecasterSarimax
to work with both skforecast Sarimax and pmdarima ARIMA models. -
Replace
setup.py
withpyproject.toml
.
Fixed
0.9.1 Jul 14, 2023¶
The main changes in this release are:
- Fix imports in
skforecast.utils
module to correctly importsklearn.linear_model
into theselect_n_jobs_backtesting
andselect_n_jobs_fit_forecaster
functions.
Added
Changed
Fixed
- Fix imports in
skforecast.utils
module to correctly importsklearn.linear_model
into theselect_n_jobs_backtesting
andselect_n_jobs_fit_forecaster
functions.
0.9.0 Jul 09, 2023¶
The main changes in this release are:
-
ForecasterAutoregDirect
andForecasterAutoregMultiVariate
include then_jobs
argument in theirfit
method, allowing multi-process parallelization for improved performance. -
All backtesting and grid search functions have been extended to include the
n_jobs
argument, allowing multi-process parallelization for improved performance. -
Argument
refit
now can be also aninteger
in 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. -
ForecasterAutoregMultiSeries
andForecasterAutoregMultiSeriesCustom
can 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'
tofit
method inForecasterAutoregDirect
andForecasterAutoregMultiVariate
to allow multi-process parallelization. -
Argument
n_jobs='auto'
to all backtesting dependent functions in modulesmodel_selection
,model_selection_multiseries
andmodel_selection_sarimax
to allow multi-process parallelization. -
Argument
refit
now can be also aninteger
in 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. -
ForecasterAutoregMultiSeries
andForecasterAutoregMultiSeriesCustom
allow to use series of different lengths for training. -
Added
show_progress
to grid search functions. -
Added functions
select_n_jobs_backtesting
andselect_n_jobs_fit_forecaster
toutils
to select the number of jobs to use during multi-process parallelization.
Changed
-
Remove
get_feature_importance
in favor ofget_feature_importances
in all Forecasters, (deprecated since 0.8.0). -
The
model_selection._create_backtesting_folds
function now also returns the last window indices and whether or not to train the forecaster. -
The
model_selection
functions_backtesting_forecaster_refit
and_backtesting_forecaster_no_refit
have been unified in_backtesting_forecaster
. -
The
model_selection_multiseries
functions_backtesting_forecaster_multiseries_refit
and_backtesting_forecaster_multiseries_no_refit
have been unified in_backtesting_forecaster_multiseries
. -
The
model_selection_sarimax
functions_backtesting_refit_sarimax
and_backtesting_no_refit_sarimax
have been unified in_backtesting_sarimax
. -
utils.preprocess_y
allows a pandas DataFrame as input.
Fixed
-
Ensure reproducibility of Direct Forecasters when using
predict_bootstrapping
,predict_dist
andpredict_interval
with alist
of steps. -
The
create_train_X_y
method returns a dict of pandas Series asy_train
inForecasterAutoregDirect
andForecasterAutoregMultiVariate
. This ensures that each series has the appropriate index according to the step to be trained. -
The
filter_train_X_y_for_step
method inForecasterAutoregDirect
andForecasterAutoregMultiVariate
now updates the index ofX_train_step
to ensure correct alignment withy_train_step
.
0.8.1 May 27, 2023¶
Added
- Argument
store_in_sample_residuals=True
infit
method added to all forecasters to speed up functions such as backtesting.
Changed
- Refactor
utils.exog_to_direct
andutils.exog_to_direct_numpy
to increase performance.
Fixed
utils.check_exog_dtypes
now compares thedtype.name
instead of thedtype
. (suggested by Metaming https://github.com/Metaming)
0.8.0 May 16, 2023¶
Added
-
Added the
fit_kwargs
argument to all forecasters to allow the inclusion of additional keyword arguments passed to the regressor'sfit
method. -
Added the
set_fit_kwargs
method to set thefit_kwargs
attribute. -
Support for
pandas 2.0.x
. -
Added
exceptions
module with custom warnings. -
Added function
utils.check_exog_dtypes
to issue a warning if exogenous variables are one of typeinit
,float
, orcategory
. Raise Exception ifexog
has categorical columns with non integer values. -
Added function
utils.get_exog_dtypes
to get the data types of the exogenous variables included during the training of the forecaster model. -
Added function
utils.cast_exog_dtypes
to cast data types of the exogenous variables using a dictionary as a mapping. -
Added function
utils.check_select_fit_kwargs
to check if the argumentfit_kwargs
is a dictionary and select only the keys used by thefit
method of the regressor. -
Added function
model_selection._create_backtesting_folds
to provide train/test indices (position) for backtesting functions. -
Added argument
gap
to functions inmodel_selection
,model_selection_multiseries
andmodel_selection_sarimax
to omit observations between training and prediction. -
Added argument
show_progress
to functionsmodel_selection.backtesting_forecaster
,model_selection_multiseries.backtesting_forecaster_multiseries
andmodel_selection_sarimax.backtesting_forecaster_sarimax
to indicate weather to show a progress bar. -
Added argument
remove_suffix
, defaultFalse
, to the methodfilter_train_X_y_for_step()
inForecasterAutoregDirect
andForecasterAutoregMultiVariate
. Ifremove_suffix=True
the suffix "_step_i" will be removed from the column names of the training matrices.
Changed
-
Rename optional dependency package
statsmodels
tosarimax
. Now onlypmdarima
will be installed,statsmodels
is 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_statsmodels
in favor ofForecasterSarimax
andmodel_selection_sarimax
, (deprecated since 0.7.0). -
Remove attributes
create_predictors
andsource_code_create_predictors
in favor offun_predictors
andsource_code_fun_predictors
inForecasterAutoregCustom
, (deprecated since 0.7.0). -
The
utils.check_exog
function now includes a new optional parameter,allow_nan
, that controls whether a warning should be issued if the inputexog
contains NaN values. -
utils.check_exog
is applied before and afterexog
transformations. -
The
utils.preprocess_y
function 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_exog
function 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.tqdm
bytqdm.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_y
method in all the Forecasters.
0.7.0 Mar 21, 2023¶
Added
-
Class
ForecasterAutoregMultiSeriesCustom
. -
Class
ForecasterSarimax
andmodel_selection_sarimax
(wrapper of pmdarima). -
Method
predict_interval()
toForecasterAutoregDirect
andForecasterAutoregMultiVariate
. -
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_distribution
in moduleplot
. -
Alias
backtesting_forecaster_multivariate
forbacktesting_forecaster_multiseries
inmodel_selection_multiseries
module. -
Alias
grid_search_forecaster_multivariate
forgrid_search_forecaster_multiseries
inmodel_selection_multiseries
module. -
Alias
random_search_forecaster_multivariate
forrandom_search_forecaster_multiseries
inmodel_selection_multiseries
module. -
Attribute
forecaster_id
to all Forecasters.
Changed
-
Deprecated
python 3.7
compatibility. -
Added
python 3.11
compatibility. -
model_selection_statsmodels
is deprecated in favor ofForecasterSarimax
andmodel_selection_sarimax
. It will be removed in version 0.8.0. -
Remove
levels_weights
argument ingrid_search_forecaster_multiseries
andrandom_search_forecaster_multiseries
, deprecated since version 0.6.0. Useseries_weights
andweights_func
when creating the forecaster instead. -
Attributes
create_predictors
andsource_code_create_predictors
renamed tofun_predictors
andsource_code_fun_predictors
inForecasterAutoregCustom
. Old names will be removed in version 0.8.0. -
Remove engine
'skopt'
inbayesian_search_forecaster
in favor of engine'optuna'
. To continue using it, use skforecast 0.6.0. -
in_sample_residuals
andout_sample_residuals
are stored as numpy ndarrays instead of pandas series. -
In
ForecasterAutoregMultiSeries
,set_out_sample_residuals()
is now expecting adict
for theresiduals
argument instead of apandas DataFrame
. -
Remove the
scikit-optimize
dependency.
Fixed
-
Remove operator
**
inset_params()
method for all forecasters. -
Replace
getfullargspec
in favor ofinspect.signature
(contribution by @jordisilv).
0.6.0 Nov 30, 2022¶
Added
-
Class
ForecasterAutoregMultivariate
. -
Function
initialize_lags
inutils
module to create lags values in the initialization of forecasters (applies to all forecasters). -
Function
initialize_weights
inutils
module to check and initialize argumentsseries_weights
andweight_func
(applies to all forecasters). -
Argument
weights_func
in 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_weights
inForecasterAutoregMultiSeries
to define individual weights each series. -
Include argument
random_state
in all Forecastersset_out_sample_residuals
methods for random sampling with reproducible output. -
In
ForecasterAutoregMultiSeries
,predict
andpredict_interval
methods allow the simultaneous prediction of multiple levels. -
backtesting_forecaster_multiseries
allows backtesting multiple levels simultaneously. -
metric
argument can be a list ingrid_search_forecaster_multiseries
,random_search_forecaster_multiseries
. Ifmetric
is alist
, multiple metrics will be calculated. (suggested by Pablo Dávila Herrero https://github.com/Pablo-Davila) -
Function
multivariate_time_series_corr
in moduleutils
. -
Function
plot_multivariate_time_series_corr
in moduleplot
.
Changed
-
ForecasterAutoregDirect
allows to predict specific steps. -
Remove
ForecasterAutoregMultiOutput
in favor ofForecasterAutoregDirect
, (deprecated since 0.5.0). -
Rename function
exog_to_multi_output
toexog_to_direct
inutils
module. -
In
ForecasterAutoregMultiSeries
, rename parameterseries_levels
toseries_col_names
. -
In
ForecasterAutoregMultiSeries
change type ofout_sample_residuals
to adict
of numpy ndarrays. -
In
ForecasterAutoregMultiSeries
, delete argumentlevel
from methodset_out_sample_residuals
. -
In
ForecasterAutoregMultiSeries
,level
argument ofpredict
andpredict_interval
renamed tolevels
. -
In
backtesting_forecaster_multiseries
,level
argument ofpredict
andpredict_interval
renamed tolevels
. -
In
check_predict_input
function, argumentlevel
renamed tolevels
andseries_levels
renamed toseries_col_names
. -
In
backtesting_forecaster_multiseries
,metrics_levels
output is now a pandas DataFrame. -
In
grid_search_forecaster_multiseries
andrandom_search_forecaster_multiseries
, argumentlevels_weights
is deprecated since version 0.6.0, and will be removed in version 0.7.0. Useseries_weights
andweights_func
when creating the forecaster instead. -
Refactor
_create_lags_
inForecasterAutoreg
,ForecasterAutoregDirect
andForecasterAutoregMultiSeries
. (suggested by Bennett https://github.com/Bennett561) -
Refactor
backtesting_forecaster
andbacktesting_forecaster_multiseries
. -
In
ForecasterAutoregDirect
,filter_train_X_y_for_step
now starts at 1 (before 0). -
In
ForecasterAutoregDirect
, DataFramey_train
now start with 1,y_step_1
(beforey_step_0
). -
Remove
cv_forecaster
from modulemodel_selection
.
Fixed
-
In
ForecasterAutoregMultiSeries
, argumentlast_window
predict method now works when it is a pandas DataFrame. -
In
ForecasterAutoregMultiSeries
, fix bug transformers initialization.
0.5.1 Oct 05, 2022¶
Added
-
Check that
exog
andy
have the same length in_evaluate_grid_hyperparameters
andbayesian_search_forecaster
to avoid fit exception whenreturn_best
. -
Check that
exog
andseries
have the same length in_evaluate_grid_hyperparameters_multiseries
to avoid fit exception whenreturn_best
.
Changed
- Argument
levels_list
ingrid_search_forecaster_multiseries
,random_search_forecaster_multiseries
and_evaluate_grid_hyperparameters_multiseries
renamed tolevels
.
Fixed
-
ForecasterAutoregMultiOutput
updated to matchForecasterAutoregDirect
. -
Fix Exception to raise when
level_weights
does not add up to a number close to 1.0 (before was exactly 1.0) ingrid_search_forecaster_multiseries
,random_search_forecaster_multiseries
and_evaluate_grid_hyperparameters_multiseries
. -
Create_train_X_y
inForecasterAutoregMultiSeries
now works when the forecaster is not fitted.
0.5.0 Sep 23, 2022¶
Added
-
New arguments
transformer_y
(transformer_series
for multiseries) andtransformer_exog
in all forecaster classes. It is for transforming (scaling, max-min, ...) the modeled time series and exogenous variables inside the forecaster. -
Functions in utils
transform_series
andtransform_dataframe
to 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_optuna
and_bayesian_search_skopt
in model_selection. -
Created
ForecasterAutoregMultiSeries
class 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_multiseries
and_evaluate_grid_hyperparameters_multiseries
. -
Function
_check_interval
in utils. (suggested by Thomas Karaouzene https://github.com/tkaraouzene) -
metric
can be a list inbacktesting_forecaster
,grid_search_forecaster
,random_search_forecaster
,backtesting_forecaster_multiseries
. Ifmetric
is 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_forecaster
andload_forecaster
to module utils. -
get_feature_importance()
method checks if the forecast is fitted.
Changed
-
backtesting_forecaster
change default value of argumentfixed_train_size: bool=True
. -
Remove argument
set_out_sample_residuals
in functionbacktesting_forecaster
(deprecated since 0.4.2). -
backtesting_forecaster
verbose now includes fold size. -
grid_search_forecaster
results include the name of the used metric as column name. -
Remove
get_coef
method fromForecasterAutoreg
,ForecasterAutoregCustom
andForecasterAutoregMultiOutput
(deprecated since 0.4.3). -
_get_metric
now allowsmean_squared_log_error
. -
ForecasterAutoregMultiOutput
has been renamed toForecasterAutoregDirect
.ForecasterAutoregMultiOutput
will be removed in version 0.6.0. -
check_predict_input
updated to checkForecasterAutoregMultiSeries
inputs. -
set_out_sample_residuals
has a new argumenttransform
to transform the residuals before being stored.
Fixed
-
fit
now storeslast_window
values with len = forecaster.max_lag in ForecasterAutoreg and ForecasterAutoregCustom. -
in_sample_residuals
stored as apd.Series
whenlen(residuals) > 1000
.
0.4.3 Mar 18, 2022¶
Added
-
Checks if all elements in lags are
int
when creating ForecasterAutoreg and ForecasterAutoregMultiOutput. -
Add
fixed_train_size: bool=False
argument tobacktesting_forecaster
andbacktesting_sarimax
Changed
-
Rename
get_metric
to_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),residuals
argument must be apandas Series
(wasnumpy ndarray
). -
Returned value of backtesting functions (model_selection and model_selection_statsmodels) is now a
float
(wasnumpy ndarray
). -
get_coef
andget_feature_importance
methods unified inget_feature_importance
.
Fixed
-
Requirements versions.
-
Method
fit
doesn't removeout_sample_residuals
each time the forecaster is fitted. -
Added random seed to residuals downsampling (ForecasterAutoreg and ForecasterAutoregCustom)
0.4.2 Jan 08, 2022¶
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_residuals
in functionbacktesting_forecaster()
. -
Function
model_selection.time_series_spliter
renamed tomodel_selection.time_series_splitter
Fixed
- Methods
get_coef
andget_feature_importance
ofForecasterAutoregMultiOutput
class return proper feature names.
0.4.1 Dec 13, 2021¶
Added
Changed
Fixed
fit
andpredict
transform pandas series and dataframes to numpy arrays if regressor is XGBoost.
0.4.0 Dec 10, 2021¶
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
ForecasterBase
as parent class
Changed
-
Argument
y
must be pandas Series. Numpy ndarrays are not allowed anymore. -
Argument
exog
must be pandas Series or pandas DataFrame. Numpy ndarrays are not allowed anymore. -
Output of
predict
is a pandas Series with index according to the steps predicted. -
Scikitlearn pipelines are allowed as regressors.
-
backtesting_forecaster
andbacktesting_forecaster_intervals
have been combined in a single function.- It is possible to backtest forecasters already trained.
ForecasterAutoregMultiOutput
allows incomplete folds.- It is possible to update
out_sample_residuals
with backtesting residuals.
-
cv_forecaster
has the option to updateout_sample_residuals
with backtesting residuals. -
backtesting_sarimax_statsmodels
andcv_sarimax_statsmodels
have been combined in a single function. -
gridsearch_forecaster
use backtesting as validation strategy with the option of refit. -
Extended information when printing
Forecaster
object. -
All static methods for checking and preprocessing inputs moved to module utils.
-
Remove deprecated class
ForecasterCustom
.
Fixed
0.3.0 Sep 01, 2021¶
Added
-
New module model_selection_statsmodels to cross-validate, backtesting and grid search AutoReg and SARIMAX models from statsmodels library:
backtesting_autoreg_statsmodels
cv_autoreg_statsmodels
backtesting_sarimax_statsmodels
cv_sarimax_statsmodels
grid_search_sarimax_statsmodels
-
Added attribute window_size to
ForecasterAutoreg
andForecasterAutoregCustom
. It is equal tomax_lag
.
Changed
cv_forecaster
returns 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 Aug 26, 2021¶
Added
-
Multiple exogenous variables can be passed as pandas DataFrame.
-
Documentation at https://skforecast.org
-
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 Jul 27, 2021¶
Added
-
Logging total number of models to fit in
grid_search_forecaster
. -
Class
ForecasterAutoregCustom
. -
Method
create_train_X_y
to facilitate access to the training data matrix created fromy
andexog
.
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
ForecasterCustom
has been renamed toForecasterAutoregCustom
. However,ForecasterCustom
will still remain to keep backward compatibility. -
Argument
metric
incv_forecaster
,backtesting_forecaster
,grid_search_forecaster
andbacktesting_forecaster_intervals
changed 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
metric
incv_forecaster
,backtesting_forecaster
,grid_search_forecaster
andbacktesting_forecaster_intervals
is one of 'mean_squared_error', 'mean_absolute_error', 'mean_absolute_percentage_error'. -
time_series_spliter
doesn'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
ForecasterAutoregMultiOutput
aftergrid_search_forecaster
.
0.1.8.1 May 17, 2021¶
Added
set_out_sample_residuals
method to store or update out of sample residuals used bypredict_interval
.
Changed
-
backtesting_forecaster_intervals
andbacktesting_forecaster
print 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_forecast
with aForecasterAutoregMultiOutput
. -
ForecasterAutoregMultiOutput.predict
allow exog data longer than needed (steps). -
backtesting_forecast
prints 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_window
when trainingForecasterAutoregMultiOutput
.
0.1.8 Apr 02, 2021¶
Added
- Class
ForecasterAutoregMultiOutput.py
: forecaster with direct multi-step predictions. - Method
ForecasterCustom.predict_interval
andForecasterAutoreg.predict_interval
: estimate prediction interval using bootstrapping. skforecast.model_selection.backtesting_forecaster_intervals
perform backtesting and return prediction intervals.
Changed
Fixed
0.1.7 Mar 19, 2021¶
Added
- Class
ForecasterCustom
: same functionalities asForecasterAutoreg
but allows custom definition of predictors.
Changed
grid_search forecaster
adapted to work with objectsForecasterCustom
in addition toForecasterAutoreg
.
Fixed
0.1.6 Mar 14, 2021¶
Added
- Method
get_feature_importances
toskforecast.ForecasterAutoreg
. - Added backtesting strategy in
grid_search_forecaster
. - Added
backtesting_forecast
toskforecast.model_selection
.
Changed
- Method
create_lags
return 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
X
tolast_window
in methodpredict
. - Renamed
ts_cv_forecaster
tocv_forecaster
.
Fixed
0.1.4 Feb 15, 2021¶
Added
- Method
get_coef
toskforecast.ForecasterAutoreg
.
Changed
Fixed