Zurück zu den Modellen
Transformer (Pairwise Panel)

CombinedDistance

Distances combined via arithmetic operation, e.g., addition, multiplication.

CombinedDistance creates a pairwise trafo from multiple other pairwise trafos, by performing an arithmetic operation (np.ufunc) on the multiple distance matrices.

For a list of transformers trafo1, trafo2, …, trafoN, ufunc operation, this compositor behaves as follows: transform(X, X2) - computes dist1 = trafo1.transform(X, X2),

dist2 = trafo2.transform(X, X2), …, distN = trafoN.transform(X, X2)`, all of shape (len(X), len(X2), then applies operation entry-wise, to obtain a single matrix dist of shape (len(X), len(X2) Example: if operation = np.sum, then dist is the entry-wise sum of dist1, dist2, …, distN

Schnellstart

python
from sktime.dists_kernels.algebra import CombinedDistance

estimator = CombinedDistance(pw_trafos, operation=None)

Parameter(2)

pw_trafoslist of sktime pairwise panel distances, or
list of tuples (str, transformer) of sktime pairwise panel distances distances combined to a single distance using the operation
operationNone, str, function, or numpy ufunc, optional, default = None = mean
if str, must be one of “mean”, “+” (add), “*” (multiply), “max”, “min” if func, must be of signature (1D iterable) -> float operation carried out on the distance matrices distances

Beispiele

>>> from sktime.dists_kernels.algebra import CombinedDistance
>>> from sktime.dists_kernels.dtw import DtwDist
>>> from sktime.datasets import load_unit_test
>>> 
>>> X, _ = load_unit_test ()
>>> X = X [0: 3 ]
>>> sum_dist = CombinedDistance ([DtwDist (), DtwDist (weighted = True)], "+")
>>> dist_mat = sum_dist. transform (X) the same can also be done more compactly using dunders:
>>> sum_dist = DtwDist () + DtwDist (weighted = True)
>>> dist_mat = sum_dist (X)