class_docstr: Calculate model-level variable profiles as Partial or Accumulated Dependence
  
  - Partial Dependence Profile (average across Ceteris Paribus Profiles),
  - Individual Conditional Expectation (local weighted average across CP Profiles),
  - Accumulated Local Effects (cumulated average local changes in CP Profiles).
  
  Parameters
  -----------
  type : {'partial', 'accumulated', 'conditional'}
      Type of model profiles
      (default is `'partial'` for Partial Dependence Profiles).
  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).
  variable_type : {'numerical', 'categorical'}
      Calculate the profiles for numerical or categorical variables
      (default is `'numerical'`).
  groups : str or array_like of str, optional
      Names of categorical variables that will be used for profile grouping
      (default is `None`, which means no grouping).
  span : float, optional
      Smoothing coefficient used as sd for gaussian kernel (default is `0.25`).
  center : bool, optional
      Theoretically Accumulated Profiles start at `0`, but are centered to compare
      them with Partial Dependence Profiles (default is `True`, which means center
      around the average y_hat calculated on the data sample).
  random_state : int, optional
      Set seed for random number generator (default is random seed).
  
  Attributes
  -----------
  result : pd.DataFrame
      Main result attribute of an explanation.
  mean_prediction : float
      Average prediction for sampled `data` (using `N`).
  raw_profiles : pd.DataFrame or None
      Saved CeterisParibus object.
      NOTE: `None` if more objects were passed to the `fit` method.
  type : {'partial', 'accumulated', 'conditional'}
      Type of model profiles.
  variables : array_like of str or None
      Variables for which the profiles will be calculated
  variable_type : {'numerical', 'categorical'}
      Calculate the profiles for numerical or categorical variables.
  groups : str or array_like of str or None
      Names of categorical variables that will be used for profile grouping.
  span : float
      Smoothing coefficient used as sd for gaussian kernel.
  center : bool
      Theoretically Accumulated Profiles start at `0`, but are centered to compare
      them with Partial Dependence Profiles (default is `True`, which means center
      around the average y_hat calculated on the data sample).
  random_state : int or None
      Set seed for random number generator.
  
  Notes
  --------
  - https://pbiecek.github.io/ema/partialDependenceProfiles.html
  - https://pbiecek.github.io/ema/accumulatedLocalProfiles.html
class_docstr_tok: ["Calculate","model-level","variable","profiles","as","Partial","or","Accumulated","Dependence","-","Partial","Dependence","Profile","(","average","across","Ceteris","Paribus","Profiles",")",",","-","Individual","Conditional","Expectation","(","local","weighted","average","across","CP","Profiles",")",",","-","Accumulated","Local","Effects","(","cumulated","average","local","changes","in","CP","Profiles",")",".","Parameters","--","--","--","--","--","-","type",":","{","'partial","'",",","'accumulated","'",",","'conditional","'","}","Type","of","model","profiles","(","default","is","`","'partial","'","`","for","Partial","Dependence","Profiles",")",".","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",")",".","variable_type",":","{","'numerical","'",",","'categorical","'","}","Calculate","the","profiles","for","numerical","or","categorical","variables","(","default","is","`","'numerical","'","`",")",".","groups",":","str","or","array_like","of","str",",","optional","Names","of","categorical","variables","that","will","be","used","for","profile","grouping","(","default","is","`","None","`",",","which","means","no","grouping",")",".","span",":","float",",","optional","Smoothing","coefficient","used","as","sd","for","gaussian","kernel","(","default","is","`","0.25","`",")",".","center",":","bool",",","optional","Theoretically","Accumulated","Profiles","start","at","`","0","`",",","but","are","centered","to","compare","them","with","Partial","Dependence","Profiles","(","default","is","`","True","`",",","which","means","center","around","the","average","y_hat","calculated","on","the","data","sample",")",".","random_state",":","int",",","optional","Set","seed","for","random","number","generator","(","default","is","random","seed",")",".","Attributes","--","--","--","--","--","-","result",":","pd.DataFrame","Main","result","attribute","of","an","explanation",".","mean_prediction",":","float","Average","prediction","for","sampled","`","data","`","(","using","`","N","`",")",".","raw_profiles",":","pd.DataFrame","or","None","Saved","CeterisParibus","object",".","NOTE",":","`","None","`","if","more","objects","were","passed","to","the","`","fit","`","method",".","type",":","{","'partial","'",",","'accumulated","'",",","'conditional","'","}","Type","of","model","profiles",".","variables",":","array_like","of","str","or","None","Variables","for","which","the","profiles","will","be","calculated","variable_type",":","{","'numerical","'",",","'categorical","'","}","Calculate","the","profiles","for","numerical","or","categorical","variables",".","groups",":","str","or","array_like","of","str","or","None","Names","of","categorical","variables","that","will","be","used","for","profile","grouping",".","span",":","float","Smoothing","coefficient","used","as","sd","for","gaussian","kernel",".","center",":","bool","Theoretically","Accumulated","Profiles","start","at","`","0","`",",","but","are","centered","to","compare","them","with","Partial","Dependence","Profiles","(","default","is","`","True","`",",","which","means","center","around","the","average","y_hat","calculated","on","the","data","sample",")",".","random_state",":","int","or","None","Set","seed","for","random","number","generator",".","Notes","--","--","--","--","-","https",":","\/\/pbiecek.github.io\/ema\/partialDependenceProfiles.html","-","https",":","\/\/pbiecek.github.io\/ema\/accumulatedLocalProfiles.html"]
docstr: Calculate the result of explanation
  
  Fit method makes calculations in place and changes the attributes.
  
  Parameters
  -----------
  ceteris_paribus : CeterisParibus object or array_like of CeterisParibus objects
      Profile objects to aggregate.
  verbose : bool, optional
      Print tqdm progress bar (default is `True`).
  
  Returns
  -----------
  None
docstr_tok: ["Calculate","the","result","of","explanation","Fit","method","makes","calculations","in","place","and","changes","the","attributes",".","Parameters","--","--","--","--","--","-","ceteris_paribus",":","CeterisParibus","object","or","array_like","of","CeterisParibus","objects","Profile","objects","to","aggregate",".","verbose",":","bool",",","optional","Print","tqdm","progress","bar","(","default","is","`","True","`",")",".","Returns","--","--","--","--","--","-","None"]
code: def fit(self, ceteris_paribus, verbose=True):
      """Calculate the result of explanation
  
      Fit method makes calculations in place and changes the attributes.
  
      Parameters
      -----------
      ceteris_paribus : CeterisParibus object or array_like of CeterisParibus objects
          Profile objects to aggregate.
      verbose : bool, optional
          Print tqdm progress bar (default is `True`).
  
      Returns
      -----------
      None
      """
      # are there any other cp?
      from dalex.predict_explanations import CeterisParibus
  
      if isinstance(
          ceteris_paribus, CeterisParibus
      ):  # allow for ceteris_paribus to be a single element
          all_profiles = ceteris_paribus.result.copy()
          all_observations = ceteris_paribus.new_observation.copy()
          self.raw_profiles = deepcopy(ceteris_paribus)
      elif isinstance(
          ceteris_paribus, (list, tuple)
      ):  # ceteris_paribus as tuple or array
          all_profiles = None
          all_observations = None
          for cp in ceteris_paribus:
              _global_checks.global_check_object_class(
                  cp, CeterisParibus
              )
              all_profiles = pd.concat([all_profiles, cp.result.copy()])
              all_observations = pd.concat(
                  [all_observations, cp.new_observation.copy()]
              )
      else:
          _global_checks.global_raise_objects_class(
              ceteris_paribus, CeterisParibus
          )
  
      all_profiles, vnames = utils.prepare_numerical_categorical(
          all_profiles, self.variables, self.variable_type
      )
  
      # select only suitable variables
      all_profiles = all_profiles.loc[
          all_profiles["_vname_"].isin(vnames), :
      ]
  
      all_profiles = utils.prepare_x(all_profiles, self.variable_type)
  
      self.mean_prediction = all_observations["_yhat_"].mean()
  
      self.result = utils.aggregate_profiles(
          all_profiles,
          self.mean_prediction,
          self.type,
          self.groups,
          self.center,
          self.span,
          verbose,
      )
  
file_path: DALEX/python/dalex/dalex/model_explanations/_aggregated_profiles/object.py
imports: import numpy
  import pandas
  import plotly.express
  from copy import deepcopy
  from .None import checks, utils
  from ...None import _theme, _global_checks, _global_utils
  from ..._explanation import Explanation
label_desc: Use image node_id 3 for calling the AggregatedProfiles obj's underlying member method code with example usage: obj.fit(ceteris_paribus, verbose) without return types