pycvi.dist.f_cdist
- pycvi.dist.f_cdist(clusterA: numpy.ndarray, clusterB: numpy.ndarray, dist_kwargs: dict = {}) numpy.ndarray
Distances between two (groups 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.cdist, which offers a wide range of distances and parameters, all of them described in scipy.spatial.distance.cdist.
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 clusterA:
A cluster of size NA.
- type clusterA:
np.ndarray
- param clusterB:
A cluster of size NB.
- type clusterB:
np.ndarray
- param dist_kwargs:
Additional kwargs for the distance function.
- type dist_kwargs:
dict, optional
- returns:
The pairwise distance matrix between the clusters.
- rtype:
np.ndarray, shape (NA, NB)
- raises ShapeError:
Raised if
clusterAorclusterBdon’t have the shape(N, d)or(N, w, d).