deepmol.feature_importance package
Submodules
deepmol.feature_importance.shap_values module
- class ShapValues(explainer: str = 'permutation', masker: str | None = None)[source]
Bases:
object
SHAP (SHapley Additive exPlanations) wrapper for DeepMol It allows to compute and analyze the SHAP values of DeepMol models.
- bar_plot(path: str | None = None, **kwargs) None [source]
Plot the SHAP values of all the features as a beeswarm plot.
- Parameters:
path (str) – Path to save the plot to.
kwargs – Additional keyword arguments for the plot function: see: https://github.com/slundberg/shap/blob/45b85c1837283fdaeed7440ec6365a886af4a333/shap/plots/_bar.py#L19
- beeswarm_plot(path: str | None = None, **kwargs) None [source]
Plot the SHAP values of all the features as a beeswarm plot.
- Parameters:
path (str) – Path to save the plot to.
kwargs – Additional keyword arguments for the plot function: see: https://github.com/slundberg/shap/blob/45b85c1837283fdaeed7440ec6365a886af4a333/shap/plots/_beeswarm.py#L23
- decision_plot(path: str | None = None, **kwargs) None [source]
Plot the SHAP values of all the features as a decision plot.
- Parameters:
path (str) – Path to save the plot to.
kwargs – Additional arguments for the plot function. see: https://github.com/slundberg/shap/blob/45b85c1837283fdaeed7440ec6365a886af4a333/shap/plots/_decision.py#L222
- feature_explanation_plot(index: int, path: str | None = None, **kwargs) None [source]
Plot the SHAP values of a single feature.
- Parameters:
index (int) – Index of the feature to explain
path (str) – Path to save the plot to.
kwargs – Additional arguments for the plot function. see: https://github.com/slundberg/shap/blob/45b85c1837283fdaeed7440ec6365a886af4a333/shap/plots/_scatter.py#L19
- fit(dataset: Dataset, model: Model, **kwargs) Explanation [source]
Compute the SHAP values for the given dataset and model.
- heatmap_plot(path: str | None = None, **kwargs) None [source]
Plot the SHAP values of all the features as a heatmap.
- Parameters:
path (str) – Path to save the plot to.
kwargs – Additional arguments for the plot function. see: https://github.com/slundberg/shap/blob/45b85c1837283fdaeed7440ec6365a886af4a333/shap/plots/_heatmap.py#L12
- negative_class_plot(path: str | None = None, **kwargs) None [source]
Plot the SHAP values of the positive class as a bar plot.
- Parameters:
path (str) – Path to save the plot to.
kwargs – Additional arguments for the plot function. see: https://github.com/slundberg/shap/blob/45b85c1837283fdaeed7440ec6365a886af4a333/shap/plots/_bar.py#L19
- positive_class_plot(path: str | None = None, **kwargs) None [source]
Plot the SHAP values of the positive class as a bar plot.
- Parameters:
path (str) – Path to save the plot to.
kwargs – Additional arguments for the plot function. see: https://github.com/slundberg/shap/blob/45b85c1837283fdaeed7440ec6365a886af4a333/shap/plots/_bar.py#L19
- sample_explanation_plot(index: int, plot_type: str = 'waterfall', path: str | None = None, **kwargs) None [source]
Plot the SHAP values of a single sample.
- Parameters:
index (int) – Index of the sample to explain
plot_type (str) – Type of plot to use. Can be ‘waterfall’ or ‘force’
path (str) – Path to save the plot to.
kwargs – Additional arguments for the plot function. see:https://github.com/slundberg/shap/blob/45b85c1837283fdaeed7440ec6365a886af4a333/shap/plots/_force.py#L33 https://github.com/slundberg/shap/blob/45b85c1837283fdaeed7440ec6365a886af4a333/shap/plots/_waterfall.py#L18