Skip to main content

Inspect Molecular ML Models Using SHAP

Project description

mol-inspector - Inspect Molecular ML Models Using SHAP

mol-inspector Python Versions License: MIT

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mol_inspector-0.0.2.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mol_inspector-0.0.2-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file mol_inspector-0.0.2.tar.gz.

File metadata

  • Download URL: mol_inspector-0.0.2.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.2 Darwin/25.4.0

File hashes

Hashes for mol_inspector-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c1205b0107f8a6c40ed1c264819b10f5f750dda282d11df0f2f8d01fbf788065
MD5 68acfedd69c1d6ab60a4c6e339f349b3
BLAKE2b-256 8e69358b60167602b1271b9c5fd5f6714b1b57155c63314e1177de7644fbc92d

See more details on using hashes here.

File details

Details for the file mol_inspector-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: mol_inspector-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.2 Darwin/25.4.0

File hashes

Hashes for mol_inspector-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 08ca089ceb6e4156f9f0282d96e339b75540c213fff3aa76cd884aa605dd574c
MD5 c244c73cb01057f21e461083a713f6be
BLAKE2b-256 4f01f8dd2544880b12288763d7224f95aa190e101c4359cdffef58487c2f70f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page