class_docstr: Calculate model-level variable importance
  
  Parameters
  -----------
  loss_function : {'rmse', '1-auc', 'mse', 'mae', 'mad'} or function, optional
      If string, then such loss function will be used to assess variable importance
      (default is `'rmse'` or `'1-auc'`, depends on `model_type` attribute).
  type : {'variable_importance', 'ratio', 'difference'}, optional
      Type of transformation that will be applied to dropout loss.
  N : int, optional
      Number of observations that will be sampled from the `data` attribute before
      the calculation of variable importance. 
      `None` means all `data` (default is `1000`).
  B : int, optional
      Number of permutation rounds to perform on each variable (default is `10`).
  variables : array_like of str, optional
      Variables for which the importance will be calculated
      (default is `None`, which means all of the variables).
      NOTE: Ignored if `variable_groups` is not None.
  variable_groups : dict of lists, optional
      Group the variables to calculate their joint variable importance
      e.g. `{'X': ['x1', 'x2'], 'Y': ['y1', 'y2']}` (default is `None`).
  keep_raw_permutations: bool, optional
      Save results for all permutation rounds (default is `True`).
  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.
  loss_function : function
      Loss function used to assess the variable importance.
  type : {'variable_importance', 'ratio', 'difference'}
      Type of transformation that will be applied to dropout loss.
  N : int
      Number of observations that will be sampled from the `data` attribute 
      before the calculation of variable importance.
  B : int
      Number of permutation rounds to perform on each variable.
  variables : array_like of str or None
      Variables for which the importance will be calculated
  variable_groups : dict of lists or None
      Grouped variables to calculate their joint variable importance.
  keep_raw_permutations: bool
      Save the results for all permutation rounds.
  permutation : pd.DataFrame or None
      The results for all permutation rounds.
  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://pbiecek.github.io/ema/featureImportance.html
docstr: Calculate the result of explanation
  
  Fit method makes calculations in place and changes the attributes.
  
  Parameters
  -----------
  explainer : Explainer object
      Model wrapper created using the Explainer class.
  
  Returns
  -----------
  None
code: def fit(self, explainer):
      """Calculate the result of explanation
  
      Fit method makes calculations in place and changes the attributes.
  
      Parameters
      -----------
      explainer : Explainer object
          Model wrapper created using the Explainer class.
  
      Returns
      -----------
      None
      """
  
      # if `variable_groups` are not specified, then extract from `variables`
      self.variable_groups = checks.check_variable_groups(
          self.variable_groups, explainer
      )
      self.variables = checks.check_variables(
          self.variables, self.variable_groups, explainer
      )
      (
          self.result,
          self.permutation,
      ) = utils.calculate_variable_importance(
          explainer,
          self.type,
          self.loss_function,
          self.variables,
          self.N,
          self.B,
          explainer.label,
          self.processes,
          self.keep_raw_permutations,
          self.random_state,
      )
  
file_path: DALEX/python/dalex/dalex/model_explanations/_variable_importance/object.py
imports: import numpy
  import pandas
  from plotly.subplots import make_subplots
  from .None import checks, plot, utils
  from ...None import _theme, _global_checks
  from ..._explanation import Explanation
label_desc: Use image node_id 3 for calling the VariableImportance obj's underlying member method code with example usage: obj.fit(explainer) without return types