Skip to content

plot_parshap


method plot_parshap(models=None, columns=None, target=1, title=None, figsize=(10, 6), filename=None, display=True) [source]

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 feature_importances_ or coef_ attribute, its normalized values are shown in a color map. Read more about this plot here.

Parameters:

models: str, sequence or None, optional (default=None)
Name of the models to plot. If None, all the models in the pipeline are selected.

columns: int, str, sequence or None, optional (default=None)
Names or indices of the features to plot. None to show all.

target: int or str, optional (default=1)
Index or name of the class in the target column to look at. Only for multi-class classification tasks.

title: str or None, optional (default=None)
Plot's title. If None, the title is left empty.

figsize: tuple, optional (default=(10, 6))
Figure's size, format as (x, y). If None, it adapts the size to the number of features shown.

filename: str or None, optional (default=None)
Name of the file. Use "auto" for automatic naming. If None, the figure is not saved.

display: bool or None, optional (default=True)
Whether to render the plot. If None, it returns the matplotlib figure.

Returns: fig: matplotlib.figure.Figure
Plot object. Only returned if display=None.


Example

from atom import ATOMClassifier

atom = ATOMClassifier(X, y)
atom.run(["GNB", "LGB"])
atom.gnb.plot_parshap()
plot_parshap
atom.lgb.plot_parshap()
plot_parshap
Back to top