The official safety cage package for misclassification detection in predictive models.
Project description
SafetyCage
SafetyCage is a Python package for detecting misclassified predictions from machine learning models in classification tasks. It provides a unified interface for multiple statistical detection methods, enabling users to quantify prediction reliability and flag potentially incorrect outputs across different models and datasets easily.
It is available on PyPI here: https://pypi.org/project/safetycage/.
Background
The idea behind safetycage is that we can find statistics on each predicted sample, and compare that statisitic to some statisitc threshold "alpha" to predict whether the sample prediction was incorrectly classified.
Description
Machine learning models can produce incorrect predictions with high confidence. SafetyCage addresses this by providing post-hoc misclassification detection methods that operate on model outputs or internal representations.
The package includes several methods:
- MSP (Maximum Softmax Probability)
- DOCTOR (Error probability estimation)
- Mahalanobis (Distance-based statistical testing)
- SPARDACUS (Projection + density estimation approach)
Each method outputs a statistic or p-value that reflects how likely a prediction is to be incorrect.
Alternatively, you can implement your own method by initializing a base class from the safetycage abstract base class, that defines how methods should be implemented.
Requirements
SafetyCage uses Python 3.11.7. Consider creating an environment for your project with safetycage that uses Python 3.11.7.
Installation
Install via pip using the command:
pip install safetycage
The only additional packages you will need to work with safetycage are those required by your dataset and model.
Visuals
- could put a gif on installing and using the package - don't think this is very necessary, should be obvious
Tutorials & Examples
A separate repository contains full examples and tutorials at https://github.com/safety-cage/safetycage-tutorials.
Support
If you encounter issues or have questions:
- Open an issue on the repository
- Check the safetycage-tutorials repo for examples
Roadmap
- TBD
Contributing
- unsure
Authors and acknowledgment
- TBA
License
MIT License
Project status
- active and under devlopment
pypi push test
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
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 safetycage-0.0.4.tar.gz.
File metadata
- Download URL: safetycage-0.0.4.tar.gz
- Upload date:
- Size: 28.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87d0d394012c48e9072f24787fa4e579122041cd568522da20c9e493530e4930
|
|
| MD5 |
c816426a760d10fbf5f7774c8d95f7ba
|
|
| BLAKE2b-256 |
bf65672aa36a71c68c51c2b4423a6a38b888f39155643b28fd3a5e3d18be4cb0
|
File details
Details for the file safetycage-0.0.4-py3-none-any.whl.
File metadata
- Download URL: safetycage-0.0.4-py3-none-any.whl
- Upload date:
- Size: 35.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06715ce9a7f5ec206de26c27c49abaf169f6e315faebc60fbe01fa75354297df
|
|
| MD5 |
45f999d887d034d5cb0cfd3661f1ec65
|
|
| BLAKE2b-256 |
c28b6d471787b5355d0244af5238da5ec63c72206020ccffba36e8e3a8279ebe
|