code: def append_group_importance(
      term_list,
      ebm,
      X,
      group_name=None,
      global_exp=None,
      global_exp_name=None,
      contributions=None,
  ):
      """Computes the importance of a group of terms and appends it to a global explanation.
  
      In case a global explanation is provided, the group importance will be appended to it and returned.
      Otherwise, a new global explanation will be creted and returned.
  
      The group importance will only be displayed in the Summary graph.
  
      Args:
          term_list: A list of term names or indices
          ebm: A fitted EBM
          X (numpy array): Samples used to compute the group importance
          group_name (str, optional): User-defined group name
          global_exp (EBMExplanation, optional): User-defined global explanation object
          global_exp_name (str, optional): User-defined name when creating a new global explanation
          contributions (numpy array, optional): Contributions of all terms per X's row
  
      Returns:
          EBMExplanation: A global explanation with the group importance appended to it
      """
      check_is_fitted(ebm, "has_fitted_")
  
      if global_exp is not None:
          if global_exp.explanation_type != "global":
              raise ValueError(
                  f"The provided explanation is {global_exp.explanation_type} but a global explanation is expected."
              )
          elif (
              global_exp._internal_obj is None
              or global_exp._internal_obj["overall"] is None
          ):
              raise ValueError(
                  "The global explanation object is incomplete."
              )
          else:
              global_explanation = global_exp
      else:
          global_explanation = ebm.explain_global(global_exp_name)
  
      if group_name is None:
          group_name = _get_group_name(term_list, ebm.term_names_)
  
      if (
          group_name
          in global_explanation._internal_obj["overall"]["names"]
      ):
          raise ValueError(
              f"The group {group_name} is already in the global explanation."
          )
  
      group_importance = compute_group_importance(
          term_list, ebm, X, contributions
      )
  
      global_explanation._internal_obj["overall"]["names"].append(
          group_name
      )
      global_explanation._internal_obj["overall"]["scores"].append(
          group_importance
      )
  
      return global_explanation
  
file_path: interpret/python/interpret-core/interpret/glassbox/_ebm/_research/_group_importance.py
imports: import numpy
  import pandas
  import plotly.express
  from sklearn.utils.validation import check_is_fitted
label_desc: Use image node_id 3 for calling a global function with example usage: append_group_importance(term_list, ebm, X, group_name, global_exp, global_exp_name, contributions) and returns: global_explanation