Skip to content

Commit af2b35e

Browse files
committed
Merge remote-tracking branch 'origin/main' into ag/similaritysearchupdate
2 parents 77fea79 + d37a77f commit af2b35e

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

aeon/distances/_dft_sfa_mindist.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def dft_sfa_mindist(
4545
>>> x = np.array([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]])
4646
>>> y = np.array([[11, 12, 13, 14, 15, 16, 17, 18, 19, 20]])
4747
>>> transform = SFAFast(
48-
... word_length=16,
48+
... word_length=8,
4949
... alphabet_size=8,
5050
... window_size=x.shape[-1],
5151
... norm=True,

aeon/distances/_paa_sax_mindist.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def paa_sax_mindist(
4545
>>> from aeon.transformations.collection.dictionary_based import SAX
4646
>>> x = np.array([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]])
4747
>>> y = np.array([[11, 12, 13, 14, 15, 16, 17, 18, 19, 20]])
48-
>>> transform = SAX(n_segments=16, alphabet_size=8)
48+
>>> transform = SAX(n_segments=8, alphabet_size=8)
4949
>>> x_sax = transform.fit_transform(x).squeeze()
5050
>>> x_paa = transform._get_paa(x).squeeze()
5151
>>> y_sax = transform.transform(y).squeeze()

aeon/distances/_sax_mindist.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def sax_mindist(x: np.ndarray, y: np.ndarray, breakpoints: np.ndarray, n: int) -
4343
>>> from aeon.transformations.collection.dictionary_based import SAX
4444
>>> x = np.array([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]])
4545
>>> y = np.array([[11, 12, 13, 14, 15, 16, 17, 18, 19, 20]])
46-
>>> transform = SAX(n_segments=16, alphabet_size=8)
46+
>>> transform = SAX(n_segments=8, alphabet_size=8)
4747
>>> x_sax = transform.fit_transform(x).squeeze()
4848
>>> y_sax = transform.transform(y).squeeze()
4949
>>> dist = paa_sax_mindist(x_sax, y_sax, transform.breakpoints, x.shape[-1])

aeon/distances/_sfa_mindist.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def sfa_mindist(x: np.ndarray, y: np.ndarray, breakpoints: np.ndarray) -> float:
4343
>>> x = np.array([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]])
4444
>>> y = np.array([[11, 12, 13, 14, 15, 16, 17, 18, 19, 20]])
4545
>>> transform = SFAFast(
46-
... word_length=16,
46+
... word_length=8,
4747
... alphabet_size=8,
4848
... window_size=x.shape[-1],
4949
... norm=True,

aeon/transformations/collection/dictionary_based/_sfa_fast.py

+7
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@ def _fit_transform(self, X, y=None):
242242

243243
offset = 2 if self.norm else 0
244244
self.word_length_actual = min(self.window_size - offset, self.word_length)
245+
246+
if self.word_length > X.shape[-1] and self.word_length_actual > X.shape[-1]:
247+
raise ValueError(
248+
"Please set the word-length to a value smaller than or equal to "
249+
"the time series length and window-length."
250+
)
251+
245252
self.dft_length = (
246253
self.window_size - offset
247254
if (self.anova or self.variance) is True

0 commit comments

Comments
 (0)