pycvi.dist.f_pdist
- pycvi.dist.f_pdist(cluster: numpy.ndarray, dist_kwargs: dict = {}) numpy.ndarray
Pairwise distances within a group of elements.
The user can provide a custom callable together with its kwargs in the
dist_kwargsparameter. To provide a callable, use the key"CALLABLE", otherwise the default distance function will be used, which depends on the type of data (time series or static).In the case of static data
Calls scipy.spatial.distance.pdist, which offers a wide range of distances and parameters, all of them described in scipy.spatial.distance.pdist.
By default, PyCVI relies on scipy’s default parameters, which means that the actual distance used is the euclidean distance.
In the case of time series data
Calls aeon.distances.pairwise_distance which offers a wide range of distances and parameters. See aeon.distances for an overview of the distance functions available in aeon as well as their parameters. For each available distance function, you can also use a short name as described in aeon.distances.get_pairwise_distance_function.
For example,
dist_kwargscan include parameters such aswindoworitakura_max_slopeif DTW (see aeon.distances.dtw_pairwise_distance) or MSM distances are used (see aeon.distances.msm_pairwise_distance).By default, PyCVI uses the following
dist_kwargsvalue:{"method" : "msm"}, which means that the actual distance used is MSM, implemented in aeon in the aeon.distances.msm_pairwise_distance function. Seepycvi.config.default_ts_distance_kwargs()for more information about default distance kwargs used in PyCVI.- param cluster:
A cluster of
Ndatapoints.- type cluster:
np.ndarray, shape
(N, d)or(N, w, d)ifts_dist=True.- param dist_kwargs:
Additional kwargs for the distance function.
- type dist_kwargs:
dict, optional
- returns:
The pairwise distance within the cluster (a condensed matrix).
- rtype:
np.ndarray
- raises ShapeError:
Raised if cluster doesn’t have the shape
(N, d)or(N, w, d). Seepycvi.config.set_data_shape()for more information on acceptable shapes.