class_docstr: Aligner interface for dtw-python.
  
  Behaviour: computes the full alignment between X[0] and X[1]
      assumes pairwise alignment (only two series) and univariate
      if multivariate series are passed:
      alignment is computed on univariate series with variable_to_align;
      if this is not set, defaults to the first variable of X[0]
      raises an error if variable_to_align is not present in X[0] or X[1]
  
  Parameters
  ----------
  dist_method : str, optional, default = "euclidean"
      distance function to use, a distance on real n-space
      one of the functions in `scipy.spatial.distance.cdist`
  step_pattern : str, optional, or dtw_python stepPattern object, optional
      step pattern to use in time warping
      one of: 'symmetric1', 'symmetric2' (default), 'asymmetric',
      and dozens of other more non-standard step patterns;
      list can be displayed by calling help(stepPattern) in dtw
  window_type : string, the chosen windowing function
      "none", "itakura", "sakoechiba", or "slantedband"
      "none" (default) - no windowing
      "sakoechiba" - a band around main diagonal
      "slantedband" - a band around slanted diagonal
      "itakura" - Itakura parallelogram
  open_begin : boolean, optional, default=False
  open_end: boolean, optional, default=False
      whether to perform open-ended alignments
      open_begin = whether alignment open ended at start (low index)
      open_end = whether alignment open ended at end (high index)
  variable_to_align : string, default = first variable in X[0] as passed to fit
      which variable to use for univariate alignment
class_docstr_tok: ["Aligner","interface","for","dtw-python",".","Behaviour",":","computes","the","full","alignment","between","X","[","0","]","and","X","[","1","]","assumes","pairwise","alignment","(","only","two","series",")","and","univariate","if","multivariate","series","are","passed",":","alignment","is","computed","on","univariate","series","with","variable_to_align",";","if","this","is","not","set",",","defaults","to","the","first","variable","of","X","[","0","]","raises","an","error","if","variable_to_align","is","not","present","in","X","[","0","]","or","X","[","1","]","Parameters","--","--","--","--","--","dist_method",":","str",",","optional",",","default","=","``","euclidean","''","distance","function","to","use",",","a","distance","on","real","n-space","one","of","the","functions","in","`","scipy.spatial.distance.cdist","`","step_pattern",":","str",",","optional",",","or","dtw_python","stepPattern","object",",","optional","step","pattern","to","use","in","time","warping","one","of",":","'symmetric1","'",",","'symmetric2","'","(","default",")",",","'asymmetric","'",",","and","dozens","of","other","more","non-standard","step","patterns",";","list","can","be","displayed","by","calling","help","(","stepPattern",")","in","dtw","window_type",":","string",",","the","chosen","windowing","function","``","none","''",",","``","itakura","''",",","``","sakoechiba","''",",","or","``","slantedband","''","``","none","''","(","default",")","-","no","windowing","``","sakoechiba","''","-","a","band","around","main","diagonal","``","slantedband","''","-","a","band","around","slanted","diagonal","``","itakura","''","-","Itakura","parallelogram","open_begin",":","boolean",",","optional",",","default=False","open_end",":","boolean",",","optional",",","default=False","whether","to","perform","open-ended","alignments","open_begin","=","whether","alignment","open","ended","at","start","(","low","index",")","open_end","=","whether","alignment","open","ended","at","end","(","high","index",")","variable_to_align",":","string",",","default","=","first","variable","in","X","[","0","]","as","passed","to","fit","which","variable","to","use","for","univariate","alignment"]
docstr: Fit alignment given series/sequences to align.
  
      core logic
  
  Writes to self:
      alignment : computed alignment from dtw package (nested struct)
  
  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
docstr_tok: ["Fit","alignment","given","series\/sequences","to","align",".","core","logic","Writes","to","self",":","alignment",":","computed","alignment","from","dtw","package","(","nested","struct",")","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
  
      Writes to self:
          alignment : computed alignment from dtw package (nested struct)
  
      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
      """
      # soft dependency import of dtw
      from dtw import dtw
  
      # these variables from self are accessed
      dist_method = self.dist_method
      step_pattern = self.step_pattern
      window_type = self.window_type
      open_begin = self.open_begin
      open_end = self.open_end
      var_to_align = self.variable_to_align
  
      # shorthands for 1st and 2nd series
      XA = X[0]
      XB = X[1]
  
      # retrieve column to align from data frames, convert to np.array
      if var_to_align is None:
          var_to_align = XA.columns.values[0]
  
      if var_to_align not in XA.columns.values:
          raise ValueError(
              f"X[0] does not have variable {var_to_align} used for alignment"
          )
      if var_to_align not in XB.columns.values:
          raise ValueError(
              f"X[1] does not have variable {var_to_align} used for alignment"
          )
  
      XA_np = XA[var_to_align].values
      XB_np = XB[var_to_align].values
  
      # pass to the interfaced dtw function and store to self
      alignment = dtw(
          XA_np,
          XB_np,
          dist_method=dist_method,
          step_pattern=step_pattern,
          window_type=window_type,
          open_begin=open_begin,
          open_end=open_end,
          keep_internals=True,
      )
  
      self.alignment_ = alignment
      self.variable_to_align_ = var_to_align  # changed only if was None
  
      return self
  
file_path: sktime/sktime/alignment/dtw_python.py
imports: import numpy
  import pandas
  from sktime.alignment.base import BaseAligner
label_desc: Use image node_id 2 for calling the AlignerDTW obj's underlying member method code with example usage: obj._fit(X, Z) and returns: self