biquality-learn
biquality-learn (or bqlearn in short) is a library à la scikit-learn for Biquality Learning.
Biquality Learning
Biquality Learning is a machine learning framework to train classifiers on Biquality Data, where the dataset is split into a trusted and an untrusted part:
- The trusted dataset contains trustworthy samples with clean labels and proper feature distribution.
- The untrusted dataset contains potentially corrupted samples from label noise or covariate shift (distribution shift).
biquality-learn aims at making well-known and proven biquality learning algorithms accessible and easy to use for everyone and enabling researchers to experiment in a reproducible way on biquality data.
Install
biquality-learn requires multiple dependencies:
- numpy>=1.17.3
- scipy>=1.5.0
- scikit-learn>=1.3.0
- scs>=3.2.2
The package is available on PyPi. To install biquality-learn, run the following command :
pip install biquality-learn
A dev version is available on TestPyPi :
pip install --index-url https://test.pypi.org/simple/ biquality-learn
Quick Start
For a quick example, we are going to train one of the available biquality classifiers, KPDR, on the digits dataset with synthetic asymmetric label noise.
Loading Data
First, we must load the dataset with scikit-learn and split it into a trusted and untrusted dataset.
from sklearn.datasets import load_digits
from sklearn.model_selection import StratifiedShuffleSplit
X, y = load_digits(return_X_y=True)
trusted, untrusted = next(StratifiedShuffleSplit(train_size=0.1).split(X, y))
Simulating Label Noise
Then we generate label noise on the untrusted dataset.
from bqlearn.corruption import make_label_noise
y[untrusted] = make_label_noise(y[untrusted], "flip", noise_ratio=0.8)
Training Biquality Classifier
Finally, we train KKMM on the biquality dataset by providing the sample_quality metadata, indicating if a sample is trusted or untrusted.
from sklearn.linear_models import LogisticRegression
from bqlearn.density_ratio import KKMM
bqclf = KKMM(LogisticRegression(), kernel="rbf")
sample_quality = np.ones(X.shape[0])
sample_quality[untrusted] = 0
bqclf.fit(X, y, sample_quality=sample_quality)
bqclf.predict(X)
Citation
If you use biquality-learn in your research, please consider citing us :
@misc{nodet2023biqualitylearn,
title={biquality-learn: a Python library for Biquality Learning},
author={Pierre Nodet and Vincent Lemaire and Alexis Bondu and Antoine Cornuéjols},
year={2023},
eprint={2308.09643},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
Acknowledgment
This work has been funded by Orange Labs.
Metadata
Release files for biquality-learn 0.1.0
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 |
|---|---|---|---|---|
| biquality-learn-0.1.0.tar.gz | 76.2 kB | Without provenance | Details for biquality-learn-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| biquality_learn-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for biquality_learn-0.1.0-py3-none-any.whl |
Total release size: 147.2 kB
Release files / biquality-learn-0.1.0.tar.gz
| Download URL | biquality-learn-0.1.0.tar.gz |
|---|---|
| Size | 76.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
503d7b22551a6cdf73f8351cd40e5c52543017efaf310e2df705d4a3606dc013
|
|
BLAKE2b-256 checksum How to use checksums |
6a129ecff4b397cb527772bc288d0c1d4cc72e71c8297cfb5eaa6958da2060e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / biquality_learn-0.1.0-py3-none-any.whl
| Download URL | biquality_learn-0.1.0-py3-none-any.whl |
|---|---|
| Size | 71.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
054f4370d07e17bc9033967dcf260b031b74dfa28ca37f30555b10c82748e107
|
|
BLAKE2b-256 checksum How to use checksums |
b84ab4c1b1575c89f6de93192e6ce393c3f6585d1c3aa852442ee9320770b8ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for biquality-learn 0.1.0
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.