Skip to content

scatter_plot


method scatter_plot(models=None, index=None, feature=0, target=1, title=None, figsize=(10, 6), filename=None, display=True, **kwargs) [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: str, sequence or None, optional (default=None)
Name of the model to plot. If None, all models in the pipeline are selected. Note that leaving the default option could raise an exception if there are multiple models in the pipeline. To avoid this, call the plot from a model, e.g. atom.xgb.scatter_plot().

index: slice, sequence or None, optional (default=None)
Index names or positions of the rows in the dataset to plot. If None, it selects all rows in the test set. The scatter plot does not support plotting a single sample.

feature: int or str, optional (default=0)
Index or name of the feature to plot.

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).

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.

**kwargs
Additional keyword arguments for SHAP's scatter plot.

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


Example

from atom import ATOMRegressor

atom = ATOMRegressor(X, y)
atom.run("RF")
atom.scatter_plot(feature="bmi")
scatter_plot
Back to top