class_docstr: Implementation of the partial dependence(PD) variance feature importance and feature interaction for
  tabular datasets. The method measure the importance feature importance as the variance within the PD function.
  Similar, the potential feature interaction is measured by computing the variance within the two-way PD function
  by holding one variable constant and letting the other vary. Supports black-box models and the following `sklearn`
  tree-based models: `GradientBoostingClassifier`, `GradientBoostingRegressor`, `HistGradientBoostingClassifier`,
  `HistGradientBoostingRegressor`, `HistGradientBoostingRegressor`, `DecisionTreeRegressor`,
  `RandomForestRegressor`.
  
  For details of the method see the original paper: https://arxiv.org/abs/1805.04755 .
class_docstr_tok: ["Implementation","of","the","partial","dependence","(","PD",")","variance","feature","importance","and","feature","interaction","for","tabular","datasets",".","The","method","measure","the","importance","feature","importance","as","the","variance","within","the","PD","function",".","Similar",",","the","potential","feature","interaction","is","measured","by","computing","the","variance","within","the","two-way","PD","function","by","holding","one","variable","constant","and","letting","the","other","vary",".","Supports","black-box","models","and","the","following","`","sklearn","`","tree-based","models",":","`","GradientBoostingClassifier","`",",","`","GradientBoostingRegressor","`",",","`","HistGradientBoostingClassifier","`",",","`","HistGradientBoostingRegressor","`",",","`","HistGradientBoostingRegressor","`",",","`","DecisionTreeRegressor","`",",","`","RandomForestRegressor","`",".","For","details","of","the","method","see","the","original","paper",":","https",":","\/\/arxiv.org\/abs\/1805.04755","."]
docstr: Initialize black-box/tree-based model implementation for the partial dependence variance feature importance.
  
  Parameters
  ----------
  predictor
       A `sklearn` estimator or a prediction function which receives as input a `numpy` array of size `N x F`
      and outputs a `numpy` array of size `N` (i.e. `(N, )`) or `N x T`, where `N` is the number of input
      instances, `F` is the number of features and `T` is the number of targets.
  feature_names
      A list of feature names used for displaying results.E
  categorical_names
      Dictionary where keys are feature columns and values are the categories for the feature. Necessary to
      identify the categorical features in the dataset. An example for `categorical_names` would be::
  
          category_map = {0: ["married", "divorced"], 3: ["high school diploma", "master's degree"]}
  
  target_names
      A list of target/output names used for displaying results.
  verbose
      Whether to print the progress of the explainer.
  
  Notes
  -----
  The length of the `target_names` should match the number of columns returned by a call to the `predictor`.
  For example, in the case of a binary classifier, if the predictor outputs a decision score (i.e. uses
  the `decision_function` method) which returns one column, then the length of the `target_names` should be one.
  On the other hand, if the predictor outputs a prediction probability (i.e. uses the `predict_proba` method)
  which returns two columns (one for the negative class and one for the positive class), then the length of
  the `target_names` should be two.
docstr_tok: ["Initialize","black-box\/tree-based","model","implementation","for","the","partial","dependence","variance","feature","importance",".","Parameters","--","--","--","--","--","predictor","A","`","sklearn","`","estimator","or","a","prediction","function","which","receives","as","input","a","`","numpy","`","array","of","size","`","N","x","F","`","and","outputs","a","`","numpy","`","array","of","size","`","N","`","(","i.e",".","`","(","N",",",")","`",")","or","`","N","x","T","`",",","where","`","N","`","is","the","number","of","input","instances",",","`","F","`","is","the","number","of","features","and","`","T","`","is","the","number","of","targets",".","feature_names","A","list","of","feature","names","used","for","displaying","results.E","categorical_names","Dictionary","where","keys","are","feature","columns","and","values","are","the","categories","for","the","feature",".","Necessary","to","identify","the","categorical","features","in","the","dataset",".","An","example","for","`","categorical_names","`","would","be",":",":","category_map","=","{","0",":","[","``","married","''",",","``","divorced","''","]",",","3",":","[","``","high","school","diploma","''",",","``","master","'s","degree","''","]","}","target_names","A","list","of","target\/output","names","used","for","displaying","results",".","verbose","Whether","to","print","the","progress","of","the","explainer",".","Notes","--","--","-","The","length","of","the","`","target_names","`","should","match","the","number","of","columns","returned","by","a","call","to","the","`","predictor","`",".","For","example",",","in","the","case","of","a","binary","classifier",",","if","the","predictor","outputs","a","decision","score","(","i.e",".","uses","the","`","decision_function","`","method",")","which","returns","one","column",",","then","the","length","of","the","`","target_names","`","should","be","one",".","On","the","other","hand",",","if","the","predictor","outputs","a","prediction","probability","(","i.e",".","uses","the","`","predict_proba","`","method",")","which","returns","two","columns","(","one","for","the","negative","class","and","one","for","the","positive","class",")",",","then","the","length","of","the","`","target_names","`","should","be","two","."]
code: def __init__(
      self,
      predictor: Union[
          BaseEstimator, Callable[[np.ndarray], np.ndarray]
      ],
      feature_names: Optional[List[str]] = None,
      categorical_names: Optional[Dict[int, List[str]]] = None,
      target_names: Optional[List[str]] = None,
      verbose: bool = False,
  ):
      """
      Initialize black-box/tree-based model implementation for the partial dependence variance feature importance.
  
      Parameters
      ----------
      predictor
           A `sklearn` estimator or a prediction function which receives as input a `numpy` array of size `N x F`
          and outputs a `numpy` array of size `N` (i.e. `(N, )`) or `N x T`, where `N` is the number of input
          instances, `F` is the number of features and `T` is the number of targets.
      feature_names
          A list of feature names used for displaying results.E
      categorical_names
          Dictionary where keys are feature columns and values are the categories for the feature. Necessary to
          identify the categorical features in the dataset. An example for `categorical_names` would be::
  
              category_map = {0: ["married", "divorced"], 3: ["high school diploma", "master's degree"]}
  
      target_names
          A list of target/output names used for displaying results.
      verbose
          Whether to print the progress of the explainer.
  
      Notes
      -----
      The length of the `target_names` should match the number of columns returned by a call to the `predictor`.
      For example, in the case of a binary classifier, if the predictor outputs a decision score (i.e. uses
      the `decision_function` method) which returns one column, then the length of the `target_names` should be one.
      On the other hand, if the predictor outputs a prediction probability (i.e. uses the `predict_proba` method)
      which returns two columns (one for the negative class and one for the positive class), then the length of
      the `target_names` should be two.
      """
      super().__init__(meta=copy.deepcopy(DEFAULT_META_PDVARIANCE))
  
      # initialize the pd explainer
      PartialDependenceClass = (
          TreePartialDependence
          if isinstance(predictor, BaseEstimator)
          else PartialDependence
      )
      self.pd_explainer = PartialDependenceClass(
          predictor=predictor,
          feature_names=feature_names,
          categorical_names=categorical_names,
          target_names=target_names,
          verbose=verbose,
      )
  
imports: import copy
  import itertools
  import logging
  import math
  import numbers
  import sys
  from enum import Enum
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import matplotlib.pyplot
  import numpy
  from sklearn.base import BaseEstimator
  from alibi.api.defaults import DEFAULT_DATA_PD, DEFAULT_DATA_PDVARIANCE, DEFAULT_META_PDVARIANCE
  from alibi.api.interfaces import Explainer, Explanation
  from alibi.explainers import plot_pd
  from alibi.explainers.partial_dependence import Kind, PartialDependence, TreePartialDependence
  from alibi.utils import _get_options_string
label_desc: Use image node_id 1 to create a new PartialDependenceVariance object from inherited base classes: Explainer with example: obj = PartialDependenceVariance(predictor, feature_names, categorical_names, target_names, verbose)