Closed lupupu closed 2 years ago
As shown in the figure, the correlation has changed once. Is there any way to find the point of correlation change?
Hi @lupupu ,
Thx for your interest in ruptures
.
Off the top of my head, I would use a convolution or a cross-correlation between the two series and then look for a break point in the resulting series.
Hope it helps ! Best !
Hello,
Sorry for the late reply.
There is also a dedicated cost function for this situation: linear cost. It finds a change in the linear relationship between a univariate signal (e.g. the blue signal) and several covariates (e.g. the red signal).
To use it:
n_samples = signal_red.shape[0]
#concatenate the two signals + a constant signal
signal = np.c_[signal_red, signal_blue, np.ones(n_samples)]
# choose a method, here Dynp
algo = rpt.Dynp(model="linear").fit(signal)
# predict
algo.predict(n_bkps=3)
Note that this method has limits when the number of samples per segment is low.
Closing for now. Feel free to reopen.