Transformer (Pairwise Panel)
CombinedDistance
Distances combined via arithmetic operation, e.g., addition, multiplication.
Quickstart
python
from sktime.dists_kernels.algebra import CombinedDistance
estimator = CombinedDistance(pw_trafos, operation=None)Parameters(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
Examples
>>> 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)