class_docstr: Use distances to training series as features.
  
  In `transform`, returns tabular features as follows:
  for `i`-th series in `X`, returns all distances to series seen in `fit`
  `j` th column of `i`-th row is distance between `i`-th series in `transform`,
  and `j`-the series in `fit`. Column index is instance index in `fit`.
  If `fit` series was `Hierarchical`, hierarchy index is preserved.
  
  Parameters
  ----------
  distance: sktime pairwise panel transform, str, or callable, optional, default=None
      if panel transform, will be used directly as the distance in the algorithm
      default None = euclidean distance on flattened series, FlatDist(ScipyDist())
      if str, will behave as FlatDist(ScipyDist(distance)) = scipy dist on flat series
      if callable, must be distance_mtype x distance_mtype -> 2D float np.array
  distance_mtype : str, or list of str optional. default = None.
      mtype that distance expects for X and X2, if a callable
      only set this if distance is not BasePairwiseTransformerPanel descendant
  flatten_hierarchy : bool, optional, default=False.
      whether column hierarchy in `transform` return is flattened (using `__` concat),
      in case of a hierarchical series index seen in `fit`.
  
  Examples
  --------
  >>> from sktime.datasets import load_unit_test
  >>> from sktime.transformations.panel.compose_distance import DistanceFeatures
  >>> X_train, _ = load_unit_test(return_X_y=True, split="train")
  >>> X, _ = load_unit_test(return_X_y=True, split="test")
  >>> trafo = DistanceFeatures()
  >>> trafo.fit(X_train)
  DistanceFeatures(...)
  >>> Xt = trafo.transform(X)
code: def __init__(
      self, distance=None, distance_mtype=None, flatten_hierarchy=False
  ):
      self.distance = distance
      self.distance_mtype = distance_mtype
      self.flatten_hierarchy = flatten_hierarchy
  
      super().__init__()
  
      from sktime.dists_kernels import (
          BasePairwiseTransformerPanel,
          FlatDist,
          ScipyDist,
      )
  
      if distance is None:
          self.distance_ = FlatDist(ScipyDist())
      elif isinstance(distance, str):
          self.distance_ = FlatDist(ScipyDist(metric=distance))
      elif isinstance(distance, BasePairwiseTransformerPanel):
          self.distance_ = distance.clone()
      else:
          self.distance_ = distance
  
      if distance_mtype is not None:
          self.set_tags(X_inner_mtype=distance_mtype)
  
imports: import pandas
  from sktime.transformations.base import BaseTransformer
  from sktime.utils.multiindex import flatten_multiindex
label_desc: Use image node_id 1 to create a new DistanceFeatures object from inherited base classes: BaseTransformer with example: obj = DistanceFeatures(distance, distance_mtype, flatten_hierarchy)