class_docstr: Calculates the mean target value per category or per bin of a variable or group of
  variables. Works with numerical and categorical variables. If variables are
  numerical, the values are first sorted into bins of equal-width or equal-frequency.
  
  Parameters
  ----------
  variables: list, default=None
      The list of input variables. If None, the estimator will use all variables as
      input features (except datetime).
  
  bins: int, default=5
      If the dataset contains numerical variables, the number of bins into which
      the values will be sorted.
  
  strategy: str, default='equal_width'
      Whether the bins should of equal width ('equal_width') or equal frequency
      ('equal_frequency').
  
  Attributes
  ----------
  variables_categorical_:
      The group of categorical input variables that will be used for prediction.
  
  variables_numerical_:
      The group of numerical input variables that will be used for prediction.
  
  binner_dict_:
       Dictionary with the interval limits per numerical variable.
  
  encoder_dict_:
      Dictionary with the mean target value per category or interval, per variable.
  
  n_features_in_:
      The number of features in the train set used in fit.
  
  feature_names_in_:
      List with the names of features seen during `fit`.
  
  See Also
  --------
  feature_engine.encoding.MeanEncoder
  feature_engine.discretisation.EqualWidthDiscretiser
  feature_engine.discretisation.EqualFrequencyDiscretiser
  
  References
  ----------
  Adapted from:
  
  .. [1] Miller, et al. "Predicting customer behaviour: The University of Melbourne’s
      KDD Cup report". JMLR Workshop and Conference Proceeding. KDD 2009
      http://proceedings.mlr.press/v7/miller09/miller09.pdf
docstr: Learn the mean target value per category or bin.
  
  Parameters
  ----------
  X : pandas dataframe of shape = [n_samples, n_features]
      The training input samples.
  
  y : pandas series of shape = [n_samples,]
      The target variable.
docstr_tok: ["Learn","the","mean","target","value","per","category","or","bin",".","Parameters","--","--","--","--","--","X",":","pandas","dataframe","of","shape","=","[","n_samples",",","n_features","]","The","training","input","samples",".","y",":","pandas","series","of","shape","=","[","n_samples",",","]","The","target","variable","."]
code: def fit(self, X: pd.DataFrame, y: pd.Series):
      """
      Learn the mean target value per category or bin.
  
      Parameters
      ----------
      X : pandas dataframe of shape = [n_samples, n_features]
          The training input samples.
  
      y : pandas series of shape = [n_samples,]
          The target variable.
      """
      # check if 'X' is a dataframe
      X, y = check_X_y(X, y)
  
      # find categorical and numerical variables
      (
          self.variables_categorical_,
          self.variables_numerical_,
      ) = _find_categorical_and_numerical_variables(X, self.variables)
  
      # check for missing values
      _check_contains_na(X, self.variables_numerical_)
      _check_contains_na(X, self.variables_categorical_)
  
      # check inf
      _check_contains_inf(X, self.variables_numerical_)
  
      # Create pipelines
      if self.variables_categorical_ and self.variables_numerical_:
          self._pipeline = self._make_combined_pipeline()
  
      elif self.variables_categorical_:
          self._pipeline = self._make_categorical_pipeline()
  
      else:
          self._pipeline = self._make_numerical_pipeline()
  
      # Train pipeline
      self._pipeline.fit(X, y)
  
      # Assign attributes (useful to interpret features)
      # Use dict() to make a copy of the dictionary. Otherwise, like in pandas,
      # it is just another view of the same data, mind-blowing.
      if self.variables_categorical_ and self.variables_numerical_:
          self.binner_dict_ = dict(
              self._pipeline.named_steps["discretiser"].binner_dict_
          )
          self.encoder_dict_ = dict(
              self._pipeline.named_steps["encoder_num"].encoder_dict_
          )
          tmp_dict = dict(
              self._pipeline.named_steps["encoder_cat"].encoder_dict_
          )
          self.encoder_dict_.update(tmp_dict)
  
      elif self.variables_categorical_:
          self.binner_dict_ = {}
          self.encoder_dict_ = dict(self._pipeline.encoder_dict_)
  
      else:
          self.binner_dict_ = dict(
              self._pipeline.named_steps["discretiser"].binner_dict_
          )
          self.encoder_dict_ = dict(
              self._pipeline.named_steps["encoder"].encoder_dict_
          )
  
      # store input features
      self.n_features_in_ = X.shape[1]
      self.feature_names_in_ = list(X.columns)
  
      return self
  
imports: from typing import List, Union
  import numpy
  import pandas
  from sklearn.base import BaseEstimator
  from sklearn.pipeline import Pipeline
  from sklearn.utils.validation import check_is_fitted
  from feature_engine._variable_handling.init_parameter_checks import _check_init_parameter_variables
  from feature_engine._variable_handling.variable_type_selection import _find_categorical_and_numerical_variables
  from feature_engine.dataframe_checks import _check_contains_inf, _check_contains_na, _check_X_matches_training_df, check_X, check_X_y
  from feature_engine.discretisation import EqualFrequencyDiscretiser, EqualWidthDiscretiser
  from feature_engine.encoding import MeanEncoder
  from feature_engine.tags import _return_tags
label_desc: Use image node_id 2 for calling the BaseTargetMeanEstimator obj's underlying member method code with example usage: obj.fit(X, y) and returns: self