class_docstr: Meta-estimator to classify on a transformed target.
  
  Parameters
  ----------
  classifier : object, default=None
      Classifier object such as derived from ``ClassifierMixin``. This
      classifier will automatically be cloned each time prior to fitting.
  
  transformer : object, default=None
      Estimator object such as derived from ``TransformerMixin``. Note that the
      transformer will be cloned during fitting. Also, the transformer is
      restricting ``y`` to be a numpy array.
  
  check_inverse : bool, default=True
      Whether to check that ``transform`` followed by ``inverse_transform``
      leads to the original targets.
  
  Attributes
  ----------
  classifier_ : object
      Fitted classifier.
  
  transformer_ : object
      Transformer used in ``fit`` and ``predict``.
  
  Notes
  -----
  This is a modification from TransformedTargetRegressor.
  
  See :ref:`sklearn.compose.TransformedTargetRegressor
class_docstr_tok: ["Meta-estimator","to","classify","on","a","transformed","target",".","Parameters","--","--","--","--","--","classifier",":","object",",","default=None","Classifier","object","such","as","derived","from","``","ClassifierMixin","``",".","This","classifier","will","automatically","be","cloned","each","time","prior","to","fitting",".","transformer",":","object",",","default=None","Estimator","object","such","as","derived","from","``","TransformerMixin","``",".","Note","that","the","transformer","will","be","cloned","during","fitting",".","Also",",","the","transformer","is","restricting","``","y","``","to","be","a","numpy","array",".","check_inverse",":","bool",",","default=True","Whether","to","check","that","``","transform","``","followed","by","``","inverse_transform","``","leads","to","the","original","targets",".","Attributes","--","--","--","--","--","classifier_",":","object","Fitted","classifier",".","transformer_",":","object","Transformer","used","in","``","fit","``","and","``","predict","``",".","Notes","--","--","-","This","is","a","modification","from","TransformedTargetRegressor",".","See",":","ref",":","`","sklearn.compose.TransformedTargetRegressor"]
docstr: Fit the model according to the given training data.
  
  Parameters
  ----------
  X : {array-like, sparse matrix} of shape (n_samples, n_features)
      Training vector, where n_samples is the number of samples and
      n_features is the number of features.
  
  y : array-like of shape (n_samples,)
      Target values.
  
  **fit_params : dict
      Parameters passed to the ``fit`` method of the underlying
      classifier.
  
  
  Returns
  -------
  self : object
docstr_tok: ["Fit","the","model","according","to","the","given","training","data",".","Parameters","--","--","--","--","--","X",":","{","array-like",",","sparse","matrix","}","of","shape","(","n_samples",",","n_features",")","Training","vector",",","where","n_samples","is","the","number","of","samples","and","n_features","is","the","number","of","features",".","y",":","array-like","of","shape","(","n_samples",",",")","Target","values",".","*","*","fit_params",":","dict","Parameters","passed","to","the","``","fit","``","method","of","the","underlying","classifier",".","Returns","--","--","--","-","self",":","object"]
code: def fit(self, X, y, **fit_params):
      """Fit the model according to the given training data.
  
      Parameters
      ----------
      X : {array-like, sparse matrix} of shape (n_samples, n_features)
          Training vector, where n_samples is the number of samples and
          n_features is the number of features.
  
      y : array-like of shape (n_samples,)
          Target values.
  
      **fit_params : dict
          Parameters passed to the ``fit`` method of the underlying
          classifier.
  
  
      Returns
      -------
      self : object
      """
      # Check that X and y have correct shape
      X, y = check_X_y(X, y)
  
      if isinstance(y, pd.DataFrame) or isinstance(y, pd.Series):
          y = y.values
  
      # y = check_array(y, accept_sparse=False, force_all_finite=True,
      #                 ensure_2d=False, dtype=None)
  
      # Store the classes seen during fit
      self.classes_ = np.unique(y)
  
      # store the number of dimension of the target to predict an array of
      # similar shape at predict
      self._training_dim = y.ndim
  
      # transformers are designed to modify X which is 2d dimensional, we
      # need to modify y accordingly.
      if y.ndim == 1:
          y_2d = y.reshape(-1, 1)
      else:
          y_2d = y
      self._fit_transformer(y_2d)
  
      # transform y and convert back to 1d array if needed
      y_trans = self.transformer_.transform(y_2d)
      # FIXME: a FunctionTransformer can return a 1D array even when validate
      # is set to True. Therefore, we need to check the number of dimension
      # first.
      if y_trans.ndim == 2 and y_trans.shape[1] == 1:
          y_trans = y_trans.squeeze(axis=1)
  
      if self.classifier is None:
          from sklearn.linear_model import LogisticRegression
  
          self.classifier_ = LogisticRegression()
      else:
          self.classifier_ = clone(self.classifier)
  
      self.classifier_.fit(X, y_trans, **fit_params)
  
      self._carry_over_estimator_fit_vars(
          self.classifier_,
          ignore=["classes_", "transformer_", "classifier_"],
      )
  
      return self
  
file_path: pycaret/pycaret/internal/preprocess/target/TransformedTargetClassifier.py
imports: import warnings
  import numpy
  import pandas
  from sklearn.base import BaseEstimator, ClassifierMixin, clone
  from sklearn.exceptions import NotFittedError
  from sklearn.preprocessing import LabelEncoder
  from sklearn.utils import _safe_indexing
  from sklearn.utils.validation import _deprecate_positional_args, check_is_fitted, check_X_y
  from .utils import TargetTransformerMixin
label_desc: Use image node_id 3 for calling the TransformedTargetClassifier obj's underlying member method code with example usage: obj.fit(X, y) and returns: self