class_docstr: Grouped Conditional Expectation plots are generated for a given instance and set of features.
  They show how the model prediction is affected when a pair of features of a given instance are
  perturbed. The perturbed features can be either a provided subset of the input covariates, or
  the top K features based on the importance rank obtained by a global explainer (e.g., SHAP).
  If the user provides a single feature then the algorithm produces a standard ICE plot where the
  selected feature varies according to a linespace grid. If the user chooses more than one feature,
  then the explainer produces 3D ICE plots. Here, two features vary simultaneously according to a
  meshgrid, the output of the model is stored for each pair of values.
docstr: GroupedCEExplainer initialization.
  
  Args:
      model (Callable): model prediction (predict/predict_proba) function that
          results a real value like probability or regressed value.
      data (List[object]): Input dataset used for model training. Feature range is computed from
          this input dataset. The dataset is used in selected feature importance methods such as
          SHAP to determine top K features for group explanation.
      feature_names (List[str]): List of valid numerical feature names in the input dataset. Defaults
          to None.
      n_samples (int, optional): Number of discrete points sampled per feature. Defaults to 25.
      features_selected (List[str], optional): List of features that will be considered in the
          explanation. If list contains single feature, GroupedCEExplainer return standard ICE
          explanation. Otherwise, returns grouped explanation for 3D ICE plots.
      top_k_features (int, optional): Top K importance features to consider if features_selected
          is an empty list. If top_k_features <= 0, all the features are selected for explanation.
          Defaults to -1.
      feature_importance_method (str,optional): Importance feature method to be used if
          top_k_features is > 0 and features_selected is empty. Defaults to 'SHAP'.
      max_dataset_size (int): maximum dataset size used during selected feature importance method
          (feature_importance_method). Defaults to 10.
docstr_tok: ["GroupedCEExplainer","initialization",".","Args",":","model","(","Callable",")",":","model","prediction","(","predict\/predict_proba",")","function","that","results","a","real","value","like","probability","or","regressed","value",".","data","(","List","[","object","]",")",":","Input","dataset","used","for","model","training",".","Feature","range","is","computed","from","this","input","dataset",".","The","dataset","is","used","in","selected","feature","importance","methods","such","as","SHAP","to","determine","top","K","features","for","group","explanation",".","feature_names","(","List","[","str","]",")",":","List","of","valid","numerical","feature","names","in","the","input","dataset",".","Defaults","to","None",".","n_samples","(","int",",","optional",")",":","Number","of","discrete","points","sampled","per","feature",".","Defaults","to","25.","features_selected","(","List","[","str","]",",","optional",")",":","List","of","features","that","will","be","considered","in","the","explanation",".","If","list","contains","single","feature",",","GroupedCEExplainer","return","standard","ICE","explanation",".","Otherwise",",","returns","grouped","explanation","for","3D","ICE","plots",".","top_k_features","(","int",",","optional",")",":","Top","K","importance","features","to","consider","if","features_selected","is","an","empty","list",".","If","top_k_features","<","=","0",",","all","the","features","are","selected","for","explanation",".","Defaults","to","-1.","feature_importance_method","(","str",",","optional",")",":","Importance","feature","method","to","be","used","if","top_k_features","is",">","0","and","features_selected","is","empty",".","Defaults","to","'SHAP","'",".","max_dataset_size","(","int",")",":","maximum","dataset","size","used","during","selected","feature","importance","method","(","feature_importance_method",")",".","Defaults","to","10","."]
code: def __init__(
      self,
      model: Callable,
      data: Union[int, List[List[object]]],
      feature_names: List[str] = None,
      n_samples: int = 25,
      features_selected: list = None,
      top_k_features: int = -1,
      feature_importance_method: str = "SHAP",
      max_dataset_size: int = 10,
      random_seed: int = None,
      **kwargs,
  ):
      """GroupedCEExplainer initialization.
  
      Args:
          model (Callable): model prediction (predict/predict_proba) function that
              results a real value like probability or regressed value.
          data (List[object]): Input dataset used for model training. Feature range is computed from
              this input dataset. The dataset is used in selected feature importance methods such as
              SHAP to determine top K features for group explanation.
          feature_names (List[str]): List of valid numerical feature names in the input dataset. Defaults
              to None.
          n_samples (int, optional): Number of discrete points sampled per feature. Defaults to 25.
          features_selected (List[str], optional): List of features that will be considered in the
              explanation. If list contains single feature, GroupedCEExplainer return standard ICE
              explanation. Otherwise, returns grouped explanation for 3D ICE plots.
          top_k_features (int, optional): Top K importance features to consider if features_selected
              is an empty list. If top_k_features <= 0, all the features are selected for explanation.
              Defaults to -1.
          feature_importance_method (str,optional): Importance feature method to be used if
              top_k_features is > 0 and features_selected is empty. Defaults to 'SHAP'.
          max_dataset_size (int): maximum dataset size used during selected feature importance method
              (feature_importance_method). Defaults to 10.
      """
      self.model = model
      self.feature_names = feature_names
      self.n_samples = n_samples
      self.max_allowed_feature = 4
      self.feature_range = {}
      self.max_dataset_size = max_dataset_size
      self.random_seed = random_seed
      super(GroupedCEExplainer, self).__init__(**kwargs)
  
      ## FEATURES SELECTED: Options : All features, features specified by user , use top K important features
      if features_selected is None:
          features_selected = []
      self.features_selected = features_selected
      self.top_k_features = top_k_features
      self.feature_importance_method = feature_importance_method
      self._is_fitted = False
      if self.feature_names is None:
          data = pd.DataFrame(data)
          self.feature_names = list(data.columns)
      else:
          data = pd.DataFrame(data, columns=self.feature_names)
  
      self.fit(data)
  
file_path: AIX360/aix360/algorithms/gce/gce.py
imports: import warnings
  from typing import List, Union, Callable
  import numpy
  import pandas
  import shap
  from aix360.algorithms.lbbe import LocalBBExplainer
label_desc: Use image node_id 1 to create a new GroupedCEExplainer object from inherited base classes: LocalBBExplainer with example: obj = GroupedCEExplainer(model, data, feature_names, n_samples, features_selected, top_k_features, feature_importance_method, max_dataset_size, random_seed)