class_docstr: KNN Time Series Regressor.
  
  An adapted version of the scikit-learn KNeighborsRegressor for time series data.
  
  This class is a KNN regressor which supports time series distance measures.
  It has hardcoded string references to numba based distances in sktime.distances,
  and can also be used with callables, or sktime (pairwise transformer) estimators.
  
  Parameters
  ----------
  n_neighbors : int, set k for knn (default =1)
  weights : string or callable function, optional. default = 'uniform'
      mechanism for weighting a vot
      one of: 'uniform', 'distance', or a callable function
  algorithm : str, optional. default = 'brute'
      search method for neighbours
      one of {'auto', 'ball_tree', 'kd_tree', 'brute'}
  distance : str or callable, optional. default ='dtw'
      distance measure between time series
      if str, must be one of the following strings:
          'euclidean', 'squared', 'dtw', 'ddtw', 'wdtw', 'wddtw',
          'lcss', 'edr', 'erp', 'msm'
      this will substitute a hard-coded distance metric from sktime.distances
      When mpdist is used, the subsequence length (parameter m) must be set
          Example: knn_mpdist = KNeighborsTimeSeriesClassifier(
                              metric='mpdist', metric_params={'m':30})
      if callable, must be of signature (X: Panel, X2: Panel) -> np.ndarray
          output must be mxn array if X is Panel of m Series, X2 of n Series
          if distance_mtype is not set, must be able to take
              X, X2 which are pd_multiindex and numpy3D mtype
      can be pairwise panel transformer inheriting from BasePairwiseTransformerPanel
  distance_params : dict, optional. default = None.
      dictionary for metric parameters , in case that distane is a str
  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
  leaf_size : int, default=30
      Leaf size passed to BallTree or KDTree. This can affect the
      speed of the construction and query, as well as the memory required to store
      the tree. The optimal value depends on the nature of the problem.
  n_jobs : int, default=None
      The number of parallel jobs to run for neighbors search.
      ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
      ``-1`` means using all processors.
  
  Examples
  --------
  >>> from sktime.datasets import load_unit_test
  >>> from sktime.regression.distance_based import KNeighborsTimeSeriesRegressor
  >>> X_train, y_train = load_unit_test(return_X_y=True, split="train")
  >>> X_test, y_test = load_unit_test(return_X_y=True, split="test")
  >>> regressor = KNeighborsTimeSeriesRegressor()
  >>> regressor.fit(X_train, y_train)
  KNeighborsTimeSeriesRegressor(...)
  >>> y_pred = regressor.predict(X_test)
docstr: Compute distance - unified interface to str code and callable.
code: def _distance(self, X, X2):
      """Compute distance - unified interface to str code and callable."""
      distance = self.distance
      distance_params = self.distance_params
      if distance_params is None:
          distance_params = {}
  
      if isinstance(distance, str):
          return pairwise_distance(X, X2, distance, **distance_params)
      else:
          return distance(X, X2)
  
file_path: sktime/sktime/regression/distance_based/_time_series_neighbors.py
imports: from sklearn.neighbors import KNeighborsRegressor
  from sktime.distances import pairwise_distance
  from sktime.regression.base import BaseRegressor
label_desc: Use image node_id 2 for calling the KNeighborsTimeSeriesRegressor obj's underlying member method code with example usage: obj._distance(X, X2) and returns: pairwise_distance, distance