ChangePointsTrendTransform¶
- class ChangePointsTrendTransform(in_column: str, change_points_model: Optional[etna.transforms.decomposition.change_points_based.change_points_models.base.BaseChangePointsModelAdapter] = None, per_interval_model: Optional[etna.transforms.decomposition.change_points_based.per_interval_models.base.PerIntervalModel] = None)[source]¶
Bases:
etna.transforms.decomposition.change_points_based.base.ReversibleChangePointsTransform
Transform that makes a detrending of change-point intervals.
This class differs from
ChangePointsLevelTransform
only by default values forchange_points_model
andper_interval_model
.Transform divides each segment into intervals using
change_points_model
. Then a separate model is fitted on each interval usingper_interval_model
. Values predicted by the model are subtracted from each interval.Evaluated function can be linear, mean, median, etc. Look at the signature to find out which models can be used.
Warning
This transform can suffer from look-ahead bias. For transforming data at some timestamp it uses information from the whole train part.
Init ChangePointsTrendTransform.
- Parameters
in_column (str) – name of column to apply transform to
change_points_model (Optional[etna.transforms.decomposition.change_points_based.change_points_models.base.BaseChangePointsModelAdapter]) – model to get trend change points, by default
ruptures.detection.Binseg
in a wrapper withn_bkps=5
is usedper_interval_model (Optional[etna.transforms.decomposition.change_points_based.per_interval_models.base.PerIntervalModel]) – model to process intervals of segment, by default
sklearn.linear_models.LinearRegression
in a wrapper is used
- Inherited-members
Methods
fit
(ts)Fit the transform.
fit_transform
(ts)Fit and transform TSDataset.
get_regressors_info
()Return the list with regressors created by the transform.
inverse_transform
(ts)Inverse transform TSDataset.
load
(path)Load an object.
Get default grid for tuning hyperparameters.
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.
transform
(ts)Transform TSDataset inplace.
- params_to_tune() Dict[str, etna.distributions.distributions.BaseDistribution] [source]¶
Get default grid for tuning hyperparameters.
If
self.change_points_model
is equal to default then this grid tunes parameters:change_points_model.change_points_model.model
,change_points_model.n_bkps
. Other parameters are expected to be set by the user.- Returns
Grid to tune.
- Return type
Dict[str, etna.distributions.distributions.BaseDistribution]