BCPD

class hana_ml.algorithms.pal.tsa.changepoint.BCPD(max_tcp, max_scp, trend_order=None, max_harmonic_order=None, min_period=None, max_period=None, random_seed=None, max_iter=None, interval_ratio=None)

Bayesian Change-point detection (BCPD) detects abrupt changes in the time series. It, to some extent, can been assumed as an enhanced version of seasonality test in additive mode.

Parameters
max_tcpint

Maximum number of trend change points to be detected.

max_scpint

Maximum number of season change points to be detected.

trend_orderint, optional

Order of trend segments that used for decomposition

Defaults to 1.

max_harmonic_orderint, optional

Maximum order of harmonic waves within seasonal segments.

Defaults to 10.

min_periodint, optional

Minimum possible period within seasonal segments.

Defaults to 1.

max_periodint, optional

Maximum possible period within seasonal segments.

Defaults to half of the data length.

random_seedint, optional

Indicates the seed used to initialize the random number generator:

  • 0: Uses the system time.

  • Not 0: Uses the provided value.

Defaults to 0.

max_iterint, optional

BCPD is iterative, the more iterations, the more precise will the result be rendered.

Defaults to 5000.

interval_ratiofloat, optional

Regulates the interval between change points, which should be larger than the corresponding portion of total length.

Defaults to 0.1.

Examples

>>> df.collect()
  TIME_STAMP      SERIES
0          1       -5.36
1          2       -5.14
2          3       -4.94
3          4       -5.15
4          5       -4.95
5          6        0.55
6          7        0.88
7          8        0.95
8          9        0.68
9         10        0.86
>>> bcpd = BCPD(max_tcp=5, max_scp=5)
>>> tcp, scp, period, components = bcpd.fit_predict(data=df)
>>> scp.collect()
      ID      SEASON_CP
0      1              4
1      2              5
Attributes
fit_hdbprocedure

Returns the generated hdbprocedure for fit.

predict_hdbprocedure

Returns the generated hdbprocedure for predict.

Methods

fit_predict(data[, key, endog, features])

Detects change-points of the input data.

fit_predict(data, key=None, endog=None, features=None)

Detects change-points of the input data.

Parameters
dataDataFrame

Input time-series data for change-point detection.

keystr, optional

Column name for time-stamp of the input time-series data.

If the index column of data is not provided or not a single column, and the key of fit_predict function is not provided, the default value is the first column of data.

If the index of data is set as a single column, the default value of key is index column of data.

endogstr, optional

Column name for the value of the input time-series data. Defaults to the first non-key column.

featuresstr or list of str, optional (deprecated)

Column name(s) for the value(s) of the input time-series data.

Returns
DataFrame 1

The detected the trend change-points of the input time-series data.

DataFrame 2

The detected the season change-points of the input time-series data.

DataFrame 3

The detected the period within each season segment of the input time-series data.

DataFrame 4

The decomposed components.

property fit_hdbprocedure

Returns the generated hdbprocedure for fit.

property predict_hdbprocedure

Returns the generated hdbprocedure for predict.

Inherited Methods from PALBase

Besides those methods mentioned above, the BCPD class also inherits methods from PALBase class, please refer to PAL Base for more details.