SimpleEnsemble¶
-
class
hcrystalball.ensemble.
SimpleEnsemble
(base_learners, ensemble_func='mean', name='simple_ensemble', clip_predictions_lower=None, clip_predictions_upper=None)[source]¶ Bases:
sklearn.base.BaseEstimator
SimpleEnsemble model, which takes a list of any hcrystalball model wrapper instance(s) as base learners and aggregates their prediction using
ensemble_func
.See motivation to average forecasts from different models https://otexts.com/fpp2/combinations.html
- Parameters
Methods Summary
fit
(X[, y])Fit the stacking ensemble model
get_params
([deep])Get parameters for this estimator.
predict
(X)Calculate the prediction of the ensemble for a given set of date / time
set_params
(**params)Set the parameters of this estimator.
Methods Documentation
-
fit
(X, y=None)[source]¶ Fit the stacking ensemble model
- Parameters
X (pandas.DataFrame) – Input features.
y (numpy.ndarray) – Target vector.
- Returns
A fitted SimpleEnsemble instance
- Return type
-
get_params
(deep=True)¶ Get parameters for this estimator.
- Parameters
deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns
params – Parameter names mapped to their values.
- Return type
mapping of string to any
-
predict
(X)[source]¶ Calculate the prediction of the ensemble for a given set of date / time
- Parameters
X (pandas.DataFrame) – DataFrame container with a single column, named ‘date’, containing the datetimes for which the predictions should be made.
- Returns
A DataFrame container with the index being the input (date)time vector. The single column in the DataFrame contains the prediction and the column name is the name of the model (i.e. the
name
parameter passed to the constructor)- Return type
-
set_params
(**params)¶ Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each component of a nested object.