reject is a Python library for classification with rejection. Neural networks are often confidently wrong when confronted with out-of-distribution data. When the prediction's uncertainty is too high, the model abstains from predicting and the observation is passed on to a human expert who takes the final decision. It is useful for applications where making an error can be more costly than asking a human expert for help.
Installation
$ pip install reject
Documentation
The documentation is deployed to reject.readthedocs.io.
Usage
from reject.reject import ClassificationRejector
y_pred # Array of predictions. Shape (n_observations, n_classes) or (n_observations, n_samples, n_classes).
y_true # Array of true labels. Shape (n_observations,).
# initialize the rejector
rej = ClassificationRejector(y_true_all, y_pred_all)
# single rejection point
rej.reject(threshold=0.5, unc_type="TU", relative=True, show=True)
Non-rejected Rejected
--------- -------------- ----------
Correct 891 20
Incorrect 109 980
Non-rejected accuracy Classification quality Rejection quality
----------------------- ------------------------ -------------------
0.8910 0.9355 40.9908
# rejection curve
fig = rej.plot_reject(unc_type="TU", metric="NRA")
print(fig)
User guide notebooks are provided in the reject.readthedocs.io documentation.
Metadata
Release files for reject 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| reject-0.3.2.tar.gz | 15.3 kB | Without provenance | Details for reject-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| reject-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for reject-0.3.2-py3-none-any.whl |
Total release size: 31.8 kB
Release files / reject-0.3.2.tar.gz
| Download URL | reject-0.3.2.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
62eb32f81262b7172c58c9c4871889a2f3f79b12468d92139c6d685387c0b585
|
|
BLAKE2b-256 checksum How to use checksums |
5a2fe5fed73f8584390dc769adc6f8eeb25eb2bfc686789427c0712edba53ca1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.11.5 Linux/6.5.0-25-generic
|
Release files / reject-0.3.2-py3-none-any.whl
| Download URL | reject-0.3.2-py3-none-any.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1729b81cf031c4c92a2d984668e68e3531f997c22f6c2dd7cc5b00b8d1d28eb5
|
|
BLAKE2b-256 checksum How to use checksums |
c62b0622129895a46d06b4b6c883e70d5c6e6578deeb068c2c7913b17d79d766
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.11.5 Linux/6.5.0-25-generic
|
Security for reject 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.