plot_shap_scatter
method plot_shap_scatter(models=None, index=None, columns=0, target=1, title=None, legend=None, figsize=(900, 600), filename=None, display=True)[source]
Plot SHAP's scatter plot.
Plots the value of the feature on the x-axis and the SHAP value of the same feature on the y-axis. This shows how the model depends on the given feature, and is like a richer extension of the classical partial dependence plots. Vertical dispersion of the data points represents interaction effects. Read more about SHAP plots in the user guide.
Parameters | models: int, str, Model or None, default=None
Model to plot. If None, all models are selected. Note that
leaving the default option could raise an exception if there
are multiple models. To avoid this, call the plot directly
from a model, e.g. index: slice, sequence or None, default=Noneatom.lr.plot_shap_scatter() .
Rows in the dataset to plot. If None, it selects all rows
in the test set. The plot_shap_scatter method does not
support plotting a single sample.
columns: int or str, default=0
Column to plot.
target: int, str or tuple, default=1
Class in the target column to target. For multioutput tasks,
the value should be a tuple of the form (column, class).
Note that for binary and multilabel tasks, the selected
class is always the positive one.
title: str, dict or None, default=None
Title for the plot.
legend: str, dict or None, default=None
Does nothing. Implemented for continuity of the API.
figsize: tuple or None, 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 png. If None, the plot is not saved.
Whether to render the plot. If None, it returns the figure.
|
Returns | plt.Figure or None
Plot object. Only returned if display=None .
|
See Also
Plot SHAP's beeswarm plot.
Plot SHAP's decision plot.
Plot SHAP's force plot.
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("LR")
>>> atom.plot_shap_scatter(columns="symmetry error")