ChangePointDetection#
- class causalpy.experiments.change_point_detection.ChangePointDetection[source]#
The class for detecting turning point in time series.
- Parameters:
Example
>>> import causalpy as cp >>> df = ( ... cp.load_data("its") ... .assign(date=lambda x: pd.to_datetime(x["date"])) ... .set_index("date") ... ) >>> seed = 42 >>> result = cp.ChangePointDetection( ... df, ... time_range=None, ... formula="y ~ 1 + t + C(month)", ... model=cp.pymc_models.LinearChangePointDetection( ... cp_effect_type="level", ... sample_kwargs={ ... "target_accept": 0.95, ... "random_seed": seed, ... "progressbar": False, ... }, ... ), ... )
Methods
ChangePointDetection.__init__(data, formula)ChangePointDetection.get_plot_data(*args, ...)Recover the data of an experiment along with the prediction and causal impact information.
Recover the data of the experiment along with the prediction and causal impact information.
Abstract method for recovering plot data.
ChangePointDetection.input_validation(data, ...)Validate the input data and model formula for correctness
ChangePointDetection.plot(*args, **kwargs)Plot the model.
display the posterior estimates of the change point
Ask the model to print its coefficients.
ChangePointDetection.summary([round_to])Print summary of main results and model coefficients.
Attributes
expt_typeidataReturn the InferenceData object of the model.
supports_bayessupports_ols- classmethod __new__(*args, **kwargs)#