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

Function _get_multi_p_norm

stumpy/maamp.py:549–588  ·  view source on GitHub ↗

Multi-dimensional wrapper to compute the p-norm between the query, `T[:, start:start+m])` and the time series, `T`. Additionally, compute p-norm for the first window. Parameters ---------- start : int The window index for T_B from which to calculate the QT dot produ

(start, T, m, p=2.0)

Source from the content-addressed store, hash-verified

547
548
549def _get_multi_p_norm(start, T, m, p=2.0):
550 """
551 Multi-dimensional wrapper to compute the p-norm between the
552 query, `T[:, start:start+m])` and the time series, `T`. Additionally, compute
553 p-norm for the first window.
554
555 Parameters
556 ----------
557 start : int
558 The window index for T_B from which to calculate the QT dot product
559
560 T : numpy.ndarray
561 The time series or sequence for which to compute the dot product
562
563 m : int
564 Window size
565
566 p : float
567 The p-norm to apply for computing the Minkowski distance. Minkowski distance is
568 typically used with `p` being 1 or 2, which correspond to the Manhattan distance
569 and the Euclidean distance, respectively.
570
571 Returns
572 -------
573 p_norm : numpy.ndarray
574 Given `start`, return the corresponding multi-dimensional p-norm
575
576 p_norm_first : numpy.ndarray
577 Multi-dimensional p-norm for the first window
578 """
579 d = T.shape[0]
580 l = T.shape[1] - m + 1
581
582 p_norm = np.empty((d, l), dtype=np.float64)
583 p_norm_first = np.empty((d, l), dtype=np.float64)
584 for i in range(d):
585 p_norm[i] = np.power(core.mass_absolute(T[i, start : start + m], T[i], p=p), p)
586 p_norm_first[i] = np.power(core.mass_absolute(T[i, :m], T[i], p=p), p)
587
588 return p_norm, p_norm_first
589
590
591@njit(

Callers 3

_dask_maampedFunction · 0.85
_ray_maampedFunction · 0.85
maampFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected