MCPcopy
hub / github.com/stumpy-dev/stumpy / test_motifs_max_matches

Function test_motifs_max_matches

tests/test_motifs.py:244–305  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

242
243
244def test_motifs_max_matches():
245 # This test covers the following:
246
247 # A time series contains motif A at four locations and motif B at two.
248 # If `max_moitf=2` and `max_matches=3`, the result should contain
249 # (at most) two sets of motifs and each motif set should contain
250 # (at most) the top three matches
251 T = np.array(
252 [
253 0.0, # motif A
254 1.0,
255 0.0,
256 2.3,
257 -1.0, # motif B
258 -1.0,
259 -2.0,
260 0.0, # motif A
261 1.0,
262 0.0,
263 -2.0,
264 -1.0, # motif B
265 -1.03,
266 -2.0,
267 -0.5,
268 2.0, # motif A
269 3.0,
270 2.04,
271 2.3,
272 2.0, # motif A
273 3.0,
274 3.0,
275 ]
276 )
277 m = 3
278 max_motifs = 2
279 max_matches = 3
280
281 left_indices = [[0, 7], [4, 11]]
282 left_profile_values = [
283 [0.0, 0.0],
284 [
285 0.0,
286 naive.distance(
287 core.z_norm(T[left_indices[1][0] : left_indices[1][0] + m]),
288 core.z_norm(T[left_indices[1][1] : left_indices[1][1] + m]),
289 ),
290 ],
291 ]
292
293 mp = naive.stump(T, m)
294 right_distance_values, right_indices = motifs(
295 T,
296 mp[:, 0],
297 max_motifs=max_motifs,
298 max_matches=max_matches,
299 max_distance=0.05,
300 cutoff=np.inf,
301 )

Callers

nothing calls this directly

Calls 1

motifsFunction · 0.90

Tested by

no test coverage detected