ElasticPerSegmentModel¶
- class ElasticPerSegmentModel(alpha: float = 1.0, l1_ratio: float = 0.5, fit_intercept: bool = True, **kwargs)[source]¶
Bases:
etna.models.mixins.PerSegmentModelMixin
,etna.models.mixins.NonPredictionIntervalContextIgnorantModelMixin
,etna.models.base.NonPredictionIntervalContextIgnorantAbstractModel
Class holding per segment
sklearn.linear_model.ElasticNet
.Notes
Target components are formed as the terms from linear regression formula.
Create instance of ElasticNet with given parameters.
- Parameters
alpha (float) – Constant that multiplies the penalty terms. Defaults to 1.0.
alpha = 0
is equivalent to an ordinary least square, solved by the LinearRegression object. For numerical reasons, usingalpha = 0
with the Lasso object is not advised. Given this, you should use theLinearPerSegmentModel
object.l1_ratio (float) –
The ElasticNet mixing parameter, with
0 <= l1_ratio <= 1
.For
l1_ratio = 0
the penalty is an L2 penalty.For
l1_ratio = 1
it is an L1 penalty.For
0 < l1_ratio < 1
, the penalty is a combination of L1 and L2.
fit_intercept (bool) – Whether to calculate the intercept for this model. If set to False, no intercept will be used in calculations (i.e. data is expected to be centered).
- Inherited-members
Methods
fit
(ts)Fit model.
forecast
(ts[, return_components])Make predictions.
get_model
()Get internal models that are used inside etna class.
load
(path)Load an object.
Get default grid for tuning hyperparameters.
predict
(ts[, return_components])Make predictions with using true values as autoregression context if possible (teacher forcing).
save
(path)Save the object.
set_params
(**params)Return new object instance with modified parameters.
to_dict
()Collect all information about etna object in dict.
Attributes
context_size
Context size of the model.
- params_to_tune() Dict[str, etna.distributions.distributions.BaseDistribution] [source]¶
Get default grid for tuning hyperparameters.
- Returns
Grid to tune.
- Return type
Dict[str, etna.distributions.distributions.BaseDistribution]