@@ -22,6 +22,7 @@ def _aamp_motifs(
2222 cutoff ,
2323 max_matches ,
2424 max_motifs ,
25+ atol = 1e-8 ,
2526):
2627 """
2728 Find the top non-normalized motifs (i.e., without z-normalization) for time series
@@ -72,6 +73,10 @@ def _aamp_motifs(
7273 max_motifs : int
7374 The maximum number of motifs to return.
7475
76+ atol : float, default 1e-8
77+ The absolute tolerance parameter. This value will be added to `max_distance`
78+ when comparing distances between subsequences.
79+
7580 Return
7681 ------
7782 motif_distances : numpy.ndarray
@@ -112,6 +117,7 @@ def _aamp_motifs(
112117 T ,
113118 max_matches = None ,
114119 max_distance = max_distance ,
120+ atol = atol ,
115121 )
116122
117123 if len (query_matches ) > min_neighbors :
@@ -141,6 +147,7 @@ def aamp_motifs(
141147 cutoff = None ,
142148 max_matches = 10 ,
143149 max_motifs = 1 ,
150+ atol = 1e-8 ,
144151):
145152 """
146153 Discover the top non-normalized motifs (i.e., without z-normalization) for time
@@ -208,6 +215,10 @@ def aamp_motifs(
208215 max_motifs : int, default 1
209216 The maximum number of motifs to return.
210217
218+ atol : float, default 1e-8
219+ The absolute tolerance parameter. This value will be added to `max_distance`
220+ when comparing distances between subsequences.
221+
211222 Return
212223 ------
213224 motif_distances : numpy.ndarray
@@ -267,6 +278,7 @@ def aamp_motifs(
267278 cutoff ,
268279 max_matches ,
269280 max_motifs ,
281+ atol = atol ,
270282 )
271283
272284 return motif_distances , motif_indices
@@ -279,6 +291,7 @@ def aamp_match(
279291 T_squared = None ,
280292 max_distance = None ,
281293 max_matches = None ,
294+ atol = 1e-8 ,
282295):
283296 """
284297 Find all matches of a query `Q` in a time series `T`, i.e. the indices
@@ -309,6 +322,10 @@ def aamp_match(
309322 indices of the most similar `10` subsequences is returned. If `None`, then all
310323 occurrences are returned.
311324
325+ atol : float, default 1e-8
326+ The absolute tolerance parameter. This value will be added to `max_distance`
327+ when comparing distances between subsequences.
328+
312329 Returns
313330 -------
314331 out : numpy.ndarray
@@ -356,7 +373,7 @@ def max_distance(D):
356373 matches = []
357374
358375 candidate_idx = np .argmin (D )
359- while D [candidate_idx ] <= max_distance and len (matches ) < max_matches :
376+ while D [candidate_idx ] <= atol + max_distance and len (matches ) < max_matches :
360377 matches .append ([D [candidate_idx ], candidate_idx ])
361378 core .apply_exclusion_zone (D , candidate_idx , excl_zone )
362379 candidate_idx = np .argmin (D )
0 commit comments