class_docstr: Base class for various contrast encoders
  
  Parameters
  ----------
  
  verbose: int
      integer indicating verbosity of the output. 0 for none.
  cols: list
      a list of columns to encode, if None, all string columns will be encoded.
  drop_invariant: bool
      boolean for whether or not to drop columns with 0 variance.
  return_df: bool
      boolean for whether to return a pandas DataFrame from transform (otherwise it will be a numpy array).
  handle_unknown: str
      options are 'error', 'return_nan', 'value', and 'indicator'. The default is 'value'. Warning: if indicator is used,
      an extra column will be added in if the transform matrix has unknown categories.  This can cause
      unexpected changes in dimension in some cases.
  handle_missing: str
      options are 'error', 'return_nan', 'value', and 'indicator'. The default is 'value'. Warning: if indicator is used,
      an extra column will be added in if the transform matrix has nan values.  This can cause
      unexpected changes in dimension in some cases.
  
  References
  ----------
  
  .. [1] Contrast Coding Systems for Categorical Variables, from
  https://stats.idre.ucla.edu/r/library/r-library-contrast-coding-systems-for-categorical-variables/
  
  .. [2] Gregory Carey (2003). Coding Categorical Variables, from
  http://ibgwww.colorado.edu/~carey/p5741ndir/Coding_Categorical_Variables.pdf
code: def _fit(self, X, y=None, **kwargs):
      # train an ordinal pre-encoder
      self.ordinal_encoder = OrdinalEncoder(
          verbose=self.verbose,
          cols=self.cols,
          handle_unknown="value",
          handle_missing="value",
      )
      self.ordinal_encoder = self.ordinal_encoder.fit(X)
  
      ordinal_mapping = self.ordinal_encoder.category_mapping
  
      mappings_out = []
      for switch in ordinal_mapping:
          values = switch.get("mapping")
          col = switch.get("col")
  
          column_mapping = self.fit_contrast_coding(
              col, values, self.handle_missing, self.handle_unknown
          )
          mappings_out.append(
              {
                  "col": col,
                  "mapping": column_mapping,
              }
          )
  
      self.mapping = mappings_out
  
file_path: category_encoders/category_encoders/base_contrast_encoder.py
imports: from abc import abstractmethod
  import pandas
  from patsy.contrasts import ContrastMatrix
  import numpy
  from category_encoders.ordinal import OrdinalEncoder
  import category_encoders.utils
  import warnings
label_desc: Use image node_id 2 for calling the BaseContrastEncoder obj's underlying member method code with example usage: obj._fit(X, y) without return types