ruptures_based¶
Classes
RupturesChangePointsModel is ruptures change point models adapter. |
- class RupturesChangePointsModel(change_points_model: ruptures.base.BaseEstimator, **change_points_model_predict_params)[source]¶
RupturesChangePointsModel is ruptures change point models adapter.
Init RupturesChangePointsModel. @ TODO: add arg names for pen/eps/n_bkps or clear error message about its validation
- Parameters
change_point_model – model to get change points
change_point_model_predict_params – params for
change_point_model.predict
methodchange_points_model (ruptures.base.BaseEstimator) –
- get_change_points(df: pandas.core.frame.DataFrame, in_column: str) List[pandas._libs.tslibs.timestamps.Timestamp] [source]¶
Find change points within one segment.
- Parameters
df (pandas.core.frame.DataFrame) – dataframe indexed with timestamp
in_column (str) – name of column to get change points
- Returns
change point timestamps
- Return type
change points
- get_change_points_intervals(df: pandas.core.frame.DataFrame, in_column: str) List[Tuple[pandas._libs.tslibs.timestamps.Timestamp, pandas._libs.tslibs.timestamps.Timestamp]] ¶
Find change point intervals in given dataframe and column.
- Parameters
df (pandas.core.frame.DataFrame) – dataframe indexed with timestamp
in_column (str) – name of column to get change points
- Returns
change points intervals
- Return type
List[Tuple[pandas._libs.tslibs.timestamps.Timestamp, pandas._libs.tslibs.timestamps.Timestamp]]
- set_params(**params: dict) etna.core.mixins.TMixin ¶
Return new object instance with modified parameters.
Method also allows to change parameters of nested objects within the current object. For example, it is possible to change parameters of a
model
in aPipeline
.Nested parameters are expected to be in a
<component_1>.<...>.<parameter>
form, where components are separated by a dot.- Parameters
**params – Estimator parameters
self (etna.core.mixins.TMixin) –
params (dict) –
- Returns
New instance with changed parameters
- Return type
etna.core.mixins.TMixin
Examples
>>> from etna.pipeline import Pipeline >>> from etna.models import NaiveModel >>> from etna.transforms import AddConstTransform >>> model = model=NaiveModel(lag=1) >>> transforms = [AddConstTransform(in_column="target", value=1)] >>> pipeline = Pipeline(model, transforms=transforms, horizon=3) >>> pipeline.set_params(**{"model.lag": 3, "transforms.0.value": 2}) Pipeline(model = NaiveModel(lag = 3, ), transforms = [AddConstTransform(in_column = 'target', value = 2, inplace = True, out_column = None, )], horizon = 3, )
- to_dict()¶
Collect all information about etna object in dict.