class_docstr: A cudf based implementation of target encoding [1]_, which converts
  one or multiple categorical variables, 'Xs', with the average of
  corresponding values of the target variable, 'Y'. The input data is
  grouped by the columns `Xs` and the aggregated mean value of `Y` of
  each group is calculated to replace each value of `Xs`. Several
  optimizations are applied to prevent label leakage and parallelize
  the execution.
  
  Parameters
  ----------
  n_folds : int (default=4)
      Default number of folds for fitting training data. To prevent
      label leakage in `fit`, we split data into `n_folds` and
      encode one fold using the target variables of the remaining folds.
  smooth : int or float (default=0)
      Count of samples to smooth the encoding. 0 means no smoothing.
  seed : int (default=42)
      Random seed
  split_method : {'random', 'continuous', 'interleaved'},         (default='interleaved')
      Method to split train data into `n_folds`.
      'random': random split.
      'continuous': consecutive samples are grouped into one folds.
      'interleaved': samples are assign to each fold in a round robin way.
      'customize': customize splitting by providing a `fold_ids` array
      in `fit()` or `fit_transform()` functions.
  output_type : {'cupy', 'numpy', 'auto'}, default = 'auto'
      The data type of output. If 'auto', it matches input data.
  stat : {'mean','var','median'}, default = 'mean'
      The statistic used in encoding, mean, variance or median of the
      target.
  
  References
  ----------
  .. [1] https://maxhalford.github.io/blog/target-encoding/
  
  Examples
  --------
  Converting a categorical implementation to a numerical one
  
  >>> from cudf import DataFrame, Series
  >>> from cuml.preprocessing import TargetEncoder
  >>> train = DataFrame({'category': ['a', 'b', 'b', 'a'],
  ...                    'label': [1, 0, 1, 1]})
  >>> test = DataFrame({'category': ['a', 'c', 'b', 'a']})
  
  >>> encoder = TargetEncoder()
  >>> train_encoded = encoder.fit_transform(train.category, train.label)
  >>> test_encoded = encoder.transform(test.category)
  >>> print(train_encoded)
  [1. 1. 0. 1.]
  >>> print(test_encoded)
  [1.   0.75 0.5  1.  ]
docstr: Simultaneously fit and transform an input
  
  This is functionally equivalent to (but faster than)
  `TargetEncoder().fit(y).transform(y)`
  
  Parameters
  ----------
  x : cudf.Series or cudf.DataFrame or cupy.ndarray
     categories to be encoded. It's elements may or may
     not be unique
  y : cudf.Series or cupy.ndarray
      Series containing the target variable.
  fold_ids : cudf.Series or cupy.ndarray
      Series containing the indices of the customized
      folds. Its values should be integers in range
      `[0, N-1]` to split data into `N` folds. If None,
      fold_ids is generated based on `split_method`.
  
  Returns
  -------
  encoded : cupy.ndarray
      The ordinally encoded input series
docstr_tok: ["Simultaneously","fit","and","transform","an","input","This","is","functionally","equivalent","to","(","but","faster","than",")","`","TargetEncoder","(",")",".fit","(","y",")",".transform","(","y",")","`","Parameters","--","--","--","--","--","x",":","cudf.Series","or","cudf.DataFrame","or","cupy.ndarray","categories","to","be","encoded",".","It","'s","elements","may","or","may","not","be","unique","y",":","cudf.Series","or","cupy.ndarray","Series","containing","the","target","variable",".","fold_ids",":","cudf.Series","or","cupy.ndarray","Series","containing","the","indices","of","the","customized","folds",".","Its","values","should","be","integers","in","range","`","[","0",",","N-1","]","`","to","split","data","into","`","N","`","folds",".","If","None",",","fold_ids","is","generated","based","on","`","split_method","`",".","Returns","--","--","--","-","encoded",":","cupy.ndarray","The","ordinally","encoded","input","series"]
code: def fit_transform(self, x, y, fold_ids=None):
      """
      Simultaneously fit and transform an input
  
      This is functionally equivalent to (but faster than)
      `TargetEncoder().fit(y).transform(y)`
  
      Parameters
      ----------
      x : cudf.Series or cudf.DataFrame or cupy.ndarray
         categories to be encoded. It's elements may or may
         not be unique
      y : cudf.Series or cupy.ndarray
          Series containing the target variable.
      fold_ids : cudf.Series or cupy.ndarray
          Series containing the indices of the customized
          folds. Its values should be integers in range
          `[0, N-1]` to split data into `N` folds. If None,
          fold_ids is generated based on `split_method`.
  
      Returns
      -------
      encoded : cupy.ndarray
          The ordinally encoded input series
  
      """
      self.fit(x, y, fold_ids=fold_ids)
      return self.train_encode
  
imports: import warnings
  from cuml.common.exceptions import NotFittedError
  from cuml.internals.safe_imports import cpu_only_import
  from cuml.internals.safe_imports import gpu_only_import
label_desc: Use image node_id 3 for calling the TargetEncoder obj's underlying member method code with example usage: obj.fit_transform(x, y, fold_ids) and returns: self