class_docstr: Elbow Class Sum (ECS) transformer to select a subset of channels/variables.
  
  Overview: From the input of multivariate time series data, create a distance
  matrix [1] by calculating the distance between each class centroid. The
  ECS selects the subset of channels using the elbow method, which maximizes the
  distance between the class centroids by aggregating the distance for every
  class pair across each channel.
  
  Note: Channels, variables, dimensions, features are used interchangeably in
  literature. E.g., channel selection = variable selection.
  
  Parameters
  ----------
  distance: sktime pairwise panel transform, str, or callable, optional, default=None
      if panel transform, will be used directly as the distance in the algorithm
      default None = euclidean distance on flattened series, FlatDist(ScipyDist())
      if str, will behave as FlatDist(ScipyDist(distance)) = scipy dist on flat series
      if callable, must be univariate nested_univ x nested_univ -> 2D float np.array
  
  Attributes
  ----------
  channels_selected_ : list of integer
      List of variables/channels selected by the estimator
      integers (iloc reference), referring to variables/channels by order
  channels_selected_idx_ : list of pandas compatible index elements
      List of variables/channels selected by the estimator
      if data are index-less (no channel/var names), identical to channels_selected
  distance_frame_ : DataFrame
      distance matrix of the class centroids pair and channels.
          ``shape = [n_channels, n_class_centroids_pairs]``
      Table 1 provides an illustration in [1].
  train_time_ : int
      Time taken to train the ECS.
  
  Notes
  -----
  Original repository: https://github.com/mlgig/Channel-Selection-MTSC
  
  References
  ----------
  ..[1]: Bhaskar Dhariyal et al. "Fast Channel Selection for Scalable Multivariate
  Time Series Classification." AALTD, ECML-PKDD, Springer, 2021
  
  Examples
  --------
  >>> from sktime.transformations.panel.channel_selection import ElbowClassSum
  >>> from sktime.utils._testing.panel import make_classification_problem
  >>> X, y = make_classification_problem(n_columns=3, n_classes=3, random_state=42)
  >>> cs = ElbowClassSum()
  >>> cs.fit(X, y)
  ElbowClassSum(...)
  >>> Xt = cs.transform(X)
  
  Any sktime compatible distance can be used, e.g., DTW distance:
  
  >>> from sktime.dists_kernels import DtwDist
  >>>
  >>> cs = ElbowClassSum(distance=DtwDist())
  >>> cs.fit(X, y)
  ElbowClassSum(...)
  >>> Xt = cs.transform(X)
class_docstr_tok: ["Elbow","Class","Sum","(","ECS",")","transformer","to","select","a","subset","of","channels\/variables",".","Overview",":","From","the","input","of","multivariate","time","series","data",",","create","a","distance","matrix","[","1","]","by","calculating","the","distance","between","each","class","centroid",".","The","ECS","selects","the","subset","of","channels","using","the","elbow","method",",","which","maximizes","the","distance","between","the","class","centroids","by","aggregating","the","distance","for","every","class","pair","across","each","channel",".","Note",":","Channels",",","variables",",","dimensions",",","features","are","used","interchangeably","in","literature",".","E.g.",",","channel","selection","=","variable","selection",".","Parameters","--","--","--","--","--","distance",":","sktime","pairwise","panel","transform",",","str",",","or","callable",",","optional",",","default=None","if","panel","transform",",","will","be","used","directly","as","the","distance","in","the","algorithm","default","None","=","euclidean","distance","on","flattened","series",",","FlatDist","(","ScipyDist","(",")",")","if","str",",","will","behave","as","FlatDist","(","ScipyDist","(","distance",")",")","=","scipy","dist","on","flat","series","if","callable",",","must","be","univariate","nested_univ","x","nested_univ","-",">","2D","float","np.array","Attributes","--","--","--","--","--","channels_selected_",":","list","of","integer","List","of","variables\/channels","selected","by","the","estimator","integers","(","iloc","reference",")",",","referring","to","variables\/channels","by","order","channels_selected_idx_",":","list","of","pandas","compatible","index","elements","List","of","variables\/channels","selected","by","the","estimator","if","data","are","index-less","(","no","channel\/var","names",")",",","identical","to","channels_selected","distance_frame_",":","DataFrame","distance","matrix","of","the","class","centroids","pair","and","channels",".","``","shape","=","[","n_channels",",","n_class_centroids_pairs","]","``","Table","1","provides","an","illustration","in","[","1","]",".","train_time_",":","int","Time","taken","to","train","the","ECS",".","Notes","--","--","-","Original","repository",":","https",":","\/\/github.com\/mlgig\/Channel-Selection-MTSC","References","--","--","--","--","--","..","[","1","]",":","Bhaskar","Dhariyal","et","al",".","``","Fast","Channel","Selection","for","Scalable","Multivariate","Time","Series","Classification",".","''","AALTD",",","ECML-PKDD",",","Springer",",","2021","Examples","--","--","--","--",">",">",">","from","sktime.transformations.panel.channel_selection","import","ElbowClassSum",">",">",">","from","sktime.utils._testing.panel","import","make_classification_problem",">",">",">","X",",","y","=","make_classification_problem","(","n_columns=3",",","n_classes=3",",","random_state=42",")",">",">",">","cs","=","ElbowClassSum","(",")",">",">",">","cs.fit","(","X",",","y",")","ElbowClassSum","(","...",")",">",">",">","Xt","=","cs.transform","(","X",")","Any","sktime","compatible","distance","can","be","used",",","e.g.",",","DTW","distance",":",">",">",">","from","sktime.dists_kernels","import","DtwDist",">",">",">",">",">",">","cs","=","ElbowClassSum","(","distance=DtwDist","(",")",")",">",">",">","cs.fit","(","X",",","y",")","ElbowClassSum","(","...",")",">",">",">","Xt","=","cs.transform","(","X",")"]
docstr: Transform X and return a transformed version.
  
  Parameters
  ----------
  X : pandas DataFrame or np.ndarray
      The input data to transform.
  
  Returns
  -------
  output : pandas DataFrame
      X with a subset of channels
docstr_tok: ["Transform","X","and","return","a","transformed","version",".","Parameters","--","--","--","--","--","X",":","pandas","DataFrame","or","np.ndarray","The","input","data","to","transform",".","Returns","--","--","--","-","output",":","pandas","DataFrame","X","with","a","subset","of","channels"]
code: def _transform(self, X, y=None):
      """Transform X and return a transformed version.
  
      Parameters
      ----------
      X : pandas DataFrame or np.ndarray
          The input data to transform.
  
      Returns
      -------
      output : pandas DataFrame
          X with a subset of channels
      """
      return X[self.channels_selected_idx_]
  
imports: import itertools
  import time
  import numpy
  import pandas
  from sklearn.neighbors import NearestCentroid
  from sktime.datatypes import convert
  from sktime.datatypes._panel._convert import from_3d_numpy_to_nested
  from sktime.transformations.base import BaseTransformer
label_desc: Use image node_id 3 for calling the ElbowClassSum obj's underlying member method code with example usage: obj._transform(X, y) and returns: X