class_docstr: Mixin for k-neighbors searches on Time Series.
code: def _precompute_cross_dist(self, X, other_X=None):
      if other_X is None:
          other_X = self._ts_fit
  
      self._ts_metric = self.metric
      self.metric = "precomputed"
  
      metric_params = self._get_metric_params()
  
      X = check_array(X, allow_nd=True, force_all_finite=False)
      X = to_time_series_dataset(X)
  
      if self._ts_metric == "dtw":
          X_ = cdist_dtw(
              X, other_X, n_jobs=self.n_jobs, **metric_params
          )
      elif self._ts_metric == "ctw":
          X_ = cdist_ctw(X, other_X, **metric_params)
      elif self._ts_metric == "softdtw":
          X_ = cdist_soft_dtw(X, other_X, **metric_params)
      elif self._ts_metric == "sax":
          X = self._sax_preprocess(X, **metric_params)
          X_ = cdist_sax(
              X,
              self._sax.breakpoints_avg_,
              self._sax._X_fit_dims_[1],
              other_X,
              n_jobs=self.n_jobs,
          )
      else:
          raise ValueError(
              "Invalid metric recorded: %s" % self._ts_metric
          )
  
      return X_
  
imports: import numpy
  from sklearn import neighbors
  from sklearn.neighbors import KNeighborsClassifier, NearestNeighbors, KNeighborsRegressor
  from sklearn.utils import check_array
  from sklearn.utils.validation import check_is_fitted
  from scipy.spatial.distance import cdist
  from tslearn.metrics import cdist_dtw, cdist_ctw, cdist_soft_dtw, cdist_sax, TSLEARN_VALID_METRICS
  from tslearn.piecewise import SymbolicAggregateApproximation
  from tslearn.utils import to_time_series_dataset, to_sklearn_dataset, check_dims
  from tslearn.bases import BaseModelPackage
label_desc: Use image node_id 3 for calling the KNeighborsTimeSeriesMixin obj's underlying member method code with example usage: obj._precompute_cross_dist(X, other_X) and returns: X_