A matrix profile convenience class that subclasses the numpy ndarray Parameters ---------- cls : class The base class input_array : ndarray The input `numpy` array to be subclassed m : int Window size k : int The number of top `k` smal
| 2 | |
| 3 | |
| 4 | class mparray(np.ndarray): |
| 5 | """ |
| 6 | A matrix profile convenience class that subclasses the numpy ndarray |
| 7 | |
| 8 | Parameters |
| 9 | ---------- |
| 10 | cls : class |
| 11 | The base class |
| 12 | |
| 13 | input_array : ndarray |
| 14 | The input `numpy` array to be subclassed |
| 15 | |
| 16 | m : int |
| 17 | Window size |
| 18 | |
| 19 | k : int |
| 20 | The number of top `k` smallest distances used to construct the |
| 21 | matrix profile. |
| 22 | |
| 23 | excl_zone_denom : int |
| 24 | The denominator used in computing the exclusion zone |
| 25 | |
| 26 | Attributes |
| 27 | ---------- |
| 28 | P_ : numpy.ndarray |
| 29 | The (top-k) matrix profile for `T`. When `k=1`, the first |
| 30 | (and only) column in this 2D array, which consists of the matrix profile, |
| 31 | is returned. When `k > 1`, the output has exactly `k` columns consisting of |
| 32 | the top-k matrix profile. |
| 33 | |
| 34 | I_ : numpy.ndarray |
| 35 | The(top-k) matrix profile indices for `T`. When `k=1`, the first |
| 36 | (and only) column in this 2D array, which consists of the matrix profile, |
| 37 | indices is returned. When `k > 1`, the output has exactly `k` columns |
| 38 | consisting of the top-k matrix profile indices. |
| 39 | |
| 40 | left_I_ : numpy.ndarray |
| 41 | The left (top-1) matrix profile indices for `T` |
| 42 | |
| 43 | right_I_ : numpy.ndarray |
| 44 | The right (top-1) matrix profile indices for `T` |
| 45 | """ |
| 46 | |
| 47 | def __new__(cls, input_array, m, k, excl_zone_denom): |
| 48 | """ |
| 49 | Create the ndarray instance of our type, given the usual |
| 50 | ndarray input arguments. This will call the standard |
| 51 | ndarray constructor, but return an object of our type. |
| 52 | It also triggers a call mparray.__array_finalize__ |
| 53 | |
| 54 | Parameters |
| 55 | ---------- |
| 56 | cls : class |
| 57 | The base class |
| 58 | |
| 59 | input_array : ndarray |
| 60 | The input `numpy` array to be subclassed |
| 61 |
no outgoing calls