Skip to content

Commit

Permalink
[MRG] Fix FutureWarning in plot_partial_dependence_visualization_api.…
Browse files Browse the repository at this point in the history
  • Loading branch information
ksslng authored and thomasjpfan committed Feb 22, 2020
1 parent e8e250e commit 83ae70c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sklearn/inspection/_partial_dependence.py
Expand Up @@ -25,7 +25,6 @@
from ..utils import _determine_key_type
from ..utils import _get_column_indices
from ..utils.validation import check_is_fitted
from ..tree._tree import DTYPE
from ..exceptions import NotFittedError
from ..ensemble._gb import BaseGradientBoosting
from sklearn.ensemble._hist_gradient_boosting.gradient_boosting import (
Expand Down Expand Up @@ -592,7 +591,9 @@ def plot_partial_dependence(estimator, X, features, feature_names=None,
from matplotlib.ticker import ScalarFormatter # noqa

# set target_idx for multi-class estimators
if hasattr(estimator, 'classes_') and np.size(estimator.classes_) > 2:
if (is_classifier(estimator) and
hasattr(estimator, 'classes_') and
np.size(estimator.classes_) > 2):
if target is None:
raise ValueError('target must be specified for multi-class')
target_idx = np.searchsorted(estimator.classes_, target)
Expand Down

0 comments on commit 83ae70c

Please sign in to comment.