Skip to main content

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

coverage

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:

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swimnetworks-0.0.2.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swimnetworks-0.0.2-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file swimnetworks-0.0.2.tar.gz.

File metadata

  • Download URL: swimnetworks-0.0.2.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for swimnetworks-0.0.2.tar.gz
Algorithm Hash digest
SHA256 e57d58549d7b8f1148a185724472b1351a6e94daf1ae6a2cf1a45e39be037279
MD5 1277c813fd38e8ad7bb32c3d3c1b3664
BLAKE2b-256 2a0e60e1c97fea4d0d9bad3fdbd78f3948107fbe584ee128c5996bcaaa476385

See more details on using hashes here.

File details

Details for the file swimnetworks-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: swimnetworks-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for swimnetworks-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6ce7d595df7bb11c5b52d05f795084a8404bbdd8f11b0acaf8b71d50c6fb88c1
MD5 eeae36e34da4bead1d26bcb524294379
BLAKE2b-256 b59a1011497667267f7c96ad3a61f20782af9c7866f865a120b9bfc61fd3edb6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page