class_docstr: Naive strategies for multiple alignment.
  
  Naive strategies supported by this estimator are:
  
  * start: aligns starts (lowest index), does no squeezing/stretching
  * end: aligns ends (highest index), no squeezing/stretching
  * start-end: aligns starts and ends, stretches linearly and rounds
  
  Parameters
  ----------
  strategy: str, one of "start", "end", "start-end" (default)
      start: aligns starts (lowest index), does no squeezing/stretching
      end: aligns ends (highest index), no squeezing/stretching
      start-end: aligns starts and ends, stretches linearly and rounds
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
docstr_tok: ["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
      """
      strategy = self.strategy
  
      alignlen = np.max([len(Xi) for Xi in X])
      align = []
  
      for i, Xi in enumerate(X):
          col = "ind" + str(i)
          nXi = len(Xi)
  
          if strategy == "start":
              # indices are consecutive and padded at the end
              padl = alignlen - nXi
              vals = np.arange(nXi, dtype="object")
              vals = np.pad(vals, (0, padl), constant_values=np.nan)
              vals = pd.array(vals, dtype="Int64")
  
          elif strategy == "end":
              # indices are consecutive and padded at the start
              padl = alignlen - nXi
              vals = np.arange(nXi, dtype="object")
              vals = np.pad(vals, (padl, 0), constant_values=np.nan)
              vals = pd.array(vals, dtype="Int64")
  
          elif strategy == "start-end":
              # indices are linearly spaced to fill entire length and rounded
              vals = np.linspace(start=0, stop=nXi - 1, num=alignlen)
              vals = np.round(vals).astype("int64")
          else:
              raise ValueError(
                  "strategy must be one of 'start', 'end', or 'start-end'"
              )
  
          align = align + [pd.DataFrame({col: vals})]
  
      align = pd.concat(align, axis=1)
  
      self.align = align
  
      return self
  
file_path: sktime/sktime/alignment/naive.py
imports: import numpy
  import pandas
  from sktime.alignment.base import BaseAligner
label_desc: Use image node_id 2 for calling the AlignerNaive obj's underlying member method code with example usage: obj._fit(X, Z) and returns: self