class_docstr: Alignment path based on lucky dynamic time warping distance.
  
  This aligner returns the alignment path produced by the lucky time warping
  distance [1]_.
  Uses Euclidean distance for multivariate data.
  
  Based on code by Krisztian A Buza's research group.
  
  Parameters
  ----------
  window: int, optional (default=None)
      Maximum distance between indices of aligned series, aka warping window.
      If None, defaults to max(len(ts1), len(ts2)), i.e., no warping window.
  
  References
  ----------
  ..[1] Stephan Spiegel, Brijnesh-Johannes Jain, and Sahin Albayrak.
      Fast time series classification under lucky time warping distance.
      Proceedings of the 29th Annual ACM Symposium on Applied Computing. 2014.
docstr: Fit alignment given series/sequences to align.
  
      core logic
  
  Parameters
  ----------
  X: list of pd.DataFrame (sequence) of length n - panel of series to align
  Z: pd.DataFrame with n rows, optional; metadata, row correspond to indices of X
code: def _fit(self, X, Z=None):
      """Fit alignment given series/sequences to align.
  
          core logic
  
      Parameters
      ----------
      X: list of pd.DataFrame (sequence) of length n - panel of series to align
      Z: pd.DataFrame with n rows, optional; metadata, row correspond to indices of X
      """
      window = self.window
  
      ts1, ts2 = X
      ts1 = ts1.values
      ts2 = ts2.values
  
      len_ts1 = len(ts1)
      len_ts2 = len(ts2)
  
      if window is None:
          window = max(len_ts1, len_ts2)
  
      def vec_dist(x):
          return np.linalg.norm(x) ** 2
  
      d = vec_dist(ts1[0] - ts2[0])
  
      i = 0
      j = 0
      align_i = [i]
      align_j = [j]
  
      while i + 1 < len_ts1 or j + 1 < len_ts2:
          d_best = np.inf
  
          if i + 1 < len_ts1 and j + 1 < len_ts2:
              d_best = vec_dist(ts1[i + 1] - ts2[j + 1])
              new_i = i + 1
              new_j = j + 1
  
          if i + 1 < len_ts1 and abs(i + 1 - j) <= window:
              d1 = vec_dist(ts1[i + 1] - ts2[j])
              if d1 < d_best:
                  d_best = d1
                  new_i = i + 1
                  new_j = j
  
          if j + 1 < len_ts2 and abs(j + 1 - i) <= window:
              d2 = vec_dist(ts1[i] - ts2[j + 1])
              if d2 < d_best:
                  d_best = d2
                  new_i = i
                  new_j = j + 1
  
          d = d + d_best
          i = new_i
          j = new_j
          align_i = align_i + [i]
          align_j = align_j + [j]
  
      self.align_i_ = align_i
      self.align_j_ = align_j
      self.dist_ = d
  
      return self
  
file_path: sktime/sktime/alignment/lucky.py
imports: import numpy
  import pandas
  from sktime.alignment.base import BaseAligner
label_desc: Use image node_id 2 for calling the AlignerLuckyDtw obj's underlying member method code with example usage: obj._fit(X, Z) and returns: self, unknown