class_docstr: Supervised interval feature transformer.
  
  Extracts intervals in fit using the supervised process described in [1].
  Interval sub-series are extracted for each input feature, and the usefulness of that
  feature extracted on an interval is evaluated using the Fisher score metric.
  Intervals are continually split in half, with the better scoring half retained as a
  feature for the transform.
  
  Multivariate capability is added by running the supervised interval extraction
  process on each dimension of the input data.
  
  As the extracted interval features are already extracted for the supervised
  evaluation in fit, the fit_transform method is recommended if the transformed fit
  data is required.
  
  Parameters
  ----------
  n_intervals : int, default=50
      The number of times the supervised interval selection process is run.
      Each supervised extraction will output a varying amount of features based on
      series length, number of dimensions and the number of features.
  min_interval_length : int, default=3
      The minimum length of extracted intervals. Minimum value of 3.
  features : function with a single 2d array-like parameter or list of said functions,
          default=None
      Functions used to extract features from selected intervals. If None, defaults to
      the following statistics used in [2]:
      [mean, median, std, slope, min, max, iqr, count_mean_crossing,
      count_above_mean].
  randomised_split_point : bool, default=True
      If True, the split point for interval extraction is randomised as is done in [2]
      rather than split in half.
  n_jobs : int, default=1
      The number of jobs to run in parallel for both `fit` and `transform`.
      ``-1`` means using all processors.
  random_state : int or None, default=None
      Seed for random number generation.
  parallel_backend : str, ParallelBackendBase instance or None, default=None
      Specify the parallelisation backend implementation in joblib, if None a 'prefer'
      value of "threads" is used by default.
      Valid options are "loky", "multiprocessing", "threading" or a custom backend.
      See the joblib Parallel documentation for more details.
  
  Attributes
  ----------
  n_instances_ : int
      The number of train cases.
  n_dims_ : int
      The number of dimensions per case.
  series_length_ : int
      The length of each series.
  intervals_ : list of tuples
      Contains information for each feature extracted in fit. Each tuple contains the
      interval start, interval end, interval dimension and the feature extracted.
      Length will be the same as the amount of transformed features.
  
  See Also
  --------
  RandomIntervals
  
  Notes
  -----
  Based on the authors (stevcabello) code: https://github.com/stevcabello/r-STSF/
  
  References
  ----------
  .. [1] Cabello, N., Naghizade, E., Qi, J. and Kulik, L., 2020, November. Fast and
      accurate time series classification through supervised interval search. In 2020
      IEEE International Conference on Data Mining (ICDM) (pp. 948-953). IEEE.
  .. [2] Cabello, N., Naghizade, E., Qi, J. and Kulik, L., 2021. Fast, accurate and
      interpretable time series classification through randomization. arXiv preprint
      arXiv:2105.14876.
class_docstr_tok: ["Supervised","interval","feature","transformer",".","Extracts","intervals","in","fit","using","the","supervised","process","described","in","[","1","]",".","Interval","sub-series","are","extracted","for","each","input","feature",",","and","the","usefulness","of","that","feature","extracted","on","an","interval","is","evaluated","using","the","Fisher","score","metric",".","Intervals","are","continually","split","in","half",",","with","the","better","scoring","half","retained","as","a","feature","for","the","transform",".","Multivariate","capability","is","added","by","running","the","supervised","interval","extraction","process","on","each","dimension","of","the","input","data",".","As","the","extracted","interval","features","are","already","extracted","for","the","supervised","evaluation","in","fit",",","the","fit_transform","method","is","recommended","if","the","transformed","fit","data","is","required",".","Parameters","--","--","--","--","--","n_intervals",":","int",",","default=50","The","number","of","times","the","supervised","interval","selection","process","is","run",".","Each","supervised","extraction","will","output","a","varying","amount","of","features","based","on","series","length",",","number","of","dimensions","and","the","number","of","features",".","min_interval_length",":","int",",","default=3","The","minimum","length","of","extracted","intervals",".","Minimum","value","of","3.","features",":","function","with","a","single","2d","array-like","parameter","or","list","of","said","functions",",","default=None","Functions","used","to","extract","features","from","selected","intervals",".","If","None",",","defaults","to","the","following","statistics","used","in","[","2","]",":","[","mean",",","median",",","std",",","slope",",","min",",","max",",","iqr",",","count_mean_crossing",",","count_above_mean","]",".","randomised_split_point",":","bool",",","default=True","If","True",",","the","split","point","for","interval","extraction","is","randomised","as","is","done","in","[","2","]","rather","than","split","in","half",".","n_jobs",":","int",",","default=1","The","number","of","jobs","to","run","in","parallel","for","both","`","fit","`","and","`","transform","`",".","``","-1","``","means","using","all","processors",".","random_state",":","int","or","None",",","default=None","Seed","for","random","number","generation",".","parallel_backend",":","str",",","ParallelBackendBase","instance","or","None",",","default=None","Specify","the","parallelisation","backend","implementation","in","joblib",",","if","None","a","'prefer'","value","of","``","threads","''","is","used","by","default",".","Valid","options","are","``","loky","''",",","``","multiprocessing","''",",","``","threading","''","or","a","custom","backend",".","See","the","joblib","Parallel","documentation","for","more","details",".","Attributes","--","--","--","--","--","n_instances_",":","int","The","number","of","train","cases",".","n_dims_",":","int","The","number","of","dimensions","per","case",".","series_length_",":","int","The","length","of","each","series",".","intervals_",":","list","of","tuples","Contains","information","for","each","feature","extracted","in","fit",".","Each","tuple","contains","the","interval","start",",","interval","end",",","interval","dimension","and","the","feature","extracted",".","Length","will","be","the","same","as","the","amount","of","transformed","features",".","See","Also","--","--","--","--","RandomIntervals","Notes","--","--","-","Based","on","the","authors","(","stevcabello",")","code",":","https",":","\/\/github.com\/stevcabello\/r-STSF\/","References","--","--","--","--","--","..","[","1","]","Cabello",",","N.",",","Naghizade",",","E.",",","Qi",",","J.","and","Kulik",",","L.",",","2020",",","November",".","Fast","and","accurate","time","series","classification","through","supervised","interval","search",".","In","2020","IEEE","International","Conference","on","Data","Mining","(","ICDM",")","(","pp",".","948-953",")",".","IEEE",".","..","[","2","]","Cabello",",","N.",",","Naghizade",",","E.",",","Qi",",","J.","and","Kulik",",","L.",",","2021",".","Fast",",","accurate","and","interpretable","time","series","classification","through","randomization",".","arXiv","preprint","arXiv:2105.14876","."]
docstr: Fit to data, then transform it.
  
  Fits the transformer to X and y and returns a transformed version of X.
  
  State change:
      Changes state to "fitted".
  
  Writes to self:
  _is_fitted : flag is set to True.
  _X : X, coerced copy of X, if remember_data tag is True
      possibly coerced to inner type or update_data compatible type
      by reference, when possible
  model attributes (ending in "_") : dependent on estimator
  
  Parameters
  ----------
  X : Series or Panel, any supported mtype
      Data to be transformed, of python type as follows:
          Series: pd.Series, pd.DataFrame, or np.ndarray (1D or 2D)
          Panel: pd.DataFrame with 2-level MultiIndex, list of pd.DataFrame,
              nested pd.DataFrame, or pd.DataFrame in long/wide format
          subject to sktime mtype format specifications, for further details see
              examples/AA_datatypes_and_datasets.ipynb
  y : Series or Panel, default=None
      Additional data, e.g., labels for transformation
  
  Returns
  -------
  transformed version of X
  type depends on type of X and scitype:transform-output tag:
      |   `X`    | `tf-output`  |     type of return     |
      |----------|--------------|------------------------|
      | `Series` | `Primitives` | `pd.DataFrame` (1-row) |
      | `Panel`  | `Primitives` | `pd.DataFrame`         |
      | `Series` | `Series`     | `Series`               |
      | `Panel`  | `Series`     | `Panel`                |
      | `Series` | `Panel`      | `Panel`                |
  instances in return correspond to instances in `X`
  combinations not in the table are currently not supported
  
  Explicitly, with examples:
      if `X` is `Series` (e.g., `pd.DataFrame`) and `transform-output` is `Series`
          then the return is a single `Series` of the same mtype
          Example: detrending a single series
      if `X` is `Panel` (e.g., `pd-multiindex`) and `transform-output` is `Series`
          then the return is `Panel` with same number of instances as `X`
              (the transformer is applied to each input Series instance)
          Example: all series in the panel are detrended individually
      if `X` is `Series` or `Panel` and `transform-output` is `Primitives`
          then the return is `pd.DataFrame` with as many rows as instances in `X`
          Example: i-th row of the return has mean and variance of the i-th series
      if `X` is `Series` and `transform-output` is `Panel`
          then the return is a `Panel` object of type `pd-multiindex`
          Example: i-th instance of the output is the i-th window running over `X`
docstr_tok: ["Fit","to","data",",","then","transform","it",".","Fits","the","transformer","to","X","and","y","and","returns","a","transformed","version","of","X",".","State","change",":","Changes","state","to","``","fitted","''",".","Writes","to","self",":","_is_fitted",":","flag","is","set","to","True",".","_X",":","X",",","coerced","copy","of","X",",","if","remember_data","tag","is","True","possibly","coerced","to","inner","type","or","update_data","compatible","type","by","reference",",","when","possible","model","attributes","(","ending","in","``","_","''",")",":","dependent","on","estimator","Parameters","--","--","--","--","--","X",":","Series","or","Panel",",","any","supported","mtype","Data","to","be","transformed",",","of","python","type","as","follows",":","Series",":","pd.Series",",","pd.DataFrame",",","or","np.ndarray","(","1D","or","2D",")","Panel",":","pd.DataFrame","with","2-level","MultiIndex",",","list","of","pd.DataFrame",",","nested","pd.DataFrame",",","or","pd.DataFrame","in","long\/wide","format","subject","to","sktime","mtype","format","specifications",",","for","further","details","see","examples\/AA_datatypes_and_datasets.ipynb","y",":","Series","or","Panel",",","default=None","Additional","data",",","e.g.",",","labels","for","transformation","Returns","--","--","--","-","transformed","version","of","X","type","depends","on","type","of","X","and","scitype",":","transform-output","tag",":","|","`","X","`","|","`","tf-output","`","|","type","of","return","|","|","--","--","--","--","--","|","--","--","--","--","--","--","--","|","--","--","--","--","--","--","--","--","--","--","--","--","|","|","`","Series","`","|","`","Primitives","`","|","`","pd.DataFrame","`","(","1-row",")","|","|","`","Panel","`","|","`","Primitives","`","|","`","pd.DataFrame","`","|","|","`","Series","`","|","`","Series","`","|","`","Series","`","|","|","`","Panel","`","|","`","Series","`","|","`","Panel","`","|","|","`","Series","`","|","`","Panel","`","|","`","Panel","`","|","instances","in","return","correspond","to","instances","in","`","X","`","combinations","not","in","the","table","are","currently","not","supported","Explicitly",",","with","examples",":","if","`","X","`","is","`","Series","`","(","e.g.",",","`","pd.DataFrame","`",")","and","`","transform-output","`","is","`","Series","`","then","the","return","is","a","single","`","Series","`","of","the","same","mtype","Example",":","detrending","a","single","series","if","`","X","`","is","`","Panel","`","(","e.g.",",","`","pd-multiindex","`",")","and","`","transform-output","`","is","`","Series","`","then","the","return","is","`","Panel","`","with","same","number","of","instances","as","`","X","`","(","the","transformer","is","applied","to","each","input","Series","instance",")","Example",":","all","series","in","the","panel","are","detrended","individually","if","`","X","`","is","`","Series","`","or","`","Panel","`","and","`","transform-output","`","is","`","Primitives","`","then","the","return","is","`","pd.DataFrame","`","with","as","many","rows","as","instances","in","`","X","`","Example",":","i-th","row","of","the","return","has","mean","and","variance","of","the","i-th","series","if","`","X","`","is","`","Series","`","and","`","transform-output","`","is","`","Panel","`","then","the","return","is","a","`","Panel","`","object","of","type","`","pd-multiindex","`","Example",":","i-th","instance","of","the","output","is","the","i-th","window","running","over","`","X","`"]
code: def fit_transform(self, X, y=None):
      """Fit to data, then transform it.
  
      Fits the transformer to X and y and returns a transformed version of X.
  
      State change:
          Changes state to "fitted".
  
      Writes to self:
      _is_fitted : flag is set to True.
      _X : X, coerced copy of X, if remember_data tag is True
          possibly coerced to inner type or update_data compatible type
          by reference, when possible
      model attributes (ending in "_") : dependent on estimator
  
      Parameters
      ----------
      X : Series or Panel, any supported mtype
          Data to be transformed, of python type as follows:
              Series: pd.Series, pd.DataFrame, or np.ndarray (1D or 2D)
              Panel: pd.DataFrame with 2-level MultiIndex, list of pd.DataFrame,
                  nested pd.DataFrame, or pd.DataFrame in long/wide format
              subject to sktime mtype format specifications, for further details see
                  examples/AA_datatypes_and_datasets.ipynb
      y : Series or Panel, default=None
          Additional data, e.g., labels for transformation
  
      Returns
      -------
      transformed version of X
      type depends on type of X and scitype:transform-output tag:
          |   `X`    | `tf-output`  |     type of return     |
          |----------|--------------|------------------------|
          | `Series` | `Primitives` | `pd.DataFrame` (1-row) |
          | `Panel`  | `Primitives` | `pd.DataFrame`         |
          | `Series` | `Series`     | `Series`               |
          | `Panel`  | `Series`     | `Panel`                |
          | `Series` | `Panel`      | `Panel`                |
      instances in return correspond to instances in `X`
      combinations not in the table are currently not supported
  
      Explicitly, with examples:
          if `X` is `Series` (e.g., `pd.DataFrame`) and `transform-output` is `Series`
              then the return is a single `Series` of the same mtype
              Example: detrending a single series
          if `X` is `Panel` (e.g., `pd-multiindex`) and `transform-output` is `Series`
              then the return is `Panel` with same number of instances as `X`
                  (the transformer is applied to each input Series instance)
              Example: all series in the panel are detrended individually
          if `X` is `Series` or `Panel` and `transform-output` is `Primitives`
              then the return is `pd.DataFrame` with as many rows as instances in `X`
              Example: i-th row of the return has mean and variance of the i-th series
          if `X` is `Series` and `transform-output` is `Panel`
              then the return is a `Panel` object of type `pd-multiindex`
              Example: i-th instance of the output is the i-th window running over `X`
      """
      from sktime.utils.numba.general import z_normalise_series_3d
  
      self.reset()
      if y is None:
          raise ValueError("SupervisedIntervals requires `y` in `fit`.")
      X, y, metadata = self._check_X_y(X=X, y=y, return_metadata=True)
  
      y = self._fit_setup(X, y)
      X_norm = z_normalise_series_3d(X)
  
      fit = Parallel(
          n_jobs=self._n_jobs,
          backend=self.parallel_backend,
          prefer="threads",
      )(
          delayed(self._generate_intervals)(
              X,
              X_norm,
              y,
              i,
              True,
          )
          for i in range(self.n_intervals)
      )
  
      (
          intervals,
          transformed_intervals,
      ) = zip(*fit)
  
      self.intervals_ = []
      for i in intervals:
          self.intervals_.extend(i)
  
      self._transform_features = [True] * len(self.intervals_)
  
      Xt = transformed_intervals[0]
      for i in range(1, self.n_intervals):
          Xt = np.hstack((Xt, transformed_intervals[i]))
  
      self._is_fitted = True
  
      # obtain configs to control input and output control
      configs = self.get_config()
      input_conv = configs["input_conversion"]
      output_conv = configs["output_conversion"]
  
      if input_conv and output_conv:
          X_out = self._convert_output(Xt, metadata=metadata)
      else:
          X_out = Xt
      return X_out
  
file_path: sktime/sktime/transformations/panel/supervised_intervals.py
imports: import numpy
  from joblib import Parallel, delayed
  from sklearn import preprocessing
  from sklearn.utils import check_random_state
  from sktime.transformations.base import BaseTransformer
  from sktime.utils.validation import check_n_jobs
label_desc: Use image node_id 2 for calling the SupervisedIntervals obj's underlying member method code with example usage: obj.fit_transform(X, y) and returns: X_out