class_docstr: Implements the proposed method from
  
  "CatBoost: gradient boosting with categorical features support", Dorogush et al. (2018).
  
  The Catboost encoder is a target encoder for categorical features. In this implementation we follow Eq. (1)
  in https://arxiv.org/pdf/1810.11363.pdf.
docstr: Fits the Catboost encoder following https://arxiv.org/pdf/1810.11363.pdf Eq. (1).
  
  :param X: Input categorical data.
  :param Y: Target data (continuous or categorical)
  :param use_alpha_when_unique: If True, uses the alpha value when a category only appears exactly once.
docstr_tok: ["Fits","the","Catboost","encoder","following","https",":","\/\/arxiv.org\/pdf\/1810.11363.pdf","Eq",".","(","1",")",".",":","param","X",":","Input","categorical","data",".",":","param","Y",":","Target","data","(","continuous","or","categorical",")",":","param","use_alpha_when_unique",":","If","True",",","uses","the","alpha","value","when","a","category","only","appears","exactly","once","."]
code: def fit(
      self,
      X: np.ndarray,
      Y: np.ndarray,
      use_alpha_when_unique: bool = True,
  ) -> None:
      """Fits the Catboost encoder following https://arxiv.org/pdf/1810.11363.pdf Eq. (1).
  
      :param X: Input categorical data.
      :param Y: Target data (continuous or categorical)
      :param use_alpha_when_unique: If True, uses the alpha value when a category only appears exactly once.
      """
      self._fit_transform(X, Y, use_alpha_when_unique, train=True)
  
file_path: dowhy/dowhy/gcm/util/catboost_encoder.py
imports: from typing import Optional
  import numpy
  from sklearn.preprocessing import LabelEncoder
label_desc: Use image node_id 2 for calling the CatBoostEncoder obj's underlying member method code with example usage: obj.fit(X, Y, use_alpha_when_unique) without return types