class_docstr: Select exogenous features.
  
  Transformer to enable tuneable feature selection of exogenous data. The
  FeatureSelection implements multiple methods to select features (columns).
  In case X is a pd.Series, then it is just passed through, unless method="none",
  then None is returned in transform().
  
  Parameters
  ----------
  method : str, required
      The method of how to select the features. Implemented methods are:
      * "feature-importances": Use feature_importances_ of the regressor (meta-model)
        to select n_columns with highest importance values.
        Requires parameter n_columns.
      * "random": Randomly select n_columns features. Requires parameter n_columns.
      * "columns": Select features by given names.
      * "none": Remove all columns by setting Z to None.
      * "all": Select all given features.
  regressor : sklearn-like regressor, optional, default=None.
      Used as meta-model for the method "feature-importances". The given
      regressor must have an attribute "feature_importances_". If None,
      then a GradientBoostingRegressor(max_depth=5) is used.
  n_columns : int, optional
      Number of features (columns) to select. n_columns must be <=
      number of X columns. Some methods require n_columns to be given.
  random_state : int, RandomState instance or None, default=None
      Used to set random_state of the default regressor and to
      set random.seed() if method="random".
  columns : list of str
      A list of columns to select. If columns is given.
  
  Attributes
  ----------
  columns_ : list of str
      List of columns that have been selected as features.
  regressor_ : sklearn-like regressor
      Fitted regressor (meta-model).
  n_columns_: int
      Derived from number of features if n_columns is None, then
      n_columns_ is calculated as int(math.ceil(Z.shape[1] / 2)). So taking
      half of given features only as default.
  feature_importances_ : dict or None
      A dictionary with column name as key and feature imporatnce value as value.
      The dict is sorted descending on value. This attribute is a dict if
      method="feature-importances", else None.
  
  Examples
  --------
  >>> from sktime.transformations.series.feature_selection import FeatureSelection
  >>> from sktime.datasets import load_longley
  >>> y, X = load_longley()
  >>> transformer = FeatureSelection(method="feature-importances", n_columns=3)
  >>> Xt = transformer.fit_transform(X, y)
class_docstr_tok: ["Select","exogenous","features",".","Transformer","to","enable","tuneable","feature","selection","of","exogenous","data",".","The","FeatureSelection","implements","multiple","methods","to","select","features","(","columns",")",".","In","case","X","is","a","pd.Series",",","then","it","is","just","passed","through",",","unless","method=","''","none","''",",","then","None","is","returned","in","transform","(",")",".","Parameters","--","--","--","--","--","method",":","str",",","required","The","method","of","how","to","select","the","features",".","Implemented","methods","are",":","*","``","feature-importances","''",":","Use","feature_importances_","of","the","regressor","(","meta-model",")","to","select","n_columns","with","highest","importance","values",".","Requires","parameter","n_columns",".","*","``","random","''",":","Randomly","select","n_columns","features",".","Requires","parameter","n_columns",".","*","``","columns","''",":","Select","features","by","given","names",".","*","``","none","''",":","Remove","all","columns","by","setting","Z","to","None",".","*","``","all","''",":","Select","all","given","features",".","regressor",":","sklearn-like","regressor",",","optional",",","default=None",".","Used","as","meta-model","for","the","method","``","feature-importances","''",".","The","given","regressor","must","have","an","attribute","``","feature_importances_","''",".","If","None",",","then","a","GradientBoostingRegressor","(","max_depth=5",")","is","used",".","n_columns",":","int",",","optional","Number","of","features","(","columns",")","to","select",".","n_columns","must","be","<","=","number","of","X","columns",".","Some","methods","require","n_columns","to","be","given",".","random_state",":","int",",","RandomState","instance","or","None",",","default=None","Used","to","set","random_state","of","the","default","regressor","and","to","set","random.seed","(",")","if","method=","''","random","''",".","columns",":","list","of","str","A","list","of","columns","to","select",".","If","columns","is","given",".","Attributes","--","--","--","--","--","columns_",":","list","of","str","List","of","columns","that","have","been","selected","as","features",".","regressor_",":","sklearn-like","regressor","Fitted","regressor","(","meta-model",")",".","n_columns_",":","int","Derived","from","number","of","features","if","n_columns","is","None",",","then","n_columns_","is","calculated","as","int","(","math.ceil","(","Z.shape","[","1","]","\/","2",")",")",".","So","taking","half","of","given","features","only","as","default",".","feature_importances_",":","dict","or","None","A","dictionary","with","column","name","as","key","and","feature","imporatnce","value","as","value",".","The","dict","is","sorted","descending","on","value",".","This","attribute","is","a","dict","if","method=","''","feature-importances","''",",","else","None",".","Examples","--","--","--","--",">",">",">","from","sktime.transformations.series.feature_selection","import","FeatureSelection",">",">",">","from","sktime.datasets","import","load_longley",">",">",">","y",",","X","=","load_longley","(",")",">",">",">","transformer","=","FeatureSelection","(","method=","''","feature-importances","''",",","n_columns=3",")",">",">",">","Xt","=","transformer.fit_transform","(","X",",","y",")"]
docstr: Transform X and return a transformed version.
  
  private _transform containing the core logic, called from transform
  
  Parameters
  ----------
  X : pd.Series or pd.DataFrame
      Data to be transformed
  y : ignored argument for interface compatibility
      Additional data, e.g., labels for transformation
  
  Returns
  -------
  Xt : pd.Series or pd.DataFrame, same type as X
      transformed version of X
docstr_tok: ["Transform","X","and","return","a","transformed","version",".","private","_transform","containing","the","core","logic",",","called","from","transform","Parameters","--","--","--","--","--","X",":","pd.Series","or","pd.DataFrame","Data","to","be","transformed","y",":","ignored","argument","for","interface","compatibility","Additional","data",",","e.g.",",","labels","for","transformation","Returns","--","--","--","-","Xt",":","pd.Series","or","pd.DataFrame",",","same","type","as","X","transformed","version","of","X"]
code: def _transform(self, X, y=None):
      """Transform X and return a transformed version.
  
      private _transform containing the core logic, called from transform
  
      Parameters
      ----------
      X : pd.Series or pd.DataFrame
          Data to be transformed
      y : ignored argument for interface compatibility
          Additional data, e.g., labels for transformation
  
      Returns
      -------
      Xt : pd.Series or pd.DataFrame, same type as X
          transformed version of X
      """
      # multivariate case
      if not isinstance(X, pd.Series):
          if self.method == "none":
              Xt = None
          else:
              Xt = X[self.columns_]
      # univariate case
      else:
          if self.method == "none":
              Xt = None
          else:
              Xt = X
      return Xt
  
file_path: sktime/sktime/transformations/series/feature_selection.py
imports: import math
  import pandas
  from sktime.transformations.base import BaseTransformer
  from sktime.utils.validation.forecasting import check_regressor
label_desc: Use image node_id 3 for calling the FeatureSelection obj's underlying member method code with example usage: obj._transform(X, y) and returns: Xt