MCPcopy Index your code
hub / github.com/stumpy-dev/stumpy / aampdist

Function aampdist

tests/naive.py:1510–1530  ·  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

1508
1509
1510def aampdist(T_A, T_B, m, percentage=0.05, k=None, p=2.0):
1511 percentage = min(percentage, 1.0)
1512 percentage = max(percentage, 0.0)
1513 n_A = T_A.shape[0]
1514 n_B = T_B.shape[0]
1515 P_ABBA = np.empty(n_A - m + 1 + n_B - m + 1, dtype=np.float64)
1516 if k is not None:
1517 k = int(k)
1518 else:
1519 k = min(math.ceil(percentage * (n_A + n_B)), n_A - m + 1 + n_B - m + 1 - 1)
1520
1521 P_ABBA[: n_A - m + 1] = aamp(T_A, m, T_B, p=p)[:, 0]
1522 P_ABBA[n_A - m + 1 :] = aamp(T_B, m, T_A, p=p)[:, 0]
1523
1524 P_ABBA.sort()
1525 MPdist = P_ABBA[k]
1526 if ~np.isfinite(MPdist): # pragma: no cover
1527 k = np.isfinite(P_ABBA[:k]).sum() - 1
1528 MPdist = P_ABBA[k]
1529
1530 return MPdist
1531
1532
1533def get_all_mpdist_profiles(

Callers

nothing calls this directly

Calls 1

aampFunction · 0.70

Tested by

no test coverage detected