Skip to content

Bug on partial dependence plot for multiclass classifiers. target_idx is always rewritten.  #14301

@pbrusco

Description

@pbrusco

On function "plot_partial_dependence", I think the "target" parameter is being ignored (in the multiclass setting) since the following line:

sets target_idx to 0 every time (ignoring previous lines in which the right column is selected).

When I run:

plot_partial_dependence(rf, X, [feature_column], feature_names=X.columns,  target="class_1", response_method="predict_proba", n_jobs=-1) 
plot_partial_dependence(rf, X, [feature_column], feature_names=X.columns,  target="class_2", response_method="predict_proba", n_jobs=-1) 

I get the same result two times (and I believe that result to be the "class_1" result)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugModerateAnything that requires some knowledge of conventions and best practiceshelp wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions