class_docstr: Calculate model-level residuals diagnostics
  
  Parameters
  -----------
  variables : str or array_like of str, optional
      Variables for which the profiles will be calculated
      (default is `None`, which means all of the variables).
  
  Attributes
  -----------
  result : pd.DataFrame
      Main result attribute of an explanation.
  variables : array_like of str or None
      Variables for which the profiles will be calculated.
  
  Notes
  --------
  - https://pbiecek.github.io/ema/residualDiagnostic.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
      """
      result = explainer.data.copy()
  
      # if variables = NULL then all variables are added
      # otherwise only selected
      if self.variables is not None:
          result = result.loc[
              :,
              _global_utils.intersect_unsorted(
                  self.variables, result.columns
              ),
          ]
      # is there target
      if explainer.y is not None:
          result = result.assign(y=explainer.y)
      # are there predictions - add y_hat to the Explainer for the future
      if explainer.y_hat is None:
          explainer.y_hat = explainer.predict(explainer.data)
      # are there residuals - add residuals to the Explainer for the future
      if explainer.residuals is None:
          explainer.residuals = explainer.residual(
              explainer.data, explainer.y
          )
  
      self.result = result.assign(
          y_hat=explainer.y_hat,
          residuals=explainer.residuals,
          abs_residuals=np.abs(explainer.residuals),
          label=explainer.label,
          ids=np.arange(result.shape[0]) + 1,
      )
  
file_path: DALEX/python/dalex/dalex/model_explanations/_residual_diagnostics/object.py
imports: import numpy
  import pandas
  import plotly.express
  from .None import checks
  from ...None import _theme, _global_checks, _global_utils
  from ..._explanation import Explanation
label_desc: Use image node_id 3 for calling the ResidualDiagnostics obj's underlying member method code with example usage: obj.fit(explainer) without return types