rbms 0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rbms-0.1/.github/workflows/codecov.yaml +46 -0
- rbms-0.1/.github/workflows/docs.yaml +49 -0
- rbms-0.1/.github/workflows/test.yaml +44 -0
- rbms-0.1/.gitignore +177 -0
- rbms-0.1/LICENSE +21 -0
- rbms-0.1/MANIFEST.in +2 -0
- rbms-0.1/PKG-INFO +88 -0
- rbms-0.1/README.md +65 -0
- rbms-0.1/docs/Makefile +20 -0
- rbms-0.1/docs/make.bat +35 -0
- rbms-0.1/docs/source/Makefile +20 -0
- rbms-0.1/docs/source/api.md +151 -0
- rbms-0.1/docs/source/auto_examples/images/sphx_glr_plot_generated_samples_001.png +0 -0
- rbms-0.1/docs/source/auto_examples/images/sphx_glr_plot_generated_samples_002.png +0 -0
- rbms-0.1/docs/source/auto_examples/images/sphx_glr_plot_generated_samples_003.png +0 -0
- rbms-0.1/docs/source/auto_examples/images/sphx_glr_plot_generated_samples_004.png +0 -0
- rbms-0.1/docs/source/auto_examples/images/sphx_glr_plot_test_001.png +0 -0
- rbms-0.1/docs/source/auto_examples/images/thumb/sphx_glr_plot_generated_samples_thumb.png +0 -0
- rbms-0.1/docs/source/auto_examples/images/thumb/sphx_glr_plot_test_thumb.png +0 -0
- rbms-0.1/docs/source/auto_examples/index.rst +63 -0
- rbms-0.1/docs/source/auto_examples/plot_generated_samples.codeobj.json +975 -0
- rbms-0.1/docs/source/auto_examples/plot_generated_samples.ipynb +187 -0
- rbms-0.1/docs/source/auto_examples/plot_generated_samples.py +127 -0
- rbms-0.1/docs/source/auto_examples/plot_generated_samples.py.md5 +1 -0
- rbms-0.1/docs/source/auto_examples/plot_generated_samples.rst +343 -0
- rbms-0.1/docs/source/auto_examples/plot_test.codeobj.json +18 -0
- rbms-0.1/docs/source/auto_examples/plot_test.ipynb +43 -0
- rbms-0.1/docs/source/auto_examples/plot_test.py +10 -0
- rbms-0.1/docs/source/auto_examples/plot_test.py.md5 +1 -0
- rbms-0.1/docs/source/auto_examples/plot_test.rst +85 -0
- rbms-0.1/docs/source/auto_examples/sg_execution_times.rst +37 -0
- rbms-0.1/docs/source/conf.py +66 -0
- rbms-0.1/docs/source/examples.md +0 -0
- rbms-0.1/docs/source/index.md +43 -0
- rbms-0.1/docs/source/myst.yml +4 -0
- rbms-0.1/docs/source/rbm.md +131 -0
- rbms-0.1/docs/source/references.bib +275 -0
- rbms-0.1/docs/source/sg_execution_times.rst +37 -0
- rbms-0.1/docs/source/tuto/dataset.md +40 -0
- rbms-0.1/docs/source/tuto/parallel_tempering.md +1 -0
- rbms-0.1/docs/source/tuto/train_rbm.md +38 -0
- rbms-0.1/docs/source/tutorials.md +12 -0
- rbms-0.1/examples/GALLERY_HEADER.rst +4 -0
- rbms-0.1/examples/plot_generated_samples.py +127 -0
- rbms-0.1/pyproject.toml +84 -0
- rbms-0.1/rbms/__init__.py +0 -0
- rbms-0.1/rbms/bernoulli_bernoulli/__init__.py +3 -0
- rbms-0.1/rbms/bernoulli_bernoulli/classes.py +230 -0
- rbms-0.1/rbms/bernoulli_bernoulli/functional.py +215 -0
- rbms-0.1/rbms/bernoulli_bernoulli/implement.py +175 -0
- rbms-0.1/rbms/classes.py +216 -0
- rbms-0.1/rbms/const.py +4 -0
- rbms-0.1/rbms/custom_fn.py +41 -0
- rbms-0.1/rbms/dataset/__init__.py +99 -0
- rbms-0.1/rbms/dataset/dataset_class.py +124 -0
- rbms-0.1/rbms/dataset/fasta_utils.py +171 -0
- rbms-0.1/rbms/dataset/load_fasta.py +63 -0
- rbms-0.1/rbms/dataset/load_h5.py +53 -0
- rbms-0.1/rbms/dataset/parser.py +54 -0
- rbms-0.1/rbms/dataset/utils.py +18 -0
- rbms-0.1/rbms/io.py +134 -0
- rbms-0.1/rbms/map_model.py +5 -0
- rbms-0.1/rbms/metrics/__init__.py +0 -0
- rbms-0.1/rbms/metrics/aats.py +59 -0
- rbms-0.1/rbms/parser.py +147 -0
- rbms-0.1/rbms/partition_function/ais.py +84 -0
- rbms-0.1/rbms/partition_function/exact.py +27 -0
- rbms-0.1/rbms/plot.py +185 -0
- rbms-0.1/rbms/potts_bernoulli/__init__.py +0 -0
- rbms-0.1/rbms/potts_bernoulli/classes.py +230 -0
- rbms-0.1/rbms/potts_bernoulli/functional.py +215 -0
- rbms-0.1/rbms/potts_bernoulli/implement.py +219 -0
- rbms-0.1/rbms/potts_bernoulli/tools.py +55 -0
- rbms-0.1/rbms/potts_bernoulli/utils.py +10 -0
- rbms-0.1/rbms/sampling/gibbs.py +23 -0
- rbms-0.1/rbms/sampling/pt.py +186 -0
- rbms-0.1/rbms/scripts/__init__.py +0 -0
- rbms-0.1/rbms/scripts/entrypoint.py +36 -0
- rbms-0.1/rbms/scripts/pt_sampling.py +112 -0
- rbms-0.1/rbms/scripts/train_rbm.py +73 -0
- rbms-0.1/rbms/training/pcd.py +149 -0
- rbms-0.1/rbms/training/utils.py +159 -0
- rbms-0.1/rbms/utils.py +300 -0
- rbms-0.1/tests/conftest.py +275 -0
- rbms-0.1/tests/unit_test/bernoulli_bernoulli/implement/test_compute_energy_bbrbm.py +19 -0
- rbms-0.1/tests/unit_test/bernoulli_bernoulli/implement/test_compute_energy_hiddens_bbrbm.py +16 -0
- rbms-0.1/tests/unit_test/bernoulli_bernoulli/implement/test_compute_energy_visibles_bbrbm.py +16 -0
- rbms-0.1/tests/unit_test/bernoulli_bernoulli/implement/test_compute_gradient_bbrbm.py +98 -0
- rbms-0.1/tests/unit_test/bernoulli_bernoulli/implement/test_init_chains_bbrbm.py +53 -0
- rbms-0.1/tests/unit_test/bernoulli_bernoulli/implement/test_init_parameters_bbrbm.py +64 -0
- rbms-0.1/tests/unit_test/bernoulli_bernoulli/implement/test_sample_hiddens_bbrbm.py +26 -0
- rbms-0.1/tests/unit_test/bernoulli_bernoulli/implement/test_sample_visibles_bbrbm.py +26 -0
- rbms-0.1/tests/unit_test/bernoulli_bernoulli/test_bernoulli_utils_bbrbm.py +114 -0
- rbms-0.1/tests/unit_test/bernoulli_bernoulli/test_functional_bbrbm.py +111 -0
- rbms-0.1/tests/unit_test/bernoulli_bernoulli/test_methods_bbrbm.py +228 -0
- rbms-0.1/tests/unit_test/metrics/test_aats.py +40 -0
- rbms-0.1/tests/unit_test/potts_bernoulli/implement/test_compute_energy_hiddens_pbrbm.py +62 -0
- rbms-0.1/tests/unit_test/potts_bernoulli/implement/test_compute_energy_pbrbm.py +19 -0
- rbms-0.1/tests/unit_test/potts_bernoulli/implement/test_compute_energy_visibles_pbrbm.py +16 -0
- rbms-0.1/tests/unit_test/potts_bernoulli/implement/test_compute_gradient_pbrbm.py +100 -0
- rbms-0.1/tests/unit_test/potts_bernoulli/implement/test_init_chains_pbrbm.py +49 -0
- rbms-0.1/tests/unit_test/potts_bernoulli/implement/test_init_parameters_pbrbm.py +72 -0
- rbms-0.1/tests/unit_test/potts_bernoulli/implement/test_sample_hiddens_pbrbm.py +26 -0
- rbms-0.1/tests/unit_test/potts_bernoulli/implement/test_sample_visibles_pbrbm.py +26 -0
- rbms-0.1/tests/unit_test/potts_bernoulli/test_functional_pbrbm.py +122 -0
- rbms-0.1/tests/unit_test/potts_bernoulli/test_methods_pbrbm.py +249 -0
- rbms-0.1/tests/unit_test/potts_bernoulli/test_utils_pbrbm.py +108 -0
- rbms-0.1/tests/unit_test/test_custom_fn.py +85 -0
- rbms-0.1/tests/unit_test/test_utils.py +472 -0
- rbms-0.1/tests/unit_test/training/test_pcd.py +80 -0
- rbms-0.1/tests/use_cases/test_bbrbm.py +83 -0
- rbms-0.1/tests/use_cases/test_pbrbm.py +156 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: Run tests and upload coverage
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
test:
|
|
8
|
+
if: github.ref == 'refs/heads/main'
|
|
9
|
+
name: Run tests on latest python version and collect coverage
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- name: Checkout
|
|
13
|
+
uses: actions/checkout@v4
|
|
14
|
+
with:
|
|
15
|
+
fetch-depth: 0
|
|
16
|
+
|
|
17
|
+
- name: Set up Python
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: 3.13
|
|
21
|
+
|
|
22
|
+
- name: Install test dependencies
|
|
23
|
+
run: pip install pytest pytest-cov
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: pip install -e .
|
|
27
|
+
|
|
28
|
+
- name: Get data for binary use case
|
|
29
|
+
run:
|
|
30
|
+
wget https://github.com/nbereux/data_test/raw/refs/heads/main/dummy.zip
|
|
31
|
+
|
|
32
|
+
- name: Get data for potts use case
|
|
33
|
+
run:
|
|
34
|
+
wget https://github.com/nbereux/data_test/raw/refs/heads/main/dummy.fasta
|
|
35
|
+
|
|
36
|
+
- name: Extract binary data
|
|
37
|
+
run:
|
|
38
|
+
unzip ./dummy.zip
|
|
39
|
+
|
|
40
|
+
- name: Run tests
|
|
41
|
+
run: PYTORCH_JIT=0 pytest --cov=rbms tests/
|
|
42
|
+
|
|
43
|
+
- name: Upload results to Codecov
|
|
44
|
+
uses: codecov/codecov-action@v4
|
|
45
|
+
with:
|
|
46
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
name: documentation
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request, workflow_dispatch]
|
|
4
|
+
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
docs:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: actions/setup-python@v5
|
|
14
|
+
with:
|
|
15
|
+
python-version: 3.12
|
|
16
|
+
- name: Install dependencies
|
|
17
|
+
run: |
|
|
18
|
+
pip install sphinx sphinx_rtd_theme myst_parser sphinxcontrib-bibtex sphinx-gallery matplotlib
|
|
19
|
+
- name: Install package
|
|
20
|
+
run: pip install .
|
|
21
|
+
|
|
22
|
+
- name: Get data for example
|
|
23
|
+
run:
|
|
24
|
+
cd examples && wget https://github.com/nbereux/data_test/raw/refs/heads/main/dummy.zip
|
|
25
|
+
|
|
26
|
+
- name: Get RBM for example
|
|
27
|
+
run:
|
|
28
|
+
cd examples && wget https://github.com/nbereux/data_test/raw/refs/heads/main/RBM.zip
|
|
29
|
+
|
|
30
|
+
- name: Extract binary data
|
|
31
|
+
run:
|
|
32
|
+
cd examples && unzip dummy.zip
|
|
33
|
+
|
|
34
|
+
- name: Extract binary data
|
|
35
|
+
run:
|
|
36
|
+
cd examples && unzip RBM.zip
|
|
37
|
+
- name: Sphinx build
|
|
38
|
+
run: |
|
|
39
|
+
cd docs
|
|
40
|
+
make html
|
|
41
|
+
|
|
42
|
+
- name: Deploy to GitHub Pages
|
|
43
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
44
|
+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
|
45
|
+
with:
|
|
46
|
+
publish_branch: gh-pages
|
|
47
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
48
|
+
publish_dir: ./docs/_build/html
|
|
49
|
+
force_orphan: true
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Run tests and upload coverage
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
test:
|
|
8
|
+
if: github.ref == 'refs/heads/main'
|
|
9
|
+
name: Run tests on previous python versions
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
python-version: [3.11, 3.12]
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
|
|
20
|
+
- name: Set up Python
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{matrix.python-version}}
|
|
24
|
+
|
|
25
|
+
- name: Install test dependencies
|
|
26
|
+
run: pip install pytest
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: pip install .
|
|
30
|
+
|
|
31
|
+
- name: Get data for binary use case
|
|
32
|
+
run:
|
|
33
|
+
wget https://github.com/nbereux/data_test/raw/refs/heads/main/dummy.zip
|
|
34
|
+
|
|
35
|
+
- name: Get data for potts use case
|
|
36
|
+
run:
|
|
37
|
+
wget https://github.com/nbereux/data_test/raw/refs/heads/main/dummy.fasta
|
|
38
|
+
|
|
39
|
+
- name: Extract binary data
|
|
40
|
+
run:
|
|
41
|
+
unzip dummy.zip
|
|
42
|
+
|
|
43
|
+
- name: Run tests
|
|
44
|
+
run: pytest tests/
|
rbms-0.1/.gitignore
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
110
|
+
.pdm.toml
|
|
111
|
+
|
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
113
|
+
__pypackages__/
|
|
114
|
+
|
|
115
|
+
# Celery stuff
|
|
116
|
+
celerybeat-schedule
|
|
117
|
+
celerybeat.pid
|
|
118
|
+
|
|
119
|
+
# SageMath parsed files
|
|
120
|
+
*.sage.py
|
|
121
|
+
|
|
122
|
+
# Environments
|
|
123
|
+
.env
|
|
124
|
+
.venv
|
|
125
|
+
env/
|
|
126
|
+
venv/
|
|
127
|
+
ENV/
|
|
128
|
+
env.bak/
|
|
129
|
+
venv.bak/
|
|
130
|
+
|
|
131
|
+
# Spyder project settings
|
|
132
|
+
.spyderproject
|
|
133
|
+
.spyproject
|
|
134
|
+
|
|
135
|
+
# Rope project settings
|
|
136
|
+
.ropeproject
|
|
137
|
+
|
|
138
|
+
# mkdocs documentation
|
|
139
|
+
/site
|
|
140
|
+
|
|
141
|
+
# mypy
|
|
142
|
+
.mypy_cache/
|
|
143
|
+
.dmypy.json
|
|
144
|
+
dmypy.json
|
|
145
|
+
|
|
146
|
+
# Pyre type checker
|
|
147
|
+
.pyre/
|
|
148
|
+
|
|
149
|
+
# pytype static type analyzer
|
|
150
|
+
.pytype/
|
|
151
|
+
|
|
152
|
+
# Cython debug symbols
|
|
153
|
+
cython_debug/
|
|
154
|
+
|
|
155
|
+
# PyCharm
|
|
156
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
157
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
158
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
159
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
160
|
+
#.idea/
|
|
161
|
+
|
|
162
|
+
# my folders
|
|
163
|
+
model_archive/
|
|
164
|
+
data/
|
|
165
|
+
models/
|
|
166
|
+
stored_analysis/
|
|
167
|
+
notebooks/.ipynb_checkpoints
|
|
168
|
+
**/.vscode/
|
|
169
|
+
notebooks/*
|
|
170
|
+
src/
|
|
171
|
+
**/__pycache__/
|
|
172
|
+
**/*.csv
|
|
173
|
+
**/*.h5
|
|
174
|
+
**/*.fasta
|
|
175
|
+
**/*.zip
|
|
176
|
+
FacesBW.gif
|
|
177
|
+
!notebooks/demo_analyse_rbm.ipynb
|
rbms-0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 DsysDML
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
rbms-0.1/MANIFEST.in
ADDED
rbms-0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: rbms
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Training and analyzing Restricted Boltzmann Machines in PyTorch
|
|
5
|
+
Project-URL: Homepage, https://github.com/DsysDML/rbms
|
|
6
|
+
Project-URL: Issues, https://github.com/DsysDML/rbms/issues
|
|
7
|
+
Author: Aurélien Decelle, Cyril Furtlehner, Alfonso Navas, Lorenzo Rosset, Beatriz Seoane
|
|
8
|
+
Author-email: Nicolas Béreux <nicolas.bereux@gmail.com>
|
|
9
|
+
Maintainer-email: Nicolas Béreux <nicolas.bereux@gmail.com>
|
|
10
|
+
Keywords: Restricted Boltzmann Machine,rbm
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Requires-Dist: h5py>=3.12.0
|
|
16
|
+
Requires-Dist: matplotlib>=3.8.0
|
|
17
|
+
Requires-Dist: numpy<=2.1.2,>=2.0.0
|
|
18
|
+
Requires-Dist: scikit-learn==1.5.2
|
|
19
|
+
Requires-Dist: seaborn>=0.13.0
|
|
20
|
+
Requires-Dist: torch<=2.5.0,>=2.0.0
|
|
21
|
+
Requires-Dist: tqdm>=4.65.0
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
[](https://codecov.io/gh/DsysDML/rbms)
|
|
25
|
+
[](https://github.com/pre-commit/pre-commit)
|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# RBMs
|
|
30
|
+
|
|
31
|
+
## Overview
|
|
32
|
+
|
|
33
|
+
`rbms` is a GPU-accelerated package designed to train and analyze Restricted Boltzmann Machines (RBMs). It is intended for students and researchers who need an efficient tool for working with RBMs.
|
|
34
|
+
Features:
|
|
35
|
+
|
|
36
|
+
- GPU Acceleration through PyTorch.
|
|
37
|
+
- Multiple RBM Types: Supports Bernoulli-Bernoulli RBM and Potts-Bernoulli RBM.
|
|
38
|
+
- Extensible Design: Provides an abstract class RBM with methods that can be implemented for new types of RBMs, minimizing the need to reimplement training algorithms, analysis methods, and sampling methods.
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
To install TorchRBM, you can use pip:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install .
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Dependencies
|
|
49
|
+
|
|
50
|
+
The dependencies are included in the pyproject.toml file and should be compiled in the wheel distribution. If you have a GPU, make sure to install PyTorch with GPU support.
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
Main Classes and Functions:
|
|
55
|
+
- `RBM`: An abstract class that provides the basic structure and methods for RBMs.
|
|
56
|
+
- `BBRBM`: A concrete implementation of the Bernoulli-Bernoulli RBM.
|
|
57
|
+
- `PBRBM`: A concrete implementation of the Potts-Bernoulli RBM.
|
|
58
|
+
- `rbms.sampling`: Submodule for sampling methods.
|
|
59
|
+
- `rbms.training`: Submodule for training algorithms.
|
|
60
|
+
|
|
61
|
+
## Basic Example
|
|
62
|
+
|
|
63
|
+
Train a RBM on MNIST-01 with PCD-100 for 10 000 steps, using 200 hidden nodes and 2000 permanent chains:
|
|
64
|
+
```bash
|
|
65
|
+
rbms train -d ./data/MNIST.h5 --subset_labels 0 1 --num_hiddens 200 --gibbs_steps 100 --num_chains 2000 --num_updates 10000 --filename ./RBM_MNIST01.h5
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Documentation
|
|
69
|
+
|
|
70
|
+
The documentation is available at [https://dsysdml.github.io/rbms/](https://dsysdml.github.io/rbms/)
|
|
71
|
+
|
|
72
|
+
## Contributing
|
|
73
|
+
|
|
74
|
+
We welcome contributions to the development of TorchRBM. Here's how you can contribute:
|
|
75
|
+
|
|
76
|
+
- **Fork the Repository**: Fork the main repository and make your changes.
|
|
77
|
+
- **Propose a Merge Request**: Once your changes are complete, propose a merge request.
|
|
78
|
+
- **Testing**: Ensure your code is tested using the pytest framework. Include your tests in the tests folder.
|
|
79
|
+
- **Code Style**: Follow the pre-commit configuration for code style.
|
|
80
|
+
- **Documentation**: Document your code using the Google docstring style and provide type hints .
|
|
81
|
+
- **Dependencies**: Avoid adding extra dependencies unless absolutely necessary.
|
|
82
|
+
|
|
83
|
+
## Support
|
|
84
|
+
|
|
85
|
+
If you encounter any issues, please open an issue on the main repository.
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
`rbms` is released under the MIT License.
|
rbms-0.1/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[](https://codecov.io/gh/DsysDML/rbms)
|
|
2
|
+
[](https://github.com/pre-commit/pre-commit)
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# RBMs
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
`rbms` is a GPU-accelerated package designed to train and analyze Restricted Boltzmann Machines (RBMs). It is intended for students and researchers who need an efficient tool for working with RBMs.
|
|
11
|
+
Features:
|
|
12
|
+
|
|
13
|
+
- GPU Acceleration through PyTorch.
|
|
14
|
+
- Multiple RBM Types: Supports Bernoulli-Bernoulli RBM and Potts-Bernoulli RBM.
|
|
15
|
+
- Extensible Design: Provides an abstract class RBM with methods that can be implemented for new types of RBMs, minimizing the need to reimplement training algorithms, analysis methods, and sampling methods.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
To install TorchRBM, you can use pip:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install .
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Dependencies
|
|
26
|
+
|
|
27
|
+
The dependencies are included in the pyproject.toml file and should be compiled in the wheel distribution. If you have a GPU, make sure to install PyTorch with GPU support.
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
Main Classes and Functions:
|
|
32
|
+
- `RBM`: An abstract class that provides the basic structure and methods for RBMs.
|
|
33
|
+
- `BBRBM`: A concrete implementation of the Bernoulli-Bernoulli RBM.
|
|
34
|
+
- `PBRBM`: A concrete implementation of the Potts-Bernoulli RBM.
|
|
35
|
+
- `rbms.sampling`: Submodule for sampling methods.
|
|
36
|
+
- `rbms.training`: Submodule for training algorithms.
|
|
37
|
+
|
|
38
|
+
## Basic Example
|
|
39
|
+
|
|
40
|
+
Train a RBM on MNIST-01 with PCD-100 for 10 000 steps, using 200 hidden nodes and 2000 permanent chains:
|
|
41
|
+
```bash
|
|
42
|
+
rbms train -d ./data/MNIST.h5 --subset_labels 0 1 --num_hiddens 200 --gibbs_steps 100 --num_chains 2000 --num_updates 10000 --filename ./RBM_MNIST01.h5
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Documentation
|
|
46
|
+
|
|
47
|
+
The documentation is available at [https://dsysdml.github.io/rbms/](https://dsysdml.github.io/rbms/)
|
|
48
|
+
|
|
49
|
+
## Contributing
|
|
50
|
+
|
|
51
|
+
We welcome contributions to the development of TorchRBM. Here's how you can contribute:
|
|
52
|
+
|
|
53
|
+
- **Fork the Repository**: Fork the main repository and make your changes.
|
|
54
|
+
- **Propose a Merge Request**: Once your changes are complete, propose a merge request.
|
|
55
|
+
- **Testing**: Ensure your code is tested using the pytest framework. Include your tests in the tests folder.
|
|
56
|
+
- **Code Style**: Follow the pre-commit configuration for code style.
|
|
57
|
+
- **Documentation**: Document your code using the Google docstring style and provide type hints .
|
|
58
|
+
- **Dependencies**: Avoid adding extra dependencies unless absolutely necessary.
|
|
59
|
+
|
|
60
|
+
## Support
|
|
61
|
+
|
|
62
|
+
If you encounter any issues, please open an issue on the main repository.
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
`rbms` is released under the MIT License.
|
rbms-0.1/docs/Makefile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = source
|
|
9
|
+
BUILDDIR = _build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
rbms-0.1/docs/make.bat
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=source
|
|
11
|
+
set BUILDDIR=_build
|
|
12
|
+
|
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
14
|
+
if errorlevel 9009 (
|
|
15
|
+
echo.
|
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
|
20
|
+
echo.
|
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
22
|
+
echo.https://www.sphinx-doc.org/
|
|
23
|
+
exit /b 1
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
if "%1" == "" goto help
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = source
|
|
9
|
+
BUILDDIR = build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|