class_docstr: Create Aspect
  
  Explanation methods that do not take into account dependencies between variables
  can produce misleading results. This class creates a representation of a model based
  on an Explainer object. In addition, it calculates the relationships between
  the variables that can be used to create explanations. Methods of this class produce
  explanation objects, that contain the main result attribute, and can be visualised
  using the plot method.
  
  The `explainer` is the only required parameter.
  
  Parameters
  ----------
  explainer : Explainer object
      Model wrapper created using the Explainer class.
  depend_method: {'assoc', 'pps'} or function, optional
      The method of calculating the dependencies between variables (i.e. the dependency
      matrix). Default is `'assoc'`, which means the use of statistical association
      (correlation coefficient, Cramér's V based on Pearson's chi-squared statistic 
      and eta-quared based on Kruskal-Wallis H-statistic);
      `'pps'` stands for Power Predictive Score.
      NOTE: When a function is passed, it is called with the `explainer.data` and it
      must return a symmetric dependency matrix (`pd.DataFrame` with variable names as
      columns and rows).
  clust_method : {'complete', 'single', 'average', 'weighted', 'centroid', 'median', 'ward'}, optional
      The linkage algorithm to use for variables hierarchical clustering
      (default is `'complete'`).
  corr_method : {'spearman', 'pearson', 'kendall'}, optional
      The method of calculating correlation between numerical variables
      (default is `'spearman'`).
      NOTE: Ignored if `depend_method` is not `'assoc'`.
  agg_method : {'max', 'min', 'avg'}, optional
      The method of aggregating the PPS values for pairs of variables
      (default is `'max'`).
      NOTE: Ignored if `depend_method` is not `'pps'`.
  
  Attributes
  --------
  explainer : Explainer object
      Model wrapper created using the Explainer class.
  depend_method : {'assoc', 'pps'} or function
      The method of calculating the dependencies between variables.
  clust_method : {'complete', 'single', 'average', 'weighted', 'centroid', 'median', 'ward'}
      The linkage algorithm to use for variables hierarchical clustering.
  corr_method : {'spearman', 'pearson', 'kendall'}
      The method of calculating correlation between numerical variables.
  agg_method : {'max', 'min', 'avg'}
      The method of aggregating the PPS values for pairs of variables.
  depend_matrix : pd.DataFrame
      The dependency matrix (with variable names as columns and rows).
  linkage_matrix :
      The hierarchical clustering of variables encoded as a `scipy` linkage matrix.
  
  Notes
  -----
  - assoc, eta-squared: http://tss.awf.poznan.pl/files/3_Trends_Vol21_2014__no1_20.pdf
  - assoc, Cramér's V: http://stats.lse.ac.uk/bergsma/pdf/cramerV3.pdf
  - PPS: https://github.com/8080labs/ppscore
  - triplot: https://arxiv.org/abs/2104.03403
class_docstr_tok: ["Create","Aspect","Explanation","methods","that","do","not","take","into","account","dependencies","between","variables","can","produce","misleading","results",".","This","class","creates","a","representation","of","a","model","based","on","an","Explainer","object",".","In","addition",",","it","calculates","the","relationships","between","the","variables","that","can","be","used","to","create","explanations",".","Methods","of","this","class","produce","explanation","objects",",","that","contain","the","main","result","attribute",",","and","can","be","visualised","using","the","plot","method",".","The","`","explainer","`","is","the","only","required","parameter",".","Parameters","--","--","--","--","--","explainer",":","Explainer","object","Model","wrapper","created","using","the","Explainer","class",".","depend_method",":","{","'assoc","'",",","'pps","'","}","or","function",",","optional","The","method","of","calculating","the","dependencies","between","variables","(","i.e",".","the","dependency","matrix",")",".","Default","is","`","'assoc","'","`",",","which","means","the","use","of","statistical","association","(","correlation","coefficient",",","Cram\u00e9r","'s","V","based","on","Pearson","'s","chi-squared","statistic","and","eta-quared","based","on","Kruskal-Wallis","H-statistic",")",";","`","'pps","'","`","stands","for","Power","Predictive","Score",".","NOTE",":","When","a","function","is","passed",",","it","is","called","with","the","`","explainer.data","`","and","it","must","return","a","symmetric","dependency","matrix","(","`","pd.DataFrame","`","with","variable","names","as","columns","and","rows",")",".","clust_method",":","{","'complete","'",",","'single","'",",","'average","'",",","'weighted","'",",","'centroid","'",",","'median","'",",","'ward","'","}",",","optional","The","linkage","algorithm","to","use","for","variables","hierarchical","clustering","(","default","is","`","'complete","'","`",")",".","corr_method",":","{","'spearman","'",",","'pearson","'",",","'kendall","'","}",",","optional","The","method","of","calculating","correlation","between","numerical","variables","(","default","is","`","'spearman","'","`",")",".","NOTE",":","Ignored","if","`","depend_method","`","is","not","`","'assoc","'","`",".","agg_method",":","{","'max","'",",","'min","'",",","'avg","'","}",",","optional","The","method","of","aggregating","the","PPS","values","for","pairs","of","variables","(","default","is","`","'max","'","`",")",".","NOTE",":","Ignored","if","`","depend_method","`","is","not","`","'pps","'","`",".","Attributes","--","--","--","--","explainer",":","Explainer","object","Model","wrapper","created","using","the","Explainer","class",".","depend_method",":","{","'assoc","'",",","'pps","'","}","or","function","The","method","of","calculating","the","dependencies","between","variables",".","clust_method",":","{","'complete","'",",","'single","'",",","'average","'",",","'weighted","'",",","'centroid","'",",","'median","'",",","'ward","'","}","The","linkage","algorithm","to","use","for","variables","hierarchical","clustering",".","corr_method",":","{","'spearman","'",",","'pearson","'",",","'kendall","'","}","The","method","of","calculating","correlation","between","numerical","variables",".","agg_method",":","{","'max","'",",","'min","'",",","'avg","'","}","The","method","of","aggregating","the","PPS","values","for","pairs","of","variables",".","depend_matrix",":","pd.DataFrame","The","dependency","matrix","(","with","variable","names","as","columns","and","rows",")",".","linkage_matrix",":","The","hierarchical","clustering","of","variables","encoded","as","a","`","scipy","`","linkage","matrix",".","Notes","--","--","-","-","assoc",",","eta-squared",":","http",":","\/\/tss.awf.poznan.pl\/files\/3_Trends_Vol21_2014__no1_20.pdf","-","assoc",",","Cram\u00e9r","'s","V",":","http",":","\/\/stats.lse.ac.uk\/bergsma\/pdf\/cramerV3.pdf","-","PPS",":","https",":","\/\/github.com\/8080labs\/ppscore","-","triplot",":","https",":","\/\/arxiv.org\/abs\/2104.03403"]
docstr: Calculate model-level hierarchical aspect importance
  
  Parameters
  ----------
  loss_function :  {'rmse', '1-auc', 'mse', 'mae', 'mad'} or function, optional
      If string, then such loss function will be used to assess aspect importance
      (default is `'rmse'` or `'1-auc'`, depends on `explainer.model_type` attribute).
  type : {'variable_importance', 'ratio', 'difference'}, optional
      Type of transformation that will be applied to dropout loss
      (default is `'variable_importance'`, which is Permutational Variable Importance).
  N : int, optional
      Number of observations that will be sampled from the `explainer.data` attribute before
      the calculation of aspect importance. `None` means all `data` (default is `1000`).
  B : int, optional
      Number of permutation rounds to perform on each variable (default is `10`).
  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).
  
  Returns
  -------
  ModelTriplot class object
      Explanation object containing the main result attribute and the plot method.
docstr_tok: ["Calculate","model-level","hierarchical","aspect","importance","Parameters","--","--","--","--","--","loss_function",":","{","'rmse","'",",","'","1-auc","'",",","'mse","'",",","'mae","'",",","'mad","'","}","or","function",",","optional","If","string",",","then","such","loss","function","will","be","used","to","assess","aspect","importance","(","default","is","`","'rmse","'","`","or","`","'","1-auc","'","`",",","depends","on","`","explainer.model_type","`","attribute",")",".","type",":","{","'variable_importance","'",",","'ratio","'",",","'difference","'","}",",","optional","Type","of","transformation","that","will","be","applied","to","dropout","loss","(","default","is","`","'variable_importance","'","`",",","which","is","Permutational","Variable","Importance",")",".","N",":","int",",","optional","Number","of","observations","that","will","be","sampled","from","the","`","explainer.data","`","attribute","before","the","calculation","of","aspect","importance",".","`","None","`","means","all","`","data","`","(","default","is","`","1000","`",")",".","B",":","int",",","optional","Number","of","permutation","rounds","to","perform","on","each","variable","(","default","is","`","10","`",")",".","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",")",".","Returns","--","--","--","-","ModelTriplot","class","object","Explanation","object","containing","the","main","result","attribute","and","the","plot","method","."]
code: def model_triplot(
      self,
      loss_function=None,
      type="variable_importance",
      N=1000,
      B=10,
      processes=1,
      random_state=None,
  ):
      """Calculate model-level hierarchical aspect importance
  
      Parameters
      ----------
      loss_function :  {'rmse', '1-auc', 'mse', 'mae', 'mad'} or function, optional
          If string, then such loss function will be used to assess aspect importance
          (default is `'rmse'` or `'1-auc'`, depends on `explainer.model_type` attribute).
      type : {'variable_importance', 'ratio', 'difference'}, optional
          Type of transformation that will be applied to dropout loss
          (default is `'variable_importance'`, which is Permutational Variable Importance).
      N : int, optional
          Number of observations that will be sampled from the `explainer.data` attribute before
          the calculation of aspect importance. `None` means all `data` (default is `1000`).
      B : int, optional
          Number of permutation rounds to perform on each variable (default is `10`).
      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).
  
      Returns
      -------
      ModelTriplot class object
          Explanation object containing the main result attribute and the plot method.
      """
  
      loss_function = checks.check_method_loss_function(
          self.explainer, loss_function
      )  # get proper loss_function for model_type
      mt = ModelTriplot(
          loss_function, type, N, B, processes, random_state
      )
      self._mt_params = {
          "loss_function": loss_function,
          "type": type,
          "N": N,
          "B": B,
      }  # save params for future calls of model_parts
      mt.fit(self)
  
      return mt
  
file_path: DALEX/python/dalex/dalex/aspect/object.py
imports: import numpy
  import pandas
  from dalex.aspect._model_aspect_importance.object import ModelAspectImportance
  from dalex.aspect._predict_aspect_importance.object import PredictAspectImportance
  from dalex.aspect._model_triplot.object import ModelTriplot
  from dalex.aspect._predict_triplot.object import PredictTriplot
  from .None import utils, checks, plot
  from ..None import _theme
label_desc: Use image node_id 7 for calling the Aspect obj's underlying member method code with example usage: obj.model_triplot(loss_function, type, N, B, processes, random_state) and returns: mt