naive_distance_profile¶
- naive_distance_profile(X: ndarray | List, q: ndarray, mask: ndarray | List, distance_function, distance_args: dict | None = None) ndarray | List[source]¶
Compute a distance profile in a brute force way.
It computes the distance profiles between the input time series and the query using the specified distance. The search is made in a brute force way without any optimizations and can thus be slow.
A distance profile between a (univariate) time series \(X_i = {x_1, ..., x_m}\) and a query \(Q = {q_1, ..., q_m}\) is defined as a vector of size \(m-( l-1)\), such as \(P(X_i, Q) = {d(C_1, Q), ..., d(C_m-(l-1), Q)}\) with d the distance function, and \(C_j = {x_j, ..., x_{j+(l-1)}}\) the j-th candidate subsequence of size \(l\) in \(X_i\).
- Parameters:
- X: np.ndarray, 3D array of shape (n_cases, n_channels, n_timepoints)
The input samples. If X is an unquel length collection, expect a numba TypedList of 2D arrays of shape (n_channels, n_timepoints)
- qnp.ndarray, 2D array of shape (n_channels, query_length)
The query used for similarity search.
- masknp.ndarray, 3D array of shape (n_cases, n_channels, n_timepoints - query_length + 1) # noqa: E501
Boolean mask of the shape of the distance profile indicating for which part of it the distance should be computed. Should be a numba TypedList if X is unequal length.
- distance_functionfunc
A python function or a numba njit function used to compute the distance between two 1D vectors.
- distance_argsdict, default=None
Dictionary containing keywords arguments to use for the distance_function
- Returns:
- distance_profilesnp.ndarray
3D array of shape (n_cases, n_channels, n_timepoints - query_length + 1) The distance profile between q and the input time series X independently for each channel. Returns a TypedList if X is unequal length.