class_docstr: ShapeDTW classifier.
  
  ShapeDTW[1] works by initially extracting a set of subsequences
  describing local neighbourhoods around each data point in a time series.
  These subsequences are then passed into a shape descriptor function that
  transforms these local neighbourhoods into a new representation. This
  new representation is then sent into DTW with 1-NN.
  
  Parameters
  ----------
  n_neighbours                : int, int, set k for knn (default =1).
  subsequence_length          : int, defines the length of the
                                subsequences(default=sqrt(n_timepoints)).
  
  shape_descriptor_function   : string, defines the function to describe
                                the set of subsequences
                                (default = 'raw').
  
  
  The possible shape descriptor functions are as follows:
  
      - 'raw'                 : use the raw subsequence as the
                                shape descriptor function.
                              - params = None
  
      - 'paa'                 : use PAA as the shape descriptor function.
                              - params = num_intervals_paa (default=8)
  
      - 'dwt'                 : use DWT (Discrete Wavelet Transform)
                                as the shape descriptor function.
                              - params = num_levels_dwt (default=3)
  
      - 'slope'               : use the gradient of each subsequence
                                fitted by a total least squares
                                regression as the shape descriptor
                                function.
                              - params = num_intervals_slope (default=8)
  
      - 'derivative'          : use the derivative of each subsequence
                                as the shape descriptor function.
                              - params = None
  
      - 'hog1d'               : use a histogram of gradients in one
                                dimension as the shape descriptor
                                function.
                              - params = num_intervals_hog1d
                                                  (default=2)
                                       = num_bins_hod1d
                                                  (default=8)
                                       = scaling_factor_hog1d
                                                  (default=0.1)
  
      - 'compound'            : use a combination of two shape
                                descriptors simultaneously.
                              - params = weighting_factor
                                        (default=None)
                                         Defines how to scale
                                         values of a shape
                                         descriptor.
                                         If a value is not given,
                                         this value is tuned
                                         by 10-fold cross-validation
                                         on the training data.
  
  
  shape_descriptor_functions  : string list, only applicable when the
                                shape_descriptor_function is
                                set to 'compound'.
                                Use a list of shape descriptor
                                functions at the same time.
                                (default = ['raw','derivative'])
  
  metric_params               : dictionary for metric parameters
                                (default = None).
  
  Notes
  -----
  .. [1] Jiaping Zhao and Laurent Itti, "shapeDTW: Shape Dynamic Time Warping",
      Pattern Recognition, 74, pp 171-184, 2018
      http://www.sciencedirect.com/science/article/pii/S0031320317303710,
class_docstr_tok: ["ShapeDTW","classifier",".","ShapeDTW","[","1","]","works","by","initially","extracting","a","set","of","subsequences","describing","local","neighbourhoods","around","each","data","point","in","a","time","series",".","These","subsequences","are","then","passed","into","a","shape","descriptor","function","that","transforms","these","local","neighbourhoods","into","a","new","representation",".","This","new","representation","is","then","sent","into","DTW","with","1-NN",".","Parameters","--","--","--","--","--","n_neighbours",":","int",",","int",",","set","k","for","knn","(","default","=1",")",".","subsequence_length",":","int",",","defines","the","length","of","the","subsequences","(","default=sqrt","(","n_timepoints",")",")",".","shape_descriptor_function",":","string",",","defines","the","function","to","describe","the","set","of","subsequences","(","default","=","'raw","'",")",".","The","possible","shape","descriptor","functions","are","as","follows",":","-","'raw","'",":","use","the","raw","subsequence","as","the","shape","descriptor","function",".","-","params","=","None","-","'paa","'",":","use","PAA","as","the","shape","descriptor","function",".","-","params","=","num_intervals_paa","(","default=8",")","-","'dwt","'",":","use","DWT","(","Discrete","Wavelet","Transform",")","as","the","shape","descriptor","function",".","-","params","=","num_levels_dwt","(","default=3",")","-","'slope","'",":","use","the","gradient","of","each","subsequence","fitted","by","a","total","least","squares","regression","as","the","shape","descriptor","function",".","-","params","=","num_intervals_slope","(","default=8",")","-","'derivative","'",":","use","the","derivative","of","each","subsequence","as","the","shape","descriptor","function",".","-","params","=","None","-","'hog1d","'",":","use","a","histogram","of","gradients","in","one","dimension","as","the","shape","descriptor","function",".","-","params","=","num_intervals_hog1d","(","default=2",")","=","num_bins_hod1d","(","default=8",")","=","scaling_factor_hog1d","(","default=0.1",")","-","'compound","'",":","use","a","combination","of","two","shape","descriptors","simultaneously",".","-","params","=","weighting_factor","(","default=None",")","Defines","how","to","scale","values","of","a","shape","descriptor",".","If","a","value","is","not","given",",","this","value","is","tuned","by","10-fold","cross-validation","on","the","training","data",".","shape_descriptor_functions",":","string","list",",","only","applicable","when","the","shape_descriptor_function","is","set","to","'compound","'",".","Use","a","list","of","shape","descriptor","functions","at","the","same","time",".","(","default","=","[","'raw","'",",","'derivative","'","]",")","metric_params",":","dictionary","for","metric","parameters","(","default","=","None",")",".","Notes","--","--","-","..","[","1","]","Jiaping","Zhao","and","Laurent","Itti",",","``","shapeDTW",":","Shape","Dynamic","Time","Warping","''",",","Pattern","Recognition",",","74",",","pp","171-184",",","2018","http",":","\/\/www.sciencedirect.com\/science\/article\/pii\/S0031320317303710",","]
docstr: Extract the appropriate transformer.
  
  Parameters
  ----------
  self   : the ShapeDTW object.
  tName  : the name of the required transformer.
  
  Returns
  -------
  output : Base Transformer object corresponding to the class
           (or classes if its a compound transformer) of the
           required transformer. The transformer is
           configured with the parameters given in self.metric_params.
  
  throws : ValueError if a shape descriptor doesn't exist.
docstr_tok: ["Extract","the","appropriate","transformer",".","Parameters","--","--","--","--","--","self",":","the","ShapeDTW","object",".","tName",":","the","name","of","the","required","transformer",".","Returns","--","--","--","-","output",":","Base","Transformer","object","corresponding","to","the","class","(","or","classes","if","its","a","compound","transformer",")","of","the","required","transformer",".","The","transformer","is","configured","with","the","parameters","given","in","self.metric_params",".","throws",":","ValueError","if","a","shape","descriptor","does","n't","exist","."]
code: def _get_transformer(self, tName):
      """Extract the appropriate transformer.
  
      Parameters
      ----------
      self   : the ShapeDTW object.
      tName  : the name of the required transformer.
  
      Returns
      -------
      output : Base Transformer object corresponding to the class
               (or classes if its a compound transformer) of the
               required transformer. The transformer is
               configured with the parameters given in self.metric_params.
  
      throws : ValueError if a shape descriptor doesn't exist.
      """
      parameters = self.metric_params
  
      tName = tName.lower()
  
      if parameters is None:
          parameters = {}
  
      parameters = {k.lower(): v for k, v in parameters.items()}
  
      self._check_metric_params(parameters)
  
      if tName == "raw":
          return None
      elif tName == "paa":
          num_intervals = parameters.get("num_intervals_paa")
          if num_intervals is None:
              return PAA()
          return PAA(num_intervals)
      elif tName == "dwt":
          num_levels = parameters.get("num_levels_dwt")
          if num_levels is None:
              return DWTTransformer()
          return DWTTransformer(num_levels)
      elif tName == "slope":
          num_intervals = parameters.get("num_intervals_slope")
          if num_intervals is None:
              return SlopeTransformer()
          return SlopeTransformer(num_intervals)
      elif tName == "derivative":
          return DerivativeSlopeTransformer()
      elif tName == "hog1d":
          num_intervals = parameters.get("num_intervals_hog1d")
          num_bins = parameters.get("num_bins_hog1d")
          scaling_factor = parameters.get("scaling_factor_hog1d")
  
          # All 3 parameters are None
          if (
              num_intervals is None
              and num_bins is None
              and scaling_factor is None
          ):
              return HOG1DTransformer()
  
          # 2 parameters are None
          if num_intervals is None and num_bins is None:
              return HOG1DTransformer(scaling_factor=scaling_factor)
          if num_intervals is None and scaling_factor is None:
              return HOG1DTransformer(num_bins=num_bins)
          if num_bins is None and scaling_factor is None:
              return HOG1DTransformer(num_intervals=num_intervals)
  
          # 1 parameter is None
          if num_intervals is None:
              return HOG1DTransformer(
                  scaling_factor=scaling_factor, num_bins=num_bins
              )
          if scaling_factor is None:
              return HOG1DTransformer(
                  num_intervals=num_intervals, num_bins=num_bins
              )
          if num_bins is None:
              return HOG1DTransformer(
                  scaling_factor=scaling_factor,
                  num_intervals=num_intervals,
              )
  
          # All parameters are given
          return HOG1DTransformer(
              num_intervals=num_intervals,
              num_bins=num_bins,
              scaling_factor=scaling_factor,
          )
      else:
          raise ValueError("Invalid shape descriptor function.")
  
imports: import numpy
  import pandas
  from sklearn.model_selection import GridSearchCV, KFold
  from sktime.classification.base import BaseClassifier
  from sktime.classification.distance_based._time_series_neighbors import KNeighborsTimeSeriesClassifier
  from sktime.datatypes import convert
  from sktime.transformations.panel.dictionary_based._paa import PAA
  from sktime.transformations.panel.dwt import DWTTransformer
  from sktime.transformations.panel.hog1d import HOG1DTransformer
  from sktime.transformations.panel.segment import SlidingWindowSegmenter
  from sktime.transformations.panel.slope import SlopeTransformer
  from sktime.transformations.panel.summarize._extract import DerivativeSlopeTransformer
label_desc: Use image node_id 8 for calling the ShapeDTW obj's underlying member method code with example usage: obj._get_transformer(tName) and returns: None, PAA, PAA, DWTTransformer, DWTTransformer, SlopeTransformer, SlopeTransformer, DerivativeSlopeTransformer, HOG1DTransformer, HOG1DTransformer, HOG1DTransformer, HOG1DTransformer, HOG1DTransformer, HOG1DTransformer, HOG1DTransformer, HOG1DTransformer