kabena — K-ABENA (v2.1.0)
Même modèle, ~28 % de calcul en moins. K-ABENA exclut à chaque époque une partie des exemples déjà appris et fait voter chaque exemple conservé au nom des dispensés (repondération Horvitz-Thompson) : le gradient reste design-unbiased — preuves et mesures dans le preprint.
La promesse : 2 lignes
EN — Note: the threshold K from the paper is not a constructor
argument — it is recomputed internally at every select() call. The knob
you tune is k_percentile (default 40.0).
FR — Note : le seuil K du papier n'est pas un argument du
constructeur — il est recalculé en interne à chaque appel de select().
ßLe réglage accessible est k_percentile (défaut 40.0).
from kabena import Kabena
kb = Kabena() # 1. défauts du preprint (v3, N=0.3)
for epoch in range(E):
losses = per_sample_loss(model, X, y)
active, w = kb.select(losses, y=y) # 2. masque + poids HT
model.fit(X[active], y[active], sample_weight=w[active])
print(kb.last_gain_) # fraction de calcul économisée
PyTorch : KabenaTorch().reduce(losses) · Keras : callback KabenaKeras ·
Hugging Face : KabenaTrainer.
Trois paramètres, pas un de plus
| Paramètre | Défaut | Rôle |
|---|---|---|
N |
0.3 |
proportion de mineures conservées (budget) |
strategy |
"auto" |
auto(=v3) / v3 / v2 / v1 — bascule transparente |
seed |
None |
reproductibilité du tirage |
v2 = mode régularisé optionnel (garde-fou automatique hors zone de
validité) · v1 = compatibilité 1.x.
Tutoriels — 4 familles × 3 niveaux
| Famille | Niveau 1 (notebook) | Niveau 2 (script) | Niveau 3 (MLOps) |
|---|---|---|---|
| ML classique (logistique, SVM, softmax) | notebook | script | train + serve + Docker |
| MLP / ANN (PyTorch et TF/Keras) | notebook | PyTorch · TensorFlow | pipeline TorchScript |
| CNN (PyTorch et TF/Keras) | notebook | PyTorch · TensorFlow | SavedModel / TF Serving |
| Transformer / NLP (Hugging Face) | notebook | DistilBERT | fine-tune + serve |
Reproduire le preprint (Reproducibility)
Chaque table du papier a son script seedé dans
validation/ :
| Table du preprint | Script |
|---|---|
| Table 1 — jeux réels, parité à coût réduit | table1_real_datasets.py |
| Table 2 — déséquilibre extrême 0,17 % | table2_extreme_imbalance.py |
| Table 3 — moments du gradient, bruit | table3_moments_noise.py |
| Table 4 — rivaux à budget égal (tests de permutation) | table4_rivals.py |
| §Sensitivity — grille K × N | table5_sensitivity.py |
python validation/run_all.py # les 5 tables (QUICK=1 pour un smoke test <2 min)
python experiments/playground.py --regime fraude --strategy v3 # bac à sable
Installation
EN — pip install kabena (core: numpy only, works with numpy 1.22 → 2.x).
Framework extras: pip install 'kabena[torch]' (note the quotes — required by
zsh, the default macOS shell). On Intel Macs, torch stops at 2.2.2 and the
extra automatically pins numpy<2 accordingly; on every other platform the
extra installs torch ≥ 2.3, which supports NumPy 2.
FR — pip install kabena (cœur : numpy seul, compatible numpy 1.22 → 2.x).
Extras framework : pip install 'kabena[torch]' (guillemets obligatoires sous
zsh, le shell par défaut sur Mac). Sur Mac Intel, torch s'arrête à 2.2.2 et
l'extra épingle automatiquement numpy<2 en conséquence ; sur toute autre
plateforme, l'extra installe torch ≥ 2.3, compatible NumPy 2.
pip install kabena # coeur (numpy seul)
pip install "kabena[sklearn]" # + helpers scikit-learn
pip install "kabena[torch]" # + intégration PyTorch
pip install "kabena[tensorflow]" # + intégration Keras
pip install "kabena[huggingface]" # + KabenaTrainer
Metadata
Release files for kabena 2.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kabena-2.1.1.tar.gz | 35.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kabena-2.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 52.8 kB
Release files / kabena-2.1.1.tar.gz
| Download URL | kabena-2.1.1.tar.gz |
|---|---|
| Size | 35.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
66658eae1a5f18f3c2a6dbd4b8922d8b64a6cb7a7227f39876292b4d3afe6703
|
|
BLAKE2b-256 checksum How to use checksums |
7c81da3373a433263fbedb7cb415ba6c9b469947136c09e408994982adeadff1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.
Transparency logRelease files / kabena-2.1.1-py3-none-any.whl
| Download URL | kabena-2.1.1-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db88f18959e2e11fa31b29beac79b71997896dc2c8351275b8f2f80bcca98941
|
|
BLAKE2b-256 checksum How to use checksums |
901bd34f291ac869b72ab6529080d61616139251d75362cdb5c025ff939fce89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.
Transparency log