doubtlab
A lab for bad labels. Learn more here.
This repository contains general tricks that may help you find bad, or noisy, labels in your dataset. The hope is that this repository makes it easier for folks to quickly check their own datasets before they invest too much time and compute on gridsearch.
Install
You can install the tool via pip or conda.
Install with pip
python -m pip install doubtlab
Install with conda
conda install -c conda-forge doubtlab
Quickstart
Doubtlab allows you to define "reasons" for a row of data to deserve another look. These reasons can form a pipeline which can be used to retreive a sorted list of examples worth checking again.
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
from doubtlab.ensemble import DoubtEnsemble
from doubtlab.reason import ProbaReason, WrongPredictionReason
# Let's say we have some dataset/model already
X, y = load_iris(return_X_y=True)
model = LogisticRegression(max_iter=1_000)
model.fit(X, y)
# Next we can add reasons for doubt. In this case we're saying
# that examples deserve another look if the associated proba values
# are low or if the model output doesn't match the associated label.
reasons = {
'proba': ProbaReason(model=model),
'wrong_pred': WrongPredictionReason(model=model)
}
# Pass these reasons to a doubtlab instance.
doubt = DoubtEnsemble(**reasons)
# Get the ordered indices of examples worth checking again
indices = doubt.get_indices(X, y)
# Get dataframe with "reason"-ing behind the sorting
predicates = doubt.get_predicates(X, y)
Features
The library implemented many "reasons" for doubt.
General Reasons
RandomReason: assign doubt randomly, just for sureOutlierReason: assign doubt when the model declares a row an outlier
Classification Reasons
ProbaReason: assign doubt when a models' confidence-values are low for any labelWrongPredictionReason: assign doubt when a model cannot predict the listed labelShortConfidenceReason: assign doubt when the correct label gains too little confidenceLongConfidenceReason: assign doubt when a wrong label gains too much confidenceDisagreeReason: assign doubt when two models disagree on a predictionCleanlabReason: assign doubt according to cleanlabMarginConfidenceReason: assign doubt when there's a small difference between the top two class confidences
Regression Reasons
AbsoluteDifferenceReason: assign doubt when the absolute difference is too highRelativeDifferenceReason: assign doubt when the relative difference is too highStandardizedErrorReason: assign doubt when the absolute standardized residual is too high
Feedback
It is early days for the project. The project should be plenty useful as-is, but we prefer to be honest. Feedback and anecdotes are very welcome!
Related Projects
- The cleanlab project was an inspiration for this one. They have a great heuristic for bad label detection but I wanted to have a library that implements many. Be sure to check out their work on the labelerrors.com project.
- My former employer, Rasa, has always had a focus on data quality. Some of that attitude is bound to have seeped in here. Be sure to check the Conversation Driven Development approach and Rasa X if you're working on virtual assistants.
- My current employer, Explosion, has a neat labelling tool called Prodigy. I'm currently investigating how tools like doubtlab might lead to better labels when combined with this (very like-able) annotation tool.
Metadata
Release files for doubtlab 0.2.4
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 |
|---|---|---|---|---|
| doubtlab-0.2.4.tar.gz | 11.6 kB | Without provenance | Details for doubtlab-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| doubtlab-0.2.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for doubtlab-0.2.4-py2.py3-none-any.whl |
Total release size: 22.6 kB
Release files / doubtlab-0.2.4.tar.gz
| Download URL | doubtlab-0.2.4.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab23fc36548a970fe52caea26c8c626a0d30bad78b44889e208f7dad455e7642
|
|
BLAKE2b-256 checksum How to use checksums |
10eb0fe5d67f9ce603488f25b54e8eb0591116848da5dc51c58ae84e5d156ddb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/4.11.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9
|
Release files / doubtlab-0.2.4-py2.py3-none-any.whl
| Download URL | doubtlab-0.2.4-py2.py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d22844e6673ff7bf41f3b0b9b69cd9c4d364347a8c74a2a3077d4dcc96ca3565
|
|
BLAKE2b-256 checksum How to use checksums |
580bfbc7328db09fa18a43e570404ce70a806a0219b6d56f381543eedd13b2f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/4.11.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9
|
Security for doubtlab 0.2.4
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.