class_docstr: Makes sure the input data complies with Auto-sklearn requirements.
  Categorical inputs are encoded via a Label Encoder, if the input
  is a dataframe.
  
  This class also perform checks for data integrity and flags the user
  via informative errors.
  
  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.
  
  is_classification: bool
      For classification task, this flag indicates that the target data
      should be encoded
  
  feature_validator: FeatureValidator
      A FeatureValidator instance used to validate and encode feature columns to match
      sklearn expectations on the data
  
  target_validator: TargetValidator
      A TargetValidator instance used for classification to validate and encode the
      target values
docstr: Validates and fit a categorical encoder (if needed) to the features, and
  a encoder for targets in the case of classification. Specifically:
  
  For features:
  Valid data types are enforced (List, np.ndarray, pd.DataFrame, pd.Series, scipy
  sparse) as well as dimensionality checks
  
  If the provided data is a pandas DataFrame with categorical/boolean/int columns,
  such columns will be encoded using an Ordinal Encoder
  
  For targets:
  * Checks for dimensionality as well as missing values are performed.
  * If performing a classification task, the data is going to be encoded
  
  Parameters
  ----------
  X_train: SUPPORTED_FEAT_TYPES
      A set of features that are going to be validated (type and dimensionality
      checks). If this data contains categorical columns, an encoder is going to
      be instantiated and trained with this data.
  
  y_train: SUPPORTED_TARGET_TYPES
      A set of targets to encoded if the task is for classification.
  
  X_test: Optional[SUPPORTED_FEAT_TYPES]
      A hold out set of features used for checking
  
  y_test: SUPPORTED_TARGET_TYPES
      A hold out set of targets used for checking. Additionally, if the current
      task is a classification task, this y_test categories are also going to be
      used to fit a pre-processing encoding (to prevent errors on unseen classes).
  
  Returns
  -------
  self
docstr_tok: ["Validates","and","fit","a","categorical","encoder","(","if","needed",")","to","the","features",",","and","a","encoder","for","targets","in","the","case","of","classification",".","Specifically",":","For","features",":","Valid","data","types","are","enforced","(","List",",","np.ndarray",",","pd.DataFrame",",","pd.Series",",","scipy","sparse",")","as","well","as","dimensionality","checks","If","the","provided","data","is","a","pandas","DataFrame","with","categorical\/boolean\/int","columns",",","such","columns","will","be","encoded","using","an","Ordinal","Encoder","For","targets",":","*","Checks","for","dimensionality","as","well","as","missing","values","are","performed",".","*","If","performing","a","classification","task",",","the","data","is","going","to","be","encoded","Parameters","--","--","--","--","--","X_train",":","SUPPORTED_FEAT_TYPES","A","set","of","features","that","are","going","to","be","validated","(","type","and","dimensionality","checks",")",".","If","this","data","contains","categorical","columns",",","an","encoder","is","going","to","be","instantiated","and","trained","with","this","data",".","y_train",":","SUPPORTED_TARGET_TYPES","A","set","of","targets","to","encoded","if","the","task","is","for","classification",".","X_test",":","Optional","[","SUPPORTED_FEAT_TYPES","]","A","hold","out","set","of","features","used","for","checking","y_test",":","SUPPORTED_TARGET_TYPES","A","hold","out","set","of","targets","used","for","checking",".","Additionally",",","if","the","current","task","is","a","classification","task",",","this","y_test","categories","are","also","going","to","be","used","to","fit","a","pre-processing","encoding","(","to","prevent","errors","on","unseen","classes",")",".","Returns","--","--","--","-","self"]
code: def fit(
      self,
      X_train: SUPPORTED_FEAT_TYPES,
      y_train: SUPPORTED_TARGET_TYPES,
      X_test: Optional[SUPPORTED_FEAT_TYPES] = None,
      y_test: Optional[SUPPORTED_TARGET_TYPES] = None,
  ) -> BaseEstimator:
      """
      Validates and fit a categorical encoder (if needed) to the features, and
      a encoder for targets in the case of classification. Specifically:
  
      For features:
      Valid data types are enforced (List, np.ndarray, pd.DataFrame, pd.Series, scipy
      sparse) as well as dimensionality checks
  
      If the provided data is a pandas DataFrame with categorical/boolean/int columns,
      such columns will be encoded using an Ordinal Encoder
  
      For targets:
      * Checks for dimensionality as well as missing values are performed.
      * If performing a classification task, the data is going to be encoded
  
      Parameters
      ----------
      X_train: SUPPORTED_FEAT_TYPES
          A set of features that are going to be validated (type and dimensionality
          checks). If this data contains categorical columns, an encoder is going to
          be instantiated and trained with this data.
  
      y_train: SUPPORTED_TARGET_TYPES
          A set of targets to encoded if the task is for classification.
  
      X_test: Optional[SUPPORTED_FEAT_TYPES]
          A hold out set of features used for checking
  
      y_test: SUPPORTED_TARGET_TYPES
          A hold out set of targets used for checking. Additionally, if the current
          task is a classification task, this y_test categories are also going to be
          used to fit a pre-processing encoding (to prevent errors on unseen classes).
  
      Returns
      -------
      self
      """
      # Check that the data is valid
      if np.shape(X_train)[0] != np.shape(y_train)[0]:
          raise ValueError(
              "Inconsistent number of train datapoints for features and targets,"
              " {} for features and {} for targets".format(
                  np.shape(X_train)[0],
                  np.shape(y_train)[0],
              )
          )
      if (
          X_test is not None
          and np.shape(X_test)[0] != np.shape(y_test)[0]
      ):
          raise ValueError(
              "Inconsistent number of test datapoints for features and targets,"
              " {} for features and {} for targets".format(
                  np.shape(X_test)[0],
                  np.shape(y_test)[0],
              )
          )
  
      self.feature_validator.fit(X_train, X_test)
      self.target_validator.fit(y_train, y_test)
      self._is_fitted = True
  
      return self
  
file_path: auto-sklearn/autosklearn/data/validation.py
imports: from typing import List, Optional, Tuple, Union
  import logging
  import numpy
  import pandas
  from scipy.sparse import spmatrix
  from sklearn.base import BaseEstimator
  from sklearn.exceptions import NotFittedError
  from autosklearn.data.feature_validator import SUPPORTED_FEAT_TYPES, FeatureValidator
  from autosklearn.data.target_validator import SUPPORTED_TARGET_TYPES, TargetValidator
  from autosklearn.util.logging_ import get_named_client_logger
label_desc: Use image node_id 2 for calling the InputValidator obj's underlying member method code with example usage: obj.fit(X_train, y_train, X_test, y_test) and returns: self