class_docstr: Generates plots displaying the average values of target variables
  across distinct groups (or buckets) of a single feature.
  
  These plots provide insights into how the target's average values change with
  respect to the different groups of a chosen feature. This understanding is
  crucial for comprehensive feature analysis and facilitates the interpretation
  of model predictions.
  
  Attributes
  ----------
  df : pd.DataFrame
      A processed DataFrame that includes feature and target (for target plot) or
      predict (for predict plot) columns, feature buckets, along with the count
      of samples within each bucket.
  feature_info : :class:`FeatureInfo`
      An instance of the `FeatureInfo` class.
  feature_cols : list of str
      List of feature columns.
  target : list of int
      List of target indices. For binary and regression problems, the list will
      be just [0]. For multi-class targets, the list is the class indices.
  n_classes : int
      The number of classes inferred from the target columns.
  plot_type : str
      The type of the plot to be generated.
  plot_engines : dict
      A dictionary that maps plot types to their plotting engines.
  count_df : pd.DataFrame
      A DataFrame that contains the count as well as the normalized count
      (percentage) of samples within each feature bucket.
  summary_df : pd.DataFrame
      A DataFrame that contains the summary statistics of target (for target
      plot) or predict (for predict plot) values for each feature bucket.
  target_lines : list of pd.DataFrame
      A list of DataFrames, each DataFrame includes aggregate metrics across
      feature buckets for a target (for target plot) or predict (for predict
      plot) variable. For binary and regression problems, the list will contain a
      single DataFrame. For multi-class targets, the list will contain a
      DataFrame for each class.
  
  Methods
  -------
  plot(**kwargs) :
      Generates the plot.
class_docstr_tok: ["Generates","plots","displaying","the","average","values","of","target","variables","across","distinct","groups","(","or","buckets",")","of","a","single","feature",".","These","plots","provide","insights","into","how","the","target","'s","average","values","change","with","respect","to","the","different","groups","of","a","chosen","feature",".","This","understanding","is","crucial","for","comprehensive","feature","analysis","and","facilitates","the","interpretation","of","model","predictions",".","Attributes","--","--","--","--","--","df",":","pd.DataFrame","A","processed","DataFrame","that","includes","feature","and","target","(","for","target","plot",")","or","predict","(","for","predict","plot",")","columns",",","feature","buckets",",","along","with","the","count","of","samples","within","each","bucket",".","feature_info",":",":","class",":","`","FeatureInfo","`","An","instance","of","the","`","FeatureInfo","`","class",".","feature_cols",":","list","of","str","List","of","feature","columns",".","target",":","list","of","int","List","of","target","indices",".","For","binary","and","regression","problems",",","the","list","will","be","just","[","0","]",".","For","multi-class","targets",",","the","list","is","the","class","indices",".","n_classes",":","int","The","number","of","classes","inferred","from","the","target","columns",".","plot_type",":","str","The","type","of","the","plot","to","be","generated",".","plot_engines",":","dict","A","dictionary","that","maps","plot","types","to","their","plotting","engines",".","count_df",":","pd.DataFrame","A","DataFrame","that","contains","the","count","as","well","as","the","normalized","count","(","percentage",")","of","samples","within","each","feature","bucket",".","summary_df",":","pd.DataFrame","A","DataFrame","that","contains","the","summary","statistics","of","target","(","for","target","plot",")","or","predict","(","for","predict","plot",")","values","for","each","feature","bucket",".","target_lines",":","list","of","pd.DataFrame","A","list","of","DataFrames",",","each","DataFrame","includes","aggregate","metrics","across","feature","buckets","for","a","target","(","for","target","plot",")","or","predict","(","for","predict","plot",")","variable",".","For","binary","and","regression","problems",",","the","list","will","contain","a","single","DataFrame",".","For","multi-class","targets",",","the","list","will","contain","a","DataFrame","for","each","class",".","Methods","--","--","--","-","plot","(","*","*","kwargs",")",":","Generates","the","plot","."]
docstr: Initialize a `TargetPlot` instance.
  
  Parameters
  ----------
  df : pd.DataFrame
      A DataFrame that at least contains the feature(s) and target columns.
  feature : str or list of str
      The column name(s) of the chosen feature. It is a list of str when the
      chosen feature is one-hot encoded.
  feature_name : str
      A custom name for the chosen feature.
  target : str or list of str
      The target column or columns (when it is multi-class).
  cust_grid_points : array-like or list of arrays, optional
      Custom grid points for the feature. For interact plot, it can also be a
      list of two arrays, indicating the grid points for each feature. Default is
      None.
  grid_type : {'percentile', 'equal'}, optional
      The grid type. Only applicable for numeric feature. Default is percentile.
  num_grid_points : int or list of int, optional
      The number of grid points to use. Only applicable for numeric feature. For
      interact plot, it can also be a list of two integers, indicating the number
      of grid points for each feature. Default is 10.
  percentile_range : tuple, optional
      A tuple of two values indicating the range of percentiles to use. Only
      applicable for numeric feature and when `grid_type` is 'percentile'. If it
      is None, will use all samples. Default is None.
  grid_range : tuple, optional
      A tuple of two values indicating the range of grid values to use. Only
      applicable for numeric feature. If it is None, will use all samples.
      Default is None.
  show_outliers : bool or list of bool, optional
      Whether to show outliers in the plot. Only applicable for numeric feature.
      For interact plot, it can also be a list of two booleans, indicating
      whether to show outliers for each feature. Default is False.
  endpoint : bool, optional
      Whether to include the endpoint of the range. Default is True.
docstr_tok: ["Initialize","a","`","TargetPlot","`","instance",".","Parameters","--","--","--","--","--","df",":","pd.DataFrame","A","DataFrame","that","at","least","contains","the","feature","(","s",")","and","target","columns",".","feature",":","str","or","list","of","str","The","column","name","(","s",")","of","the","chosen","feature",".","It","is","a","list","of","str","when","the","chosen","feature","is","one-hot","encoded",".","feature_name",":","str","A","custom","name","for","the","chosen","feature",".","target",":","str","or","list","of","str","The","target","column","or","columns","(","when","it","is","multi-class",")",".","cust_grid_points",":","array-like","or","list","of","arrays",",","optional","Custom","grid","points","for","the","feature",".","For","interact","plot",",","it","can","also","be","a","list","of","two","arrays",",","indicating","the","grid","points","for","each","feature",".","Default","is","None",".","grid_type",":","{","'percentile","'",",","'equal","'","}",",","optional","The","grid","type",".","Only","applicable","for","numeric","feature",".","Default","is","percentile",".","num_grid_points",":","int","or","list","of","int",",","optional","The","number","of","grid","points","to","use",".","Only","applicable","for","numeric","feature",".","For","interact","plot",",","it","can","also","be","a","list","of","two","integers",",","indicating","the","number","of","grid","points","for","each","feature",".","Default","is","10.","percentile_range",":","tuple",",","optional","A","tuple","of","two","values","indicating","the","range","of","percentiles","to","use",".","Only","applicable","for","numeric","feature","and","when","`","grid_type","`","is","'percentile","'",".","If","it","is","None",",","will","use","all","samples",".","Default","is","None",".","grid_range",":","tuple",",","optional","A","tuple","of","two","values","indicating","the","range","of","grid","values","to","use",".","Only","applicable","for","numeric","feature",".","If","it","is","None",",","will","use","all","samples",".","Default","is","None",".","show_outliers",":","bool","or","list","of","bool",",","optional","Whether","to","show","outliers","in","the","plot",".","Only","applicable","for","numeric","feature",".","For","interact","plot",",","it","can","also","be","a","list","of","two","booleans",",","indicating","whether","to","show","outliers","for","each","feature",".","Default","is","False",".","endpoint",":","bool",",","optional","Whether","to","include","the","endpoint","of","the","range",".","Default","is","True","."]
code: def __init__(
      self,
      df,
      feature,
      feature_name,
      target,
      cust_grid_points=None,
      grid_type="percentile",
      num_grid_points=10,
      percentile_range=None,
      grid_range=None,
      show_outliers=False,
      endpoint=True,
  ):
      """
      Initialize a `TargetPlot` instance.
  
      Parameters
      ----------
      df : pd.DataFrame
          A DataFrame that at least contains the feature(s) and target columns.
      feature : str or list of str
          The column name(s) of the chosen feature. It is a list of str when the
          chosen feature is one-hot encoded.
      feature_name : str
          A custom name for the chosen feature.
      target : str or list of str
          The target column or columns (when it is multi-class).
      cust_grid_points : array-like or list of arrays, optional
          Custom grid points for the feature. For interact plot, it can also be a
          list of two arrays, indicating the grid points for each feature. Default is
          None.
      grid_type : {'percentile', 'equal'}, optional
          The grid type. Only applicable for numeric feature. Default is percentile.
      num_grid_points : int or list of int, optional
          The number of grid points to use. Only applicable for numeric feature. For
          interact plot, it can also be a list of two integers, indicating the number
          of grid points for each feature. Default is 10.
      percentile_range : tuple, optional
          A tuple of two values indicating the range of percentiles to use. Only
          applicable for numeric feature and when `grid_type` is 'percentile'. If it
          is None, will use all samples. Default is None.
      grid_range : tuple, optional
          A tuple of two values indicating the range of grid values to use. Only
          applicable for numeric feature. If it is None, will use all samples.
          Default is None.
      show_outliers : bool or list of bool, optional
          Whether to show outliers in the plot. Only applicable for numeric feature.
          For interact plot, it can also be a list of two booleans, indicating
          whether to show outliers for each feature. Default is False.
      endpoint : bool, optional
          Whether to include the endpoint of the range. Default is True.
      """
      super().__init__(
          df,
          feature,
          feature_name,
          target,
          plot_type="target",
          cust_grid_points=cust_grid_points,
          grid_type=grid_type,
          num_grid_points=num_grid_points,
          percentile_range=percentile_range,
          grid_range=grid_range,
          show_outliers=show_outliers,
          endpoint=endpoint,
      )
  
imports: from .info_plot_utils import TargetPlotEngine, PredictPlotEngine, InteractInfoPlotEngine
  from .utils import _make_list, _check_target, _q1, _q2, _q3, FeatureInfo, _check_dataset, _check_model, _calc_preds, _check_classes, _expand_params_for_interact
  import pandas
  from itertools import product
label_desc: Use image node_id 1 to create a new TargetPlot object from inherited base classes: _InfoPlot with example: obj = TargetPlot(df, feature, feature_name, target, cust_grid_points, grid_type, num_grid_points, percentile_range, grid_range, show_outliers, endpoint)