tslearn 0.6.2__tar.gz → 0.6.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. {tslearn-0.6.2 → tslearn-0.6.3}/PKG-INFO +1 -1
  2. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/__init__.py +1 -1
  3. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/backend/__init__.py +2 -1
  4. tslearn-0.6.3/tslearn/backend/backend.py +120 -0
  5. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/backend/numpy_backend.py +4 -0
  6. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/backend/pytorch_backend.py +4 -0
  7. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/bases/bases.py +3 -2
  8. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/metrics/ctw.py +48 -26
  9. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/metrics/cycc.py +17 -12
  10. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/metrics/cysax.py +19 -12
  11. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/metrics/dtw_variants.py +718 -209
  12. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/metrics/sax.py +12 -8
  13. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/metrics/soft_dtw_fast.py +96 -44
  14. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/metrics/soft_dtw_loss_pytorch.py +7 -7
  15. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/metrics/softdtw_variants.py +370 -111
  16. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/metrics/utils.py +19 -10
  17. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/shapelets/shapelets.py +13 -5
  18. tslearn-0.6.3/tslearn/tests/test_metrics.py +803 -0
  19. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/tests/test_shapelets.py +9 -0
  20. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/utils/utils.py +19 -8
  21. tslearn-0.6.2/tslearn/backend/backend.py +0 -153
  22. tslearn-0.6.2/tslearn/tests/test_metrics.py +0 -712
  23. {tslearn-0.6.2 → tslearn-0.6.3}/LICENSE +0 -0
  24. {tslearn-0.6.2 → tslearn-0.6.3}/MANIFEST.in +0 -0
  25. {tslearn-0.6.2 → tslearn-0.6.3}/README.md +0 -0
  26. {tslearn-0.6.2 → tslearn-0.6.3}/conftest.py +0 -0
  27. {tslearn-0.6.2 → tslearn-0.6.3}/pyproject.toml +0 -0
  28. {tslearn-0.6.2 → tslearn-0.6.3}/setup.cfg +0 -0
  29. {tslearn-0.6.2 → tslearn-0.6.3}/setup.py +0 -0
  30. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/.cached_datasets/Trace.npz +0 -0
  31. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/barycenters/__init__.py +0 -0
  32. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/barycenters/dba.py +0 -0
  33. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/barycenters/euclidean.py +0 -0
  34. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/barycenters/softdtw.py +0 -0
  35. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/barycenters/utils.py +0 -0
  36. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/bases/__init__.py +0 -0
  37. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/clustering/__init__.py +0 -0
  38. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/clustering/kmeans.py +0 -0
  39. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/clustering/kshape.py +0 -0
  40. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/clustering/utils.py +0 -0
  41. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/datasets/__init__.py +0 -0
  42. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/datasets/cached.py +0 -0
  43. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/datasets/datasets.py +0 -0
  44. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/datasets/ucr_uea.py +0 -0
  45. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/early_classification/__init__.py +0 -0
  46. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/early_classification/early_classification.py +0 -0
  47. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/generators/__init__.py +0 -0
  48. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/generators/generators.py +0 -0
  49. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/hdftools/__init__.py +0 -0
  50. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/hdftools/hdftools.py +0 -0
  51. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/matrix_profile/__init__.py +0 -0
  52. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/matrix_profile/matrix_profile.py +0 -0
  53. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/metrics/__init__.py +0 -0
  54. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/metrics/cycc.c +0 -0
  55. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/metrics/cysax.c +0 -0
  56. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/metrics/soft_dtw_fast.c +0 -0
  57. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/neighbors/__init__.py +0 -0
  58. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/neighbors/neighbors.py +0 -0
  59. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/neural_network/__init__.py +0 -0
  60. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/neural_network/neural_network.py +0 -0
  61. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/piecewise/__init__.py +0 -0
  62. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/piecewise/piecewise.py +0 -0
  63. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/preprocessing/__init__.py +0 -0
  64. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/preprocessing/preprocessing.py +0 -0
  65. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/shapelets/__init__.py +0 -0
  66. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/svm/__init__.py +0 -0
  67. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/svm/svm.py +0 -0
  68. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/tests/__init__.py +0 -0
  69. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/tests/sklearn_patches.py +0 -0
  70. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/tests/test_barycenters.py +0 -0
  71. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/tests/test_clustering.py +0 -0
  72. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/tests/test_estimators.py +0 -0
  73. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/tests/test_matrixprofile.py +0 -0
  74. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/tests/test_neighbors.py +0 -0
  75. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/tests/test_piecewise.py +0 -0
  76. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/tests/test_preprocessing.py +0 -0
  77. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/tests/test_serialize_models.py +0 -0
  78. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/tests/test_svm.py +0 -0
  79. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/tests/test_utils.py +0 -0
  80. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/tests/test_variablelength.py +0 -0
  81. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/utils/__init__.py +0 -0
  82. {tslearn-0.6.2 → tslearn-0.6.3}/tslearn/utils/cast.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tslearn
3
- Version: 0.6.2
3
+ Version: 0.6.3
4
4
  Summary: A machine learning toolkit dedicated to time-series data
5
5
  Home-page: http://tslearn.readthedocs.io/
6
6
  Author: Romain Tavenard
@@ -1,7 +1,7 @@
1
1
  import os
2
2
 
3
3
  __author__ = 'Romain Tavenard romain.tavenard[at]univ-rennes2.fr'
4
- __version__ = "0.6.2"
4
+ __version__ = "0.6.3"
5
5
  __bibtex__ = r"""@article{JMLR:v21:20-091,
6
6
  author = {Romain Tavenard and Johann Faouzi and Gilles Vandewiele and
7
7
  Felix Divo and Guillaume Androz and Chester Holtz and
@@ -3,10 +3,11 @@ The :mod:`tslearn.backend` module provides multiple backends.
3
3
  The backends provided are NumPy and PyTorch.
4
4
  """
5
5
 
6
- from .backend import Backend, instantiate_backend, select_backend
6
+ from .backend import Backend, cast, instantiate_backend, select_backend
7
7
 
8
8
  __all__ = [
9
9
  "Backend",
10
+ "cast",
10
11
  "instantiate_backend",
11
12
  "select_backend",
12
13
  ]
@@ -0,0 +1,120 @@
1
+ """The generic backend."""
2
+
3
+ from tslearn.backend.numpy_backend import NumPyBackend
4
+
5
+ try:
6
+ import torch
7
+
8
+ from tslearn.backend.pytorch_backend import PyTorchBackend
9
+ except ImportError:
10
+
11
+ class PyTorchBackend:
12
+ def __init__(self):
13
+ raise ValueError(
14
+ "Could not use pytorch backend since torch is not installed"
15
+ )
16
+
17
+
18
+ def instantiate_backend(*args):
19
+ """Select backend.
20
+
21
+ Parameter
22
+ ---------
23
+ *args : Input arguments can be Backend instance or string or array or None
24
+ Arguments used to define the backend instance.
25
+
26
+ Returns
27
+ -------
28
+ backend : Backend instance
29
+ The backend instance.
30
+ """
31
+ for arg in args:
32
+ if isinstance(arg, Backend):
33
+ return arg
34
+ if "numpy" in f"{type(arg)}" or "numpy" in f"{arg}".lower():
35
+ return Backend("numpy")
36
+ if "torch" in f"{type(arg)}" or "torch" in f"{arg}".lower():
37
+ return Backend("pytorch")
38
+ return Backend("numpy")
39
+
40
+
41
+ def select_backend(data):
42
+ """Select backend.
43
+
44
+ Parameter
45
+ ---------
46
+ data : array-like or string or None
47
+ Indicates the backend to choose.
48
+ Optional, default equals None.
49
+
50
+ Returns
51
+ -------
52
+ backend : class
53
+ The backend class.
54
+ If data is a Numpy array or data equals 'numpy' or data is None,
55
+ backend equals NumpyBackend().
56
+ If data is a PyTorch array or data equals 'pytorch',
57
+ backend equals PytorchBackend().
58
+ """
59
+ if "torch" in f"{type(data)}" or "torch" in f"{data}".lower():
60
+ return PyTorchBackend()
61
+ return NumPyBackend()
62
+
63
+
64
+ class Backend(object):
65
+ """Class for the backend.
66
+
67
+ Parameter
68
+ ---------
69
+ data : array-like or string or None
70
+ Indicates the backend to choose.
71
+ If data is a Numpy array or data equals 'numpy' or data is None,
72
+ self.backend is set to NumpyBackend().
73
+ If data is a PyTorch array or data equals 'pytorch',
74
+ self.backend is set to PytorchBackend().
75
+ Optional, default equals None.
76
+ """
77
+
78
+ def __init__(self, data=None):
79
+ self.backend = select_backend(data)
80
+
81
+ for element in dir(self.backend):
82
+ if "__" not in element:
83
+ setattr(self, element, getattr(self.backend, element))
84
+
85
+ self.is_numpy = self.backend_string == "numpy"
86
+ self.is_pytorch = self.backend_string == "pytorch"
87
+
88
+ def get_backend(self):
89
+ return self.backend
90
+
91
+ def set_backend(self, data=None):
92
+ self.backend = select_backend(data)
93
+
94
+
95
+ def cast(data, array_type="numpy"):
96
+ """Cast data to list or specific backend.
97
+
98
+ Parameters
99
+ ----------
100
+ data: array-like,
101
+ The input data should be a list or numpy array or torch array.
102
+ The data to cast.
103
+ array_type: string
104
+ The type to cast the data. It can be "numpy", "pytorch" or "list".
105
+
106
+ Returns
107
+ --------
108
+ data_cast: array-like
109
+ Data cast to array_type.
110
+ """
111
+ data_type_string = f"{type(data)}".lower()
112
+ array_type = array_type.lower()
113
+ if array_type == "pytorch":
114
+ array_type = "torch"
115
+ if array_type in data_type_string:
116
+ return data
117
+ if array_type == "list":
118
+ return data.tolist()
119
+ be = Backend(array_type)
120
+ return be.array(data)
@@ -81,6 +81,10 @@ class NumPyBackend(object):
81
81
  self.zeros = _np.zeros
82
82
  self.zeros_like = _np.zeros_like
83
83
 
84
+ @staticmethod
85
+ def belongs_to_backend(x):
86
+ return "numpy" in f"{type(x)}".lower()
87
+
84
88
  @staticmethod
85
89
  def cast(x, dtype):
86
90
  return x.astype(dtype)
@@ -121,6 +121,10 @@ else:
121
121
 
122
122
  return _torch.tensor(val, dtype=dtype)
123
123
 
124
+ @staticmethod
125
+ def belongs_to_backend(x):
126
+ return "torch" in f"{type(x)}".lower()
127
+
124
128
  def cast(self, x, dtype):
125
129
  if _torch.is_tensor(x):
126
130
  return x.to(dtype=dtype)
@@ -204,8 +204,9 @@ class BaseModelPackage:
204
204
  model = cls._byte2string(model)
205
205
 
206
206
  for k in model['hyper_params'].keys():
207
- if model['hyper_params'][k] == 'None':
208
- model['hyper_params'][k] = None
207
+ if isinstance(model['hyper_params'][k], str):
208
+ if model['hyper_params'][k] == 'None':
209
+ model['hyper_params'][k] = None
209
210
 
210
211
  return cls._organize_model(cls, model)
211
212
 
@@ -9,20 +9,21 @@ from .utils import _cdist_generic
9
9
 
10
10
 
11
11
  def _get_warp_matrices(warp_path, be):
12
- """
13
- Convert warping path sequence to matrices.
12
+ """Convert warping path sequence to matrices.
14
13
 
15
14
  Parameters
16
15
  ----------
17
- warp_path : list of tuple of two indices that are matched together
16
+ warp_path : list of tuple of two indices that are matched together, length = m
18
17
  First output of the dtw_path function.
19
18
  be : Backend object or string
20
19
  Backend.
21
20
 
22
21
  Returns
23
22
  -------
24
- two 2D matrices of size m x T (m = number of step to match the two
25
- sequences
23
+ Wx : array-like, shape=(m, nx)
24
+ Matrix. The number of steps to match the two sequences is equal to m.
25
+ Wy : array-like, shape=(m, ny)
26
+ Matrix.
26
27
  """
27
28
  be = instantiate_backend(be, warp_path[0][0])
28
29
  # number of indices for the alignment
@@ -67,10 +68,10 @@ def ctw_path(
67
68
 
68
69
  Parameters
69
70
  ----------
70
- s1
71
- A time series.
72
- s2
73
- Another time series.
71
+ s1 : array-like, shape=(sz1, d) or (sz1,)
72
+ A time series. If shape is (sz1,), the time series is assumed to be univariate.
73
+ s2 : array-like, shape=(sz2, d) or (sz2,)
74
+ Another time series. If shape is (sz2,), the time series is assumed to be univariate.
74
75
  max_iter : int (default: 100)
75
76
  Number of iterations for the CTW algorithm. Each iteration
76
77
  n_components : int (default: None)
@@ -100,7 +101,12 @@ def ctw_path(
100
101
  verbose : bool (default: True)
101
102
  If True, scores are printed at each iteration of the algorithm.
102
103
  be : Backend object or string or None
103
- Backend.
104
+ Backend. If `be` is an instance of the class `NumPyBackend` or the string `"numpy"`,
105
+ the NumPy backend is used.
106
+ If `be` is an instance of the class `PyTorchBackend` or the string `"pytorch"`,
107
+ the PyTorch backend is used.
108
+ If `be` is `None`, the backend is determined by the input arrays.
109
+ See our :ref:`dedicated user-guide page <backend>` for more information.
104
110
 
105
111
  Returns
106
112
  -------
@@ -136,7 +142,7 @@ def ctw_path(
136
142
  .. [1] F. Zhou and F. Torre, "Canonical time warping for alignment of
137
143
  human behavior". NIPS 2009.
138
144
  """
139
- be = instantiate_backend(be, s1)
145
+ be = instantiate_backend(be, s1, s2)
140
146
  s1 = to_time_series(s1, remove_nans=True, be=be)
141
147
  s2 = to_time_series(s2, remove_nans=True, be=be)
142
148
  s1, s2 = be.array(s1, dtype=be.float64), be.array(s2, dtype=be.float64)
@@ -215,10 +221,10 @@ def ctw(
215
221
 
216
222
  Parameters
217
223
  ----------
218
- s1
219
- A time series.
220
- s2
221
- Another time series.
224
+ s1 : array-like, shape=(sz1, d) or (sz1,)
225
+ A time series. If shape is (sz1,), the time series is assumed to be univariate.
226
+ s2 : array-like, shape=(sz2, d) or (sz2,)
227
+ Another time series. If shape is (sz2,), the time series is assumed to be univariate.
222
228
  max_iter : int (default: 100)
223
229
  Number of iterations for the CTW algorithm. Each iteration
224
230
  n_components : int (default: None)
@@ -248,7 +254,12 @@ def ctw(
248
254
  verbose : bool (default: True)
249
255
  If True, scores are printed at each iteration of the algorithm.
250
256
  be : Backend object or string or None
251
- Backend.
257
+ Backend. If `be` is an instance of the class `NumPyBackend` or the string `"numpy"`,
258
+ the NumPy backend is used.
259
+ If `be` is an instance of the class `PyTorchBackend` or the string `"pytorch"`,
260
+ the PyTorch backend is used.
261
+ If `be` is `None`, the backend is determined by the input arrays.
262
+ See our :ref:`dedicated user-guide page <backend>` for more information.
252
263
 
253
264
  Returns
254
265
  -------
@@ -271,7 +282,9 @@ def ctw(
271
282
  .. [1] F. Zhou and F. Torre, "Canonical time warping for alignment of
272
283
  human behavior". NIPS 2009.
273
284
  """
274
- be = instantiate_backend(be, s1)
285
+ be = instantiate_backend(be, s1, s2)
286
+ s1 = be.array(s1)
287
+ s2 = be.array(s2)
275
288
  return ctw_path(
276
289
  s1=s1,
277
290
  s2=s2,
@@ -311,11 +324,15 @@ def cdist_ctw(
311
324
 
312
325
  Parameters
313
326
  ----------
314
- dataset1 : array-like
315
- A dataset of time series
316
- dataset2 : array-like (default: None)
317
- Another dataset of time series. If `None`, self-similarity of
318
- `dataset1` is returned.
327
+ dataset1 : array-like, shape=(n_ts1, sz1, d) or (n_ts1, sz1) or (sz1,)
328
+ A dataset of time series.
329
+ If shape is (n_ts1, sz1), the dataset is composed of univariate time series.
330
+ If shape is (sz1,), the dataset is composed of a unique univariate time series.
331
+ dataset2 : None or array-like, shape=(n_ts2, sz2, d) or (n_ts2, sz2) or (sz2,) (default: None)
332
+ Another dataset of time series.
333
+ If `None`, self-similarity of `dataset1` is returned.
334
+ If shape is (n_ts2, sz2), the dataset is composed of univariate time series.
335
+ If shape is (sz2,), the dataset is composed of a unique univariate time series.
319
336
  max_iter : int (default: 100)
320
337
  Number of iterations for the CTW algorithm. Each iteration
321
338
  n_components : int (default: None)
@@ -356,12 +373,17 @@ def cdist_ctw(
356
373
  `Glossary <https://joblib.readthedocs.io/en/latest/parallel.html#parallel-reference-documentation>`__
357
374
  for more details.
358
375
  be : Backend object or string or None
359
- Backend.
376
+ Backend. If `be` is an instance of the class `NumPyBackend` or the string `"numpy"`,
377
+ the NumPy backend is used.
378
+ If `be` is an instance of the class `PyTorchBackend` or the string `"pytorch"`,
379
+ the PyTorch backend is used.
380
+ If `be` is `None`, the backend is determined by the input arrays.
381
+ See our :ref:`dedicated user-guide page <backend>` for more information.
360
382
 
361
383
  Returns
362
384
  -------
363
- cdist : numpy.ndarray
364
- Cross-similarity matrix
385
+ cdist : array-like, shape=(n_ts1, n_ts2)
386
+ Cross-similarity matrix.
365
387
 
366
388
  Examples
367
389
  --------
@@ -382,7 +404,7 @@ def cdist_ctw(
382
404
  .. [1] F. Zhou and F. Torre, "Canonical time warping for alignment of
383
405
  human behavior". NIPS 2009.
384
406
  """ # noqa: E501
385
- be = instantiate_backend(be, dataset1)
407
+ be = instantiate_backend(be, dataset1, dataset2)
386
408
  return _cdist_generic(
387
409
  dist_fun=ctw,
388
410
  dataset1=dataset1,
@@ -12,14 +12,16 @@ def normalized_cc(s1, s2, norm1=-1.0, norm2=-1.0):
12
12
 
13
13
  Parameters
14
14
  ----------
15
- s1 : array-like, shape=[sz, d], dtype=float64
16
- s2 : array-like, shape=[sz, d], dtype=float64
15
+ s1 : array-like, shape=(sz, d), dtype=float64
16
+ A time series.
17
+ s2 : array-like, shape=(sz, d), dtype=float64
18
+ Another time series.
17
19
  norm1 : float64, default=-1.0
18
20
  norm2 : float64, default=-1.0
19
21
 
20
22
  Returns
21
23
  -------
22
- norm_cc : array-like, shape=[2 * sz - 1], dtype=float64
24
+ norm_cc : array-like, shape=(2 * sz - 1), dtype=float64
23
25
  """
24
26
  assert s1.shape[1] == s2.shape[1]
25
27
  sz = s1.shape[0]
@@ -54,15 +56,17 @@ def cdist_normalized_cc(dataset1, dataset2, norms1, norms2, self_similarity):
54
56
 
55
57
  Parameters
56
58
  ----------
57
- dataset1 : array-like, shape=[n_ts1, sz, d], dtype=float64
58
- dataset2 : array-like, shape=[n_ts2, sz, d], dtype=float64
59
- norms1 : array-like, shape=[n_ts1], dtype=float64
60
- norms2 : array-like, shape=[n_ts2], dtype=float64
59
+ dataset1 : array-like, shape=(n_ts1, sz, d), dtype=float64
60
+ A dataset of time series.
61
+ dataset2 : array-like, shape=(n_ts2, sz, d), dtype=float64
62
+ Another dataset of time series.
63
+ norms1 : array-like, shape=(n_ts1,), dtype=float64
64
+ norms2 : array-like, shape=(n_ts2,), dtype=float64
61
65
  self_similarity : bool
62
66
 
63
67
  Returns
64
68
  -------
65
- dists : array-like, shape=[n_ts1, n_ts2], dtype=float64
69
+ dists : array-like, shape=(n_ts1, n_ts2), dtype=float64
66
70
  """
67
71
  n_ts1, sz, d = dataset1.shape
68
72
  n_ts2 = dataset2.shape[0]
@@ -97,17 +101,18 @@ def y_shifted_sbd_vec(ref_ts, dataset, norm_ref, norms_dataset):
97
101
 
98
102
  Parameters
99
103
  ----------
100
- ref_ts : array-like, shape=[sz, d], dtype=float64
104
+ ref_ts : array-like, shape=(sz, d), dtype=float64
101
105
  Time series of reference.
102
- dataset : array-like, shape=[n_ts, sz, d], dtype=float64
106
+ dataset : array-like, shape=(n_ts, sz, d), dtype=float64
103
107
  Time series dataset.
104
108
  norm_ref : float64
105
- norms_dataset : array-like, shape=[n_ts], dtype=float64
109
+ norms_dataset : array-like, shape=(n_ts,), dtype=float64
106
110
  Norms of the time series dataset.
107
111
 
108
112
  Returns
109
113
  -------
110
- dataset_shifted : array-like, shape=[n_ts, sz, d], dtype=float64
114
+ dataset_shifted : array-like, shape=(n_ts, sz, d), dtype=float64
115
+ Shifted dataset.
111
116
  """
112
117
  n_ts = dataset.shape[0]
113
118
  sz = dataset.shape[1]
@@ -13,13 +13,14 @@ def inv_transform_paa(dataset_paa, original_size):
13
13
 
14
14
  Parameters
15
15
  ----------
16
- dataset_paa : array-like, shape=[n_ts, sz, d], dtype=float64
16
+ dataset_paa : array-like, shape=(n_ts, sz, d), dtype=float64
17
17
  A dataset of PAA series.
18
18
  original_size : int32
19
+ Length of the original time series.
19
20
 
20
21
  Returns
21
22
  -------
22
- dataset_out : array-like, shape=[n_ts, original_size, d], dtype=float64
23
+ dataset_out : array-like, shape=(n_ts, original_size, d), dtype=float64
23
24
  A dataset of time series corresponding to the provided
24
25
  representation.
25
26
  """
@@ -39,12 +40,14 @@ def cydist_sax(sax1, sax2, breakpoints, original_size):
39
40
 
40
41
  Parameters
41
42
  ----------
42
- sax1 : array-like, shape=[sz, d], dtype=float64 (Linux and MacOS) or float32 (Windows)
43
+ sax1 : array-like, shape=(sz, d), dtype=float64 (Linux and MacOS) or float32 (Windows)
43
44
  SAX representation of a time series.
44
- sax2 : array-like, shape=[sz, d], dtype=float64 (Linux and MacOS) or float32 (Windows)
45
+ sax2 : array-like, shape=(sz, d), dtype=float64 (Linux and MacOS) or float32 (Windows)
45
46
  SAX representation of another time series.
46
47
  breakpoints : array-like, ndim=1, dtype=float64
48
+ The breakpoints used to assign the alphabet symbols.
47
49
  original_size : int64 (Linux and MacOS) or int32 (Windows)
50
+ Length of the original time series.
48
51
 
49
52
  Returns
50
53
  -------
@@ -77,14 +80,15 @@ def inv_transform_sax(dataset_sax, breakpoints_middle_, original_size):
77
80
 
78
81
  Parameters
79
82
  ----------
80
- dataset_sax : array-like, shape=[n_ts, sz, d], dtype=float64 (Linux and MacOS) or float32 (Windows)
83
+ dataset_sax : array-like, shape=(n_ts, sz, d), dtype=float64 (Linux and MacOS) or float32 (Windows)
81
84
  A dataset of SAX series.
82
85
  breakpoints_middle_ : array-like, ndim=1, dtype=float64
83
86
  original_size : int64 (Linux and MacOS) or int32 (Windows)
87
+ Length of the original time series.
84
88
 
85
89
  Returns
86
90
  -------
87
- dataset_out : array-like, shape=[n_ts, original_size, d], dtype=float64
91
+ dataset_out : array-like, shape=(n_ts, original_size, d), dtype=float64
88
92
  """
89
93
  n_ts, sz, d = dataset_sax.shape
90
94
  seg_sz = original_size // sz
@@ -105,12 +109,12 @@ def cyslopes(dataset, t0):
105
109
 
106
110
  Parameters
107
111
  ----------
108
- dataset : array-like, shape=[n_ts, sz, d], dtype=float64
112
+ dataset : array-like, shape=(n_ts, sz, d), dtype=float64
109
113
  t0 : int32
110
114
 
111
115
  Returns
112
116
  -------
113
- dataset_out : array-like, shape=[n_ts, d], dtype=float64
117
+ dataset_out : array-like, shape=(n_ts, d), dtype=float64
114
118
  """
115
119
  n_ts, sz, d = dataset.shape
116
120
  dataset_out = np.empty((n_ts, d))
@@ -135,17 +139,19 @@ def cydist_1d_sax(
135
139
 
136
140
  Parameters
137
141
  ----------
138
- sax1 : array-like, shape=[sz, 2 * d], dtype=float64 (Linux and MacOS) or float32 (Windows)
142
+ sax1 : array-like, shape=(sz, 2 * d), dtype=float64 (Linux and MacOS) or float32 (Windows)
139
143
  1d-SAX representation of a time series.
140
- sax2 : array-like, shape=[sz, 2 * d], dtype=float64 (Linux and MacOS) or float32 (Windows)
144
+ sax2 : array-like, shape=(sz, 2 * d), dtype=float64 (Linux and MacOS) or float32 (Windows)
141
145
  1d-SAX representation of another time series.
142
146
  breakpoints_avg_middle_ : array-like, ndim=1, dtype=float64
143
147
  breakpoints_slope_middle_ : array-like, ndim=1, dtype=float64
144
148
  original_size : int64 (Linux and MacOS) or int32 (Windows)
149
+ Length of the original time series.
145
150
 
146
151
  Returns
147
152
  -------
148
153
  dist_1d_sax : float64
154
+ 1d-SAX distance.
149
155
 
150
156
  Notes
151
157
  -----
@@ -187,15 +193,16 @@ def inv_transform_1d_sax(
187
193
 
188
194
  Parameters
189
195
  ----------
190
- dataset_sax : array-like, shape=[n_ts, sz, 2 * d], dtype=float64 (Linux and MacOS) or float32 (Windows)
196
+ dataset_sax : array-like, shape=(n_ts, sz, 2 * d), dtype=float64 (Linux and MacOS) or float32 (Windows)
191
197
  A dataset of SAX series.
192
198
  breakpoints_avg_middle_ : array-like, ndim=1, dtype=float64
193
199
  breakpoints_slope_middle_ : array-like, ndim=1, dtype=float64
194
200
  original_size : int64 (Linux and MacOS) or int32 (Windows)
201
+ Length of the original time series.
195
202
 
196
203
  Returns
197
204
  -------
198
- dataset_out : array-like, shape=[n_ts, original_size, d], dtype=float64
205
+ dataset_out : array-like, shape=(n_ts, original_size, d), dtype=float64
199
206
  A dataset of time series corresponding to the provided
200
207
  representation.
201
208
  """