Overview
A pytorch extension providing Bregman-based optimizers
Free software: BSD 3-Clause License
Installation
The package can be install from PyPI using:
pip install bregman-learning
Usage
The library provides 2 Bregman-based optimizers, several regularizers for these optimizers, and functions for pre- and postprocessing the networks.
The Bregman-based optimizers provides are LinBreg and AdaBreg. Their usage is similar to the usage of Adam and SGD, their non-Bregman counterparts. Instead of:
from torch.optim import Adam ... optimizer = Adam(model.parameters(), lr=learning_rate)
the optimizers are created using:
from bregman import AdaBreg, L1
...
optimizer = AdaBreg(
model.parameters(),
reg=L1(rc=regularization_constant),
lr=learning_rate
)
where the L1 regularizer can be interchanged with any regularizer in the library.
For the best results when using sparsity-promoting regularizers, the networks have to pre- and postprocessed accordingly. For the L12 regularizer, this can be done using:
from bregman import sparsify ... sparsify(model, density_level=0.2)
and:
from bregman import simplify ... pruned_model = simplify(model)
Citing
If you use this code, please use the citation information in the CITATION.cff file or click the cite this repository button in the sitebar.
Changelog
0.0.0 (2022-06-17)
First release on PyPI.
Metadata
Release files for bregman-learning 0.0.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 | |
|---|---|---|---|
| bregman_learning-0.0.0.tar.gz | 23.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bregman_learning-0.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.7 kB
Release files / bregman_learning-0.0.0.tar.gz
| Download URL | bregman_learning-0.0.0.tar.gz |
|---|---|
| Size | 23.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47f2e2bae4a985c1cd4e12c4c058cbac90c70746c74647843ef247b1998ccbb1
|
|
BLAKE2b-256 checksum How to use checksums |
b7de062ddd3dc47b6f7c28ff92dbeef07529af8c1ab3ee466deebe9447be059b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.8
|
Release files / bregman_learning-0.0.0-py3-none-any.whl
| Download URL | bregman_learning-0.0.0-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da3d30b3650b35367493c211f279801a49bd932288b59f91508955c235497177
|
|
BLAKE2b-256 checksum How to use checksums |
2841c5f3fcb72129a9c4e2ca57911fa06cb189e7e606e43968b6087b14a3afea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.8
|