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 input data to Auto-Sklearn.
  The supported data types are List, numpy arrays and pandas DataFrames.
  CSR sparse data types are also supported
  
  Parameters
  ----------
  X_train: SUPPORTED_FEAT_TYPES
      A set of features that are going to be validated (type and dimensionality
      checks) and a encoder fitted in the case the data needs encoding
  X_test: Optional[SUPPORTED_FEAT_TYPES]
      A hold out set of data used for checking
docstr_tok: ["Validates","input","data","to","Auto-Sklearn",".","The","supported","data","types","are","List",",","numpy","arrays","and","pandas","DataFrames",".","CSR","sparse","data","types","are","also","supported","Parameters","--","--","--","--","--","X_train",":","SUPPORTED_FEAT_TYPES","A","set","of","features","that","are","going","to","be","validated","(","type","and","dimensionality","checks",")","and","a","encoder","fitted","in","the","case","the","data","needs","encoding","X_test",":","Optional","[","SUPPORTED_FEAT_TYPES","]","A","hold","out","set","of","data","used","for","checking"]
code: def fit(
      self,
      X_train: SUPPORTED_FEAT_TYPES,
      X_test: Optional[SUPPORTED_FEAT_TYPES] = None,
  ) -> "FeatureValidator":
      """
      Validates input data to Auto-Sklearn.
      The supported data types are List, numpy arrays and pandas DataFrames.
      CSR sparse data types are also supported
  
      Parameters
      ----------
      X_train: SUPPORTED_FEAT_TYPES
          A set of features that are going to be validated (type and dimensionality
          checks) and a encoder fitted in the case the data needs encoding
      X_test: Optional[SUPPORTED_FEAT_TYPES]
          A hold out set of data used for checking
      """
      # If a list was provided, it will be converted to pandas
      if isinstance(X_train, List):
          X_train, X_test = self.list_to_dataframe(X_train, X_test)
  
      self._check_data(X_train)
  
      # Handle categorical feature identification for the pipeline
      if hasattr(X_train, "iloc"):
          if self.feat_type is not None:
              raise ValueError(
                  "When providing a DataFrame to Auto-Sklearn, we extract "
                  "the feature types from the DataFrame.dtypes. That is, "
                  "providing the option feat_type to the fit method is not "
                  "supported when using a Dataframe. Please make sure that the "
                  "type of each column in your DataFrame is properly set. "
                  "More details about having the correct data type in your "
                  "DataFrame can be seen in "
                  "https://pandas.pydata.org/pandas-docs/stable/reference"
                  "/api/pandas.DataFrame.astype.html"
              )
          else:
              self.feat_type = self.get_feat_type_from_columns(X_train)
      else:
          # Numpy array was provided
          if self.feat_type is None:
              # Assume numerical columns if a numpy array has no feature types
              self.feat_type = {
                  i: "numerical" for i in range(np.shape(X_train)[1])
              }
          else:
              # Check The feat type provided
              if len(self.feat_type) != np.shape(X_train)[1]:
                  raise ValueError(
                      "Array feat_type does not have same number of "
                      "variables as X has features. %d vs %d."
                      % (len(self.feat_type), np.shape(X_train)[1])
                  )
              if not all(
                  [isinstance(f, str) for f in self.feat_type.values()]
              ):
                  raise ValueError(
                      "feat_type must only contain strings: {}".format(
                          list(self.feat_type.values()),
                      )
                  )
  
              for ft in self.feat_type.values():
                  if ft.lower() not in [
                      "categorical",
                      "numerical",
                      "string",
                  ]:
                      raise ValueError(
                          "Only `Categorical`, `Numerical` and `String` are "
                          "valid feature types"
                      )
  
      if X_test is not None:
          self._check_data(X_test)
  
          if np.shape(X_train)[1] != np.shape(X_test)[1]:
              raise ValueError(
                  "The feature dimensionality of the train and test "
                  "data does not match train({}) != test({})".format(
                      np.shape(X_train)[1], np.shape(X_test)[1]
                  )
              )
  
      self._is_fitted = True
  
      return self
  
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 2 for calling the FeatureValidator obj's underlying member method code with example usage: obj.fit(X_train, X_test) and returns: self