class_docstr: Checks the input data to Auto-Sklearn.
  
  It also determines what columns are categorical and which ones are numerical,
  so that the pre-processing pipeline can process this columns accordingly.
  
  Attributes
  ----------
  feat_type: Optional[List[str]] = None
      In case the dataset is not a pandas DataFrame:
          +   If provided, this list indicates which columns should be treated as
              categorical it is internally transformed into a dictionary that
              indicates a mapping from column index to categorical/numerical.
          +   If not provided, by default all columns are treated as numerical
  
      If the input dataset is of type pandas dataframe, this argument
      must be none, as the column type will be inferred from the pandas dtypes.
  
  data_type:
      Class name of the data type provided during fit.
class_docstr_tok: ["Checks","the","input","data","to","Auto-Sklearn",".","It","also","determines","what","columns","are","categorical","and","which","ones","are","numerical",",","so","that","the","pre-processing","pipeline","can","process","this","columns","accordingly",".","Attributes","--","--","--","--","--","feat_type",":","Optional","[","List","[","str","]","]","=","None","In","case","the","dataset","is","not","a","pandas","DataFrame",":","+","If","provided",",","this","list","indicates","which","columns","should","be","treated","as","categorical","it","is","internally","transformed","into","a","dictionary","that","indicates","a","mapping","from","column","index","to","categorical\/numerical",".","+","If","not","provided",",","by","default","all","columns","are","treated","as","numerical","If","the","input","dataset","is","of","type","pandas","dataframe",",","this","argument","must","be","none",",","as","the","column","type","will","be","inferred","from","the","pandas","dtypes",".","data_type",":","Class","name","of","the","data","type","provided","during","fit","."]
docstr: Validates and fit a categorical encoder (if needed) to the features.
  The supported data types are List, numpy arrays and pandas DataFrames.
  
  Parameters
  ----------
  X_train: SUPPORTED_FEAT_TYPES
      A set of features, whose categorical features are going to be
      transformed
  
  Return
  ------
  np.ndarray | spmatrix | pd.DataFrame:
      The transformed array
docstr_tok: ["Validates","and","fit","a","categorical","encoder","(","if","needed",")","to","the","features",".","The","supported","data","types","are","List",",","numpy","arrays","and","pandas","DataFrames",".","Parameters","--","--","--","--","--","X_train",":","SUPPORTED_FEAT_TYPES","A","set","of","features",",","whose","categorical","features","are","going","to","be","transformed","Return","--","--","--","np.ndarray","|","spmatrix","|","pd.DataFrame",":","The","transformed","array"]
code: def transform(
      self,
      X: SUPPORTED_FEAT_TYPES,
  ) -> Union[np.ndarray, spmatrix, pd.DataFrame]:
      """
      Validates and fit a categorical encoder (if needed) to the features.
      The supported data types are List, numpy arrays and pandas DataFrames.
  
      Parameters
      ----------
      X_train: SUPPORTED_FEAT_TYPES
          A set of features, whose categorical features are going to be
          transformed
  
      Return
      ------
      np.ndarray | spmatrix | pd.DataFrame:
          The transformed array
      """
      if not self._is_fitted:
          raise NotFittedError(
              "Cannot call transform on a validator that is not fitted"
          )
  
      # If a list was provided, it will be converted to pandas
      if isinstance(X, List):
          X_transformed, _ = self.list_to_dataframe(X)
      else:
          X_transformed = X
  
      # Check the data here so we catch problems on new test data
      self._check_data(X_transformed)
  
      # Sparse related transformations
      # Not all sparse format support index sorting
      if isinstance(X_transformed, spmatrix):
          if not isinstance(X_transformed, csr_matrix):
              self.logger.warning(
                  f"Sparse data provided is of type {type(X_transformed)} "
                  "yet Auto-Sklearn only support csr_matrix. Auto-sklearn "
                  "will convert the provided data to the csr_matrix format."
              )
              X_transformed = X_transformed.tocsr(copy=False)
  
          X_transformed.sort_indices()
  
      return X_transformed
  
file_path: auto-sklearn/autosklearn/data/feature_validator.py
imports: from typing import Dict, List, Optional, Tuple, Union, cast
  import logging
  import warnings
  import numpy
  import pandas
  from pandas.api.types import is_numeric_dtype, is_sparse
  from scipy.sparse import csr_matrix, spmatrix
  from sklearn.base import BaseEstimator
  from sklearn.exceptions import NotFittedError
  from autosklearn.util.logging_ import PickableLoggerAdapter
label_desc: Use image node_id 3 for calling the FeatureValidator obj's underlying member method code with example usage: obj.transform(X) and returns: X_transformed