From f20175bc2192bf6445ea1e67de04d33691798f65 Mon Sep 17 00:00:00 2001 From: TEM Date: Tue, 26 Jul 2022 15:02:37 +0200 Subject: [PATCH] Fixes an off-by-one error in kshape. (The original paper by Paparrizos & Gravano uses MATLAB-style indexing on 1, instead of Python-style indexing on 0.) --- tslearn/metrics/cycc.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tslearn/metrics/cycc.pyx b/tslearn/metrics/cycc.pyx index 371c63c46..9b2399acf 100644 --- a/tslearn/metrics/cycc.pyx +++ b/tslearn/metrics/cycc.pyx @@ -85,7 +85,7 @@ def y_shifted_sbd_vec(numpy.ndarray[DTYPE_t, ndim=2] ref_ts, numpy.ndarray[DTYPE for i in range(dataset.shape[0]): cc = normalized_cc(ref_ts, dataset[i], norm1=norm_ref, norm2=norms_dataset[i]) idx = numpy.argmax(cc) - shift = idx - sz + shift = idx + 1 - sz if shift > 0: dataset_shifted[i, shift:] = dataset[i, :-shift, :] elif shift < 0: