plot_parshap
method plot_parshap(models=None, columns=None, target=1, title=None, legend="upper left", figsize=(900, 600), filename=None, display=True)[source]
Plot the partial correlation of shap values.
Plots the train and test correlation between the shap value of
every feature with its target value, after removing the effect
of all other features (partial correlation). This plot is
useful to identify the features that are contributing most to
overfitting. Features that lie below the bisector (diagonal
line) performed worse on the test set than on the training set.
If the estimator has a scores_
, feature_importances_
or
coef_
attribute, its normalized values are shown in a color
map.
Parameters | models: int, str, Model, slice, sequence or None, default=None
Models to plot. If None, all models are selected.
columns: int, str, slice, sequence or None, default=None
Features to plot. If None, it plots all features.
target: int or str, default=1
Class in the target column to look at (only for multi-class
classification tasks).
title: str, dict or None, default=None
Title for the plot.
legend: str, dict or None, default="upper left"
Legend for the plot. See the user guide for
an extended description of the choices.
figsize: tuple, default=(900, 600)
Figure's size in pixels, format as (x, y).
filename: str or None, default=None
Save the plot using this name. Use "auto" for automatic
naming. The type of the file depends on the provided name
(.html, .png, .pdf, etc...). If display: bool or None, default=Truefilename has no file type,
the plot is saved as html. If None, the plot is not saved.
Whether to render the plot. If None, it returns the figure.
|
Returns | go.Figure or None
Plot object. Only returned if display=None .
|
See Also
Plot a model's feature importance.
Plot the partial dependence of features.
Plot the feature permutation importance of models.
Example
>>> from atom import ATOMClassifier
>>> from sklearn.datasets import load_breast_cancer
>>> X, y = load_breast_cancer(return_X_y=True, as_frame=True)
>>> atom = ATOMClassifier(X, y)
>>> atom.run(["GNB", "RF"])
>>> atom.rf.plot_parshap(legend=None)
>>> atom.plot_parshap(columns=slice(5, 10))