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

Function aampdist_vect

tests/naive.py:1444–1464  ·  view source on GitHub ↗
(T_A, T_B, m, percentage=0.05, k=None, p=2.0)

Source from the content-addressed store, hash-verified

1442
1443
1444def aampdist_vect(T_A, T_B, m, percentage=0.05, k=None, p=2.0):
1445 n_A = T_A.shape[0]
1446 n_B = T_B.shape[0]
1447 j = n_A - m + 1 # `k` is reserved for `P_ABBA` selection
1448 P_ABBA = np.empty(2 * j, dtype=np.float64)
1449 aaMPdist_vect = np.empty(n_B - n_A + 1)
1450
1451 if k is None:
1452 percentage = min(percentage, 1.0)
1453 percentage = max(percentage, 0.0)
1454 k = min(math.ceil(percentage * (2 * n_A)), 2 * j - 1)
1455
1456 k = min(int(k), P_ABBA.shape[0] - 1)
1457
1458 for i in range(n_B - n_A + 1):
1459 P_ABBA[:j] = aamp(T_A, m, T_B[i : i + n_A], p=p)[:, 0]
1460 P_ABBA[j:] = aamp(T_B[i : i + n_A], m, T_A, p=p)[:, 0]
1461 P_ABBA.sort()
1462 aaMPdist_vect[i] = P_ABBA[k]
1463
1464 return aaMPdist_vect
1465
1466
1467def mpdist(

Callers 1

Calls 1

aampFunction · 0.70

Tested by

no test coverage detected