How bonbhel/kabena-ml works
K-ABENA is a Python library that reduces training computation by selecting examples from each batch or epoch and returning weights that compensate for selected examples. The principal workflow is: a training loop supplies per-example losses to Kabena.select(), which configures and resolves a selection strategy, samples active examples, and returns a mask and weights for the caller’s training update. Framework adapters expose this behavior for PyTorch, Keras, scikit-learn, and Hugging Face. The README also documents scripts for reproducing the preprint’s validation tables. Adapter wiring is based on the README and SOURCE INDEX references; unsampled implementations are not inferred beyond those references.
Main entry points: filter.py Kabena selector · torch.py PyTorch adapter · keras.py Keras adapter · sklearn.py scikit-learn adapter
Components 11
Selection core
- Kabena selector
kabena/core/filter.py - Selection config
kabena/core/config.py - Strategy gate
kabena/core/gate.py - Sampling strategies
kabena/core/sampling.py
Framework adapters
- PyTorch adapter
kabena/integrations/torch.py - Keras adapter
kabena/integrations/keras.py - scikit-learn adapter
kabena/integrations/sklearn.py - Hugging Face adapter
kabena/integrations/huggingface.py
Validation scripts
- Preprint validation
validation
Other components
- Training loop
- Training update
Connections 11
- Training loop → Kabena selector: supplies losses
README.md - Kabena selector → Selection config: creates config
kabena/core/filter.py - Kabena selector → Strategy gate: resolves strategy
kabena/core/filter.py - Kabena selector → Sampling strategies: selects examples
kabena/core/filter.py - Kabena selector → Training update: returns mask and weights
README.md - Training loop → Training update: fits selected data
README.md - PyTorch adapter → Kabena selector: delegates selection
kabena/integrations/torch.py - Keras adapter → Kabena selector: uses core API
kabena/integrations/keras.py - scikit-learn adapter → Kabena selector: uses core API
kabena/integrations/sklearn.py - Hugging Face adapter → PyTorch adapter: uses adapter
kabena/integrations/huggingface.py - Training loop → Preprint validation: runs table scripts
README.md