class_docstr: Transformer that maps dataframes to numpy arrays of floats.
  
  It is in essence a wrapper around sklearn transformers (meta-transformer)
  that automatically infers the type of data, or makes sure the transformer
  encodes it as floating point numbers. It applies one-hot-encoding
  to categorical columns, and 'passthrough' (nothing) to
  numerical columns. The usefulness of this class is that it can
  preprocess different kinds of data (discrete, continuous) to one
  standard format while also remembering what kind of data was inputted.
  An estimator using this preprocessor can use
  this classes' :code:`dist_type_` attribute to know what kind of data
  was originally inputted.
  
  Attributes
  ----------
  in_type_ : Object
      the type of the input data. Should be either a list, DataFrame,
      ndarray, or Series.
  dist_type_ : str
      A string that in dicates the distribution type of the original data.
      It is one of :code:`"binary"`, :code:`"category"`,
      or :code:`"continuous"`
class_docstr_tok: ["Transformer","that","maps","dataframes","to","numpy","arrays","of","floats",".","It","is","in","essence","a","wrapper","around","sklearn","transformers","(","meta-transformer",")","that","automatically","infers","the","type","of","data",",","or","makes","sure","the","transformer","encodes","it","as","floating","point","numbers",".","It","applies","one-hot-encoding","to","categorical","columns",",","and","'passthrough","'","(","nothing",")","to","numerical","columns",".","The","usefulness","of","this","class","is","that","it","can","preprocess","different","kinds","of","data","(","discrete",",","continuous",")","to","one","standard","format","while","also","remembering","what","kind","of","data","was","inputted",".","An","estimator","using","this","preprocessor","can","use","this","classes","'",":","code",":","`","dist_type_","`","attribute","to","know","what","kind","of","data","was","originally","inputted",".","Attributes","--","--","--","--","--","in_type_",":","Object","the","type","of","the","input","data",".","Should","be","either","a","list",",","DataFrame",",","ndarray",",","or","Series",".","dist_type_",":","str","A","string","that","in","dicates","the","distribution","type","of","the","original","data",".","It","is","one","of",":","code",":","`","``","binary","''","`",",",":","code",":","`","``","category","''","`",",","or",":","code",":","`","``","continuous","''","`"]
docstr: Fit the three transformers.
docstr_tok: ["Fit","the","three","transformers","."]
code: def fit(self, X, y=None):
      """Fit the three transformers."""
      # Sci-kit learn parameter
      if isinstance(self.transformer, str) or self.transformer is None:
          self.inferred_type_ = type_of_target(X)
          self.dist_type_ = _get_type(X, self.dist_assumption)
          self.in_type_ = type(X)
          if self.in_type_ == DataFrame:
              self.columns_ = X.columns
  
          X = self._check(X, init=True)
          self.n_features_in_ = X.shape[0]
          self.n_features_out_ = X.shape[0]
  
          if self.inferred_type_ in ["binary", "multiclass"]:
              # NOTE: if 'binary' then it could be possible it is already 0/1
              # encoded. So may want to skip redundant OHE in that case...
              self.transform_ = OneHotEncoder(
                  drop="if_binary",
                  handle_unknown="error",
                  **compat._SPARSE_OUTPUT_FALSE,
              )
              self.transform_.fit(X)
              self.n_features_out_ = sum(
                  len(cat) if len(cat) != 2 else 1
                  for cat in self.transform_.categories_
              )
          # elif "multilabel-indicator" needn't be encoded, so we do not create
          # an encoder then.
      else:
          # It is useful to gather n_features_out_ to use in constructing NN
          # After, we discard the checked data and just feed unchecked data
          # to the transformer.
          X_temp = self._check(X, init=True)
          self.n_features_in_ = X_temp.shape[0]
          if _get_type(X_temp, self.dist_assumption) == "category":
              self.n_features_out_ = unique(X_temp)
          else:
              self.n_features_out_ = self.n_features_in_
  
          self.transform_ = self.transformer
          self.transform_.fit(X)
          if hasattr(self.transform_, "n_features_out_"):
              self.n_features_out_ = self.transform_.n_features_out_
  
      return self
  
file_path: fairlearn/fairlearn/adversarial/_preprocessor.py
imports: import fairlearn.utils._compatibility
  from ._constants import _TYPE_COMPLIANCE_ERROR, _TYPE_CHECK_ERROR, _ARG_ERROR_MESSAGE, _TYPE_UNKNOWN_ERROR, _INVALID_OHE
  from sklearn.utils import check_array
  from sklearn.preprocessing import OneHotEncoder
  from pandas import Series, DataFrame
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.utils.multiclass import type_of_target
  from numpy import all
  from numpy import sum
  from numpy import unique, isin
label_desc: Use image node_id 3 for calling the FloatTransformer obj's underlying member method code with example usage: obj.fit(X, y) and returns: self