Metadata-Version: 2.4
Name: safetycage
Version: 0.0.4
Summary: The official safety cage package for misclassification detection in predictive models.
Author: Pål Vegard Bun Johnsen, Joel Bjervig, Julia Qiu
Author-email: Pål Vegard Bun Johnsen <pal.johnsen@sintef.no>, Joel Bjervig <Joel.Bjervig@sintef.no>, Julia Qiu <Julia.Qiu@sintef.no>
License-Expression: MIT
License-File: LICENSE
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Dist: joblib==1.3.2
Requires-Dist: matplotlib==3.8.2
Requires-Dist: numpy>=1.25.2
Requires-Dist: scikit-learn==1.1.3
Requires-Dist: scipy==1.9.3
Requires-Dist: statsmodels==0.13.5
Requires-Dist: tqdm>=4.67.3
Requires-Python: ==3.11.7
Project-URL: Homepage, https://github.com/safety-cage/safetycage
Project-URL: Issues, https://github.com/safety-cage/safetycage/issues
Description-Content-Type: text/markdown

# 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