class_docstr: Calculate predict-level hierarchical aspect importance
  
  Parameters
  ----------
  type : {'default', 'shap'}, optional
      Type of aspect importance/attributions (default is `'default'`, which means 
      the use of simplified LIME method).
  N : int, optional
      Number of observations that will be sampled from the `explainer.data` attribute
      before the calculation of aspect importance (default is `2000`).
  B : int, optional
      Parameter specific for `type == 'shap'`. Number of random paths to calculate aspect
      attributions (default is `25`).
      NOTE: Ignored if `type` is not `'shap'`.
  sample_method : {'default', 'binom'}, optional
      Parameter specific for `type == 'default'`. Sampling method for creating binary matrix 
      used as mask for replacing aspects in data (default is `'default'`, which means 
      it randomly replaces one or two zeros per row; `'binom'` replaces random number of zeros 
      per row).
      NOTE: Ignored if `type` is not `'default'`.
  f : int, optional
      Parameter specific for `type == 'default'` and `sample_method == 'binom'`. Parameter 
      controlling average number of replaced zeros for binomial sampling (default is `2`). 
      NOTE: Ignored if `type` is not `'default'` or `sample_method` is not `'binom'`.
  processes : int, optional
      Number of parallel processes to use in calculations. Iterated over `B`
      (default is `1`, which means no parallel computation).
  random_state : int, optional
      Set seed for random number generator (default is random seed).
  
  Attributes
  -----------
  result : pd.DataFrame
      Main result attribute of an explanation.
  single_variable_importance : pd.DataFrame
      Additional result attribute of an explanation (it contains information 
      about the importance of individual variables).
  prediction : float
      Prediction for `new_observation`.
  intercept : float
      Average prediction for `data`.
  type : {'default', 'shap'}
      Type of aspect importance/attributions to calculate.
  N : int
      Number of observations that will be sampled from the `data` attribute
      before the calculation of aspect importance.
  B : int
      Number of random paths to calculate aspect attributions.
  sample_method : {'default', 'binom'}
      Sampling method for creating binary matrix used as mask for replacing aspects in sampled data.
  f : int
      Average number of replaced zeros for binomial sampling.
  processes : int
      Number of parallel processes to use in calculations. Iterated over `B`.
  random_state : int or None
      Set seed for random number generator.
  
  Notes
  -----
  - https://arxiv.org/abs/2104.03403
docstr: Calculate the result of explanation
  Fit method makes calculations in place and changes the attributes.
  
  Parameters
  ----------
  aspect : Aspect object
      Explainer wrapper created using the Aspect class.
  new_observation : pd.Series or np.ndarray (1d) or pd.DataFrame (1,p)
      An observation for which a prediction needs to be explained.
  
  Returns
  -----------
  None
docstr_tok: ["Calculate","the","result","of","explanation","Fit","method","makes","calculations","in","place","and","changes","the","attributes",".","Parameters","--","--","--","--","--","aspect",":","Aspect","object","Explainer","wrapper","created","using","the","Aspect","class",".","new_observation",":","pd.Series","or","np.ndarray","(","1d",")","or","pd.DataFrame","(","1",",","p",")","An","observation","for","which","a","prediction","needs","to","be","explained",".","Returns","--","--","--","--","--","-","None"]
code: def fit(self, aspect, new_observation):
      """Calculate the result of explanation
      Fit method makes calculations in place and changes the attributes.
  
      Parameters
      ----------
      aspect : Aspect object
          Explainer wrapper created using the Aspect class.
      new_observation : pd.Series or np.ndarray (1d) or pd.DataFrame (1,p)
          An observation for which a prediction needs to be explained.
  
      Returns
      -----------
      None
      """
  
      _new_observation = checks.check_new_observation(
          new_observation, aspect.explainer
      )
      checks.check_columns_in_new_observation(
          _new_observation, aspect.explainer
      )
  
      self._hierarchical_clustering_dendrogram = (
          aspect._hierarchical_clustering_dendrogram
      )
  
      self.prediction = aspect.explainer.predict(_new_observation)[0]
      self.intercept = aspect.explainer.y_hat.mean()
  
      ## middle plot data
      self.result = utils.calculate_predict_hierarchical_importance(
          aspect,
          _new_observation,
          self.type,
          self.N,
          self.B,
          self.sample_method,
          self.f,
          self.processes,
          self.random_state,
      )
  
      self.result.insert(3, "min_depend", None)
      self.result.insert(4, "vars_min_depend", None)
      for index, row in self.result.iterrows():
          _matching_row = aspect._dendrogram_aspects_ordered.loc[
              pd.Series(
                  map(
                      set,
                      aspect._dendrogram_aspects_ordered.variable_names,
                  )
              )
              == set(row.variable_names)
          ]
          min_dep = _matching_row.min_depend.values[0]
          vars_min_depend = _matching_row.vars_min_depend.values[0]
          self.result.at[index, "min_depend"] = min_dep
          self.result.at[index, "vars_min_depend"] = vars_min_depend
  
      ## left plot data
      self.single_variable_importance = (
          utils.calculate_single_variable_importance(
              aspect,
              _new_observation,
              self.type,
              self.N,
              self.B,
              self.sample_method,
              self.f,
              self.processes,
              self.random_state,
          )
      )
  
file_path: DALEX/python/dalex/dalex/aspect/_predict_triplot/object.py
imports: import numpy
  import pandas
  import plotly.graph_objs
  from copy import deepcopy
  from dalex import _theme, _global_checks
  from dalex._explanation import Explanation
  from dalex.aspect._predict_aspect_importance.object import PredictAspectImportance
  from .None import checks, plot, utils
label_desc: Use image node_id 3 for calling the PredictTriplot obj's underlying member method code with example usage: obj.fit(aspect, new_observation) without return types