SWIM: sample where it matters!
swimnetworks implements the algorithm SWIM for sampling weights of neural networks. The algorithm provides a way to quickly train neural networks on a CPU. For more details on the theoretical background of the method, refer to our paper [1].
The package documentation can be found at https://fd-research.gitlab.io/swimnetworks/.
Installation
To install the main package with the requirements, one needs to clone the repository and execute the following command from the root folder:
pip install .
Example
Here is a small example of defining a sampled network:
from sklearn.pipeline import Pipeline
from swimnetworks import Dense, Linear
steps = [
("dense", Dense(layer_width=512, activation="tanh",
parameter_sampler="tanh",
random_seed=42)),
("linear", Linear(regularization_scale=1e-10))
]
model = Pipeline(steps)
Then, one can use model.fit(X_train, y_train) and model.transform(X_test) to train and evaluate the model.
The numerical experiments from [1] can be found in a separate repository.
Running Tests
Run all the tests using:
python3 -m unittest tests/*.py
You can test coverage after installing coverage (e.g., using pip):
pip install coverage
Then run:
coverage run -m unittest discover
coverage report
Citation
If you use the SWIM package in your research, please cite the following paper:
Metadata
Release files for swimnetworks 0.0.2
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 |
|---|---|---|---|---|
| swimnetworks-0.0.2.tar.gz | 18.7 kB | Without provenance | Details for swimnetworks-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swimnetworks-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for swimnetworks-0.0.2-py3-none-any.whl |
Total release size: 35.1 kB
Release files / swimnetworks-0.0.2.tar.gz
| Download URL | swimnetworks-0.0.2.tar.gz |
|---|---|
| Size | 18.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e57d58549d7b8f1148a185724472b1351a6e94daf1ae6a2cf1a45e39be037279
|
|
BLAKE2b-256 checksum How to use checksums |
2a0e60e1c97fea4d0d9bad3fdbd78f3948107fbe584ee128c5996bcaaa476385
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / swimnetworks-0.0.2-py3-none-any.whl
| Download URL | swimnetworks-0.0.2-py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ce7d595df7bb11c5b52d05f795084a8404bbdd8f11b0acaf8b71d50c6fb88c1
|
|
BLAKE2b-256 checksum How to use checksums |
b59a1011497667267f7c96ad3a61f20782af9c7866f865a120b9bfc61fd3edb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for swimnetworks 0.0.2
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.