class_docstr: A class to pre-process targets.
  
  It validates the data provided during fit to make sure it matches Sklearn
  expectation as well as encoding the targets in case of classification
  
  Attributes
  ----------
  is_classification: bool
      A bool that indicates if the validator should operate in classification mode.
      During classification, the targets are encoded.
  
  encoder: Optional[BaseEstimator]
      Host a encoder object if the data requires transformation (for example, if
      provided a categorical column in a pandas DataFrame).
  
  enc_columns: List[str]
      List of columns that where encoded
class_docstr_tok: ["A","class","to","pre-process","targets",".","It","validates","the","data","provided","during","fit","to","make","sure","it","matches","Sklearn","expectation","as","well","as","encoding","the","targets","in","case","of","classification","Attributes","--","--","--","--","--","is_classification",":","bool","A","bool","that","indicates","if","the","validator","should","operate","in","classification","mode",".","During","classification",",","the","targets","are","encoded",".","encoder",":","Optional","[","BaseEstimator","]","Host","a","encoder","object","if","the","data","requires","transformation","(","for","example",",","if","provided","a","categorical","column","in","a","pandas","DataFrame",")",".","enc_columns",":","List","[","str","]","List","of","columns","that","where","encoded"]
code: def __init__(
      self,
      is_classification: bool = False,
      logger: Optional[PickableLoggerAdapter] = None,
  ) -> None:
      self.is_classification = is_classification
  
      self.data_type = None  # type: Optional[type]
  
      # NOTE: type update
      #   Encoders don't seems to have a unified base class for
      #   the methods 'transform'. Could make a `prototype` class that
      #   duck types for the 'transform', 'fit_transform' methods
      #   This is however fine while we only use ordinal encoder
      self.encoder = None  # type: Optional[OrdinalEncoder]
  
      self.out_dimensionality = None  # type: Optional[int]
      self.type_of_target = None  # type: Optional[str]
  
      self.logger = (
          logger if logger is not None else logging.getLogger(__name__)
      )
  
      # Store the dtype for remapping to correct type
      self.dtype = None  # type: Optional[Type]
  
      self._is_fitted = False
  
imports: from typing import List, Optional, Type, Union, cast
  import logging
  import warnings
  import numpy
  import pandas
  import sklearn.utils
  from pandas.api.types import is_numeric_dtype
  from pandas.core.dtypes.base import ExtensionDtype
  from scipy.sparse import spmatrix
  from sklearn.base import BaseEstimator
  from sklearn.exceptions import NotFittedError
  from sklearn.preprocessing import OrdinalEncoder
  from sklearn.utils.multiclass import type_of_target
  from autosklearn.util.logging_ import PickableLoggerAdapter
label_desc: Use image node_id 1 to create a new TargetValidator object from inherited base classes: BaseEstimator with example: obj = TargetValidator(is_classification, logger)