class_docstr: Tree-based model `sklearn`  implementation of the partial dependence for tabular datasets.
  Supports multiple feature interactions. This method is faster than the general black-box implementation
  but is only supported by some tree-based estimators. The computation is based on a weighted tree traversal.
  For more details on the computation, check the `sklearn documentation page`_. The supported `sklearn`
  models are: `GradientBoostingClassifier`, `GradientBoostingRegressor`, `HistGradientBoostingClassifier`,
  `HistGradientBoostingRegressor`, `HistGradientBoostingRegressor`, `DecisionTreeRegressor`, `RandomForestRegressor`.
  
  .. _sklearn documentation page:
          https://scikit-learn.org/stable/modules/partial_dependence.html#computation-methods
class_docstr_tok: ["Tree-based","model","`","sklearn","`","implementation","of","the","partial","dependence","for","tabular","datasets",".","Supports","multiple","feature","interactions",".","This","method","is","faster","than","the","general","black-box","implementation","but","is","only","supported","by","some","tree-based","estimators",".","The","computation","is","based","on","a","weighted","tree","traversal",".","For","more","details","on","the","computation",",","check","the","`","sklearn","documentation","page","`","_",".","The","supported","`","sklearn","`","models","are",":","`","GradientBoostingClassifier","`",",","`","GradientBoostingRegressor","`",",","`","HistGradientBoostingClassifier","`",",","`","HistGradientBoostingRegressor","`",",","`","HistGradientBoostingRegressor","`",",","`","DecisionTreeRegressor","`",",","`","RandomForestRegressor","`",".","..","_sklearn","documentation","page",":","https",":","\/\/scikit-learn.org\/stable\/modules\/partial_dependence.html","#","computation-methods"]
docstr: Model sanity checks. 
docstr_tok: ["Model","sanity","checks","."]
code: def _sanity_check(self):
      """Model sanity checks."""
      if not isinstance(self.predictor, BaseEstimator):
          raise ValueError(
              "`TreePartialDependence` only supports `sklearn` models. "
              "Try using the `PartialDependence` black-box alternative."
          )
  
      check_is_fitted(self.predictor)
  
      if not (
          is_classifier(self.predictor) or is_regressor(self.predictor)
      ):
          raise ValueError(
              "The predictor must be a fitted regressor or a fitted classifier."
          )
  
      if is_classifier(self.predictor) and isinstance(
          self.predictor.classes_[0], np.ndarray
      ):
          raise ValueError(
              "Multiclass-multioutput predictors are not supported."
          )
  
      if not isinstance(
          self.predictor,
          (
              BaseGradientBoosting,
              BaseHistGradientBoosting,
              DecisionTreeRegressor,
              RandomForestRegressor,
          ),
      ):
          supported_classes_recursion = (
              "GradientBoostingClassifier",
              "GradientBoostingRegressor",
              "HistGradientBoostingClassifier",
              "HistGradientBoostingRegressor",
              "HistGradientBoostingRegressor",
              "DecisionTreeRegressor",
              "RandomForestRegressor",
          )
          raise ValueError(
              f"`TreePartialDependence` only supports by the following estimators: "
              f"{supported_classes_recursion}. Try using the `PartialDependence` black-box alternative."
          )
  
imports: import copy
  import logging
  import math
  import numbers
  import sys
  from abc import ABC, abstractmethod
  from enum import Enum
  from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union, no_type_check
  import matplotlib.pyplot
  import numpy
  from scipy.stats.mstats import mquantiles
  from sklearn.base import BaseEstimator, is_classifier, is_regressor
  from sklearn.ensemble import RandomForestRegressor
  from sklearn.ensemble._gb import BaseGradientBoosting
  from sklearn.ensemble._hist_gradient_boosting.gradient_boosting import BaseHistGradientBoosting
  from sklearn.tree import DecisionTreeRegressor
  from sklearn.utils.extmath import cartesian
  from sklearn.utils.validation import check_is_fitted
  from tqdm import tqdm
  from alibi.api.defaults import DEFAULT_DATA_PD, DEFAULT_META_PD
  from alibi.api.interfaces import Explainer, Explanation
  from alibi.explainers.ale import get_quantiles
  from alibi.utils import _get_options_string
label_desc: Use image node_id 2 for calling the TreePartialDependence obj's underlying member method code with example usage: obj._sanity_check() without return types