Inspect Molecular ML Models Using SHAP
Project description
mol-inspector - Inspect Molecular ML Models Using SHAP
This project is built on SHAP - a game theoretic approach to explain the output of machine learning models with figures be generated using Seaborn. While this project should be able to work with any data generated from SHAP values, it was built with molecular fingerprints in mind. As a result, simple methods are also included that will render molecular fingerprint bits using RDKit.
Tutorials
Tutorials can be found under the Tutorials folder. The aim of mol-inspector is for ease of use. Generating SHAP values and plots can be done as follows:
from mol_inspector import Inspector, Plots
# generating SHAP values
inspector = Inspector(model=model, train_feats=train_feats, model_type="auto")
values = inspector.values(test_feats)
# generating plots
plot = Plots(values, train_feats, test_feats)
plot.summary_plot()
Users can also import and generate shap values natively, then feed the shap values into the Plots() class to generate the Seaborn plots.
Installation
Project can be pip installable:
pip install mol-inspector
[!NOTE] As my background is in cheminformatics, RDKit will also be installed. This allows for methods to draw molecular fingerprint bits. I may "split" this code upon user request.
Motivations
When experimenting with the SHAP package, I found difficulties in generating customized color palettes for my figures. This project seeks to remedy that by extracting the generated SHAP values and using the data to generate figures using Seaborn. This would allow easier customization of color palettes for presentations.
Future Contributions
Currently only three plot types have been converted. This is due to how I implement SHAP into my projects. I welcome contributors or requests for additional plot options to be converted into seaborn. Just let me know!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mol_inspector-0.0.1.tar.gz.
File metadata
- Download URL: mol_inspector-0.0.1.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37350305c4d9e8f64c5ddaf63ee1e92bfe1782a42e1cbc70a224ff991fe442f6
|
|
| MD5 |
63a831abd165bc2e228e0783f3a4d15a
|
|
| BLAKE2b-256 |
20313a1583d965ae8c1d193f63a04b24adc0d4ded5f692e30caae6a57d1d245a
|
File details
Details for the file mol_inspector-0.0.1-py3-none-any.whl.
File metadata
- Download URL: mol_inspector-0.0.1-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5be14276fb3dc6b67d591651afd5458fcb189c7e95d2e8eaf6235b2aff890950
|
|
| MD5 |
2098e8524290d5ef808962c825b8c292
|
|
| BLAKE2b-256 |
bb6c6b4cb1e17e423f8b1195af93108e69cbebdbfc9e3c1bb7b3b7bcb153dba3
|