rbms 0.2.0__tar.gz → 0.2.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.
Files changed (106) hide show
  1. {rbms-0.2.0 → rbms-0.2.1}/PKG-INFO +1 -1
  2. {rbms-0.2.0 → rbms-0.2.1}/pyproject.toml +1 -1
  3. {rbms-0.2.0 → rbms-0.2.1}/rbms/bernoulli_bernoulli/implement.py +9 -3
  4. {rbms-0.2.0 → rbms-0.2.1}/rbms/classes.py +1 -0
  5. {rbms-0.2.0 → rbms-0.2.1}/rbms/dataset/load_fasta.py +1 -3
  6. {rbms-0.2.0 → rbms-0.2.1}/rbms/training/pcd.py +2 -2
  7. {rbms-0.2.0 → rbms-0.2.1}/.github/workflows/codecov.yaml +0 -0
  8. {rbms-0.2.0 → rbms-0.2.1}/.github/workflows/docs.yaml +0 -0
  9. {rbms-0.2.0 → rbms-0.2.1}/.github/workflows/test.yaml +0 -0
  10. {rbms-0.2.0 → rbms-0.2.1}/.github/workflows/whats_new.yaml +0 -0
  11. {rbms-0.2.0 → rbms-0.2.1}/.gitignore +0 -0
  12. {rbms-0.2.0 → rbms-0.2.1}/LICENSE +0 -0
  13. {rbms-0.2.0 → rbms-0.2.1}/MANIFEST.in +0 -0
  14. {rbms-0.2.0 → rbms-0.2.1}/README.md +0 -0
  15. {rbms-0.2.0 → rbms-0.2.1}/docs/Makefile +0 -0
  16. {rbms-0.2.0 → rbms-0.2.1}/docs/make.bat +0 -0
  17. {rbms-0.2.0 → rbms-0.2.1}/docs/source/api.md +0 -0
  18. {rbms-0.2.0 → rbms-0.2.1}/docs/source/auto_examples/images/sphx_glr_plot_generated_samples_001.png +0 -0
  19. {rbms-0.2.0 → rbms-0.2.1}/docs/source/auto_examples/images/sphx_glr_plot_generated_samples_002.png +0 -0
  20. {rbms-0.2.0 → rbms-0.2.1}/docs/source/auto_examples/images/sphx_glr_plot_generated_samples_003.png +0 -0
  21. {rbms-0.2.0 → rbms-0.2.1}/docs/source/auto_examples/images/sphx_glr_plot_generated_samples_004.png +0 -0
  22. {rbms-0.2.0 → rbms-0.2.1}/docs/source/auto_examples/images/thumb/sphx_glr_plot_generated_samples_thumb.png +0 -0
  23. {rbms-0.2.0 → rbms-0.2.1}/docs/source/auto_examples/index.rst +0 -0
  24. {rbms-0.2.0 → rbms-0.2.1}/docs/source/auto_examples/plot_generated_samples.codeobj.json +0 -0
  25. {rbms-0.2.0 → rbms-0.2.1}/docs/source/auto_examples/plot_generated_samples.ipynb +0 -0
  26. {rbms-0.2.0 → rbms-0.2.1}/docs/source/auto_examples/plot_generated_samples.py +0 -0
  27. {rbms-0.2.0 → rbms-0.2.1}/docs/source/auto_examples/plot_generated_samples.py.md5 +0 -0
  28. {rbms-0.2.0 → rbms-0.2.1}/docs/source/auto_examples/plot_generated_samples.rst +0 -0
  29. {rbms-0.2.0 → rbms-0.2.1}/docs/source/auto_examples/sg_execution_times.rst +0 -0
  30. {rbms-0.2.0 → rbms-0.2.1}/docs/source/conf.py +0 -0
  31. {rbms-0.2.0 → rbms-0.2.1}/docs/source/examples.md +0 -0
  32. {rbms-0.2.0 → rbms-0.2.1}/docs/source/index.md +0 -0
  33. {rbms-0.2.0 → rbms-0.2.1}/docs/source/myst.yml +0 -0
  34. {rbms-0.2.0 → rbms-0.2.1}/docs/source/rbm.md +0 -0
  35. {rbms-0.2.0 → rbms-0.2.1}/docs/source/references.bib +0 -0
  36. {rbms-0.2.0 → rbms-0.2.1}/docs/source/sg_execution_times.rst +0 -0
  37. {rbms-0.2.0 → rbms-0.2.1}/docs/source/tuto/dataset.md +0 -0
  38. {rbms-0.2.0 → rbms-0.2.1}/docs/source/tuto/parallel_tempering.md +0 -0
  39. {rbms-0.2.0 → rbms-0.2.1}/docs/source/tuto/train_rbm.md +0 -0
  40. {rbms-0.2.0 → rbms-0.2.1}/docs/source/tutorials.md +0 -0
  41. {rbms-0.2.0 → rbms-0.2.1}/docs/source/whats_new.rst +0 -0
  42. {rbms-0.2.0 → rbms-0.2.1}/examples/GALLERY_HEADER.rst +0 -0
  43. {rbms-0.2.0 → rbms-0.2.1}/examples/plot_generated_samples.py +0 -0
  44. {rbms-0.2.0 → rbms-0.2.1}/rbms/__init__.py +0 -0
  45. {rbms-0.2.0 → rbms-0.2.1}/rbms/bernoulli_bernoulli/__init__.py +0 -0
  46. {rbms-0.2.0 → rbms-0.2.1}/rbms/bernoulli_bernoulli/classes.py +0 -0
  47. {rbms-0.2.0 → rbms-0.2.1}/rbms/bernoulli_bernoulli/functional.py +0 -0
  48. {rbms-0.2.0 → rbms-0.2.1}/rbms/const.py +0 -0
  49. {rbms-0.2.0 → rbms-0.2.1}/rbms/custom_fn.py +0 -0
  50. {rbms-0.2.0 → rbms-0.2.1}/rbms/dataset/__init__.py +0 -0
  51. {rbms-0.2.0 → rbms-0.2.1}/rbms/dataset/dataset_class.py +0 -0
  52. {rbms-0.2.0 → rbms-0.2.1}/rbms/dataset/fasta_utils.py +0 -0
  53. {rbms-0.2.0 → rbms-0.2.1}/rbms/dataset/load_h5.py +0 -0
  54. {rbms-0.2.0 → rbms-0.2.1}/rbms/dataset/parser.py +0 -0
  55. {rbms-0.2.0 → rbms-0.2.1}/rbms/dataset/utils.py +0 -0
  56. {rbms-0.2.0 → rbms-0.2.1}/rbms/io.py +0 -0
  57. {rbms-0.2.0 → rbms-0.2.1}/rbms/map_model.py +0 -0
  58. {rbms-0.2.0 → rbms-0.2.1}/rbms/metrics/__init__.py +0 -0
  59. {rbms-0.2.0 → rbms-0.2.1}/rbms/metrics/aats.py +0 -0
  60. {rbms-0.2.0 → rbms-0.2.1}/rbms/parser.py +0 -0
  61. {rbms-0.2.0 → rbms-0.2.1}/rbms/partition_function/ais.py +0 -0
  62. {rbms-0.2.0 → rbms-0.2.1}/rbms/partition_function/exact.py +0 -0
  63. {rbms-0.2.0 → rbms-0.2.1}/rbms/plot.py +0 -0
  64. {rbms-0.2.0 → rbms-0.2.1}/rbms/potts_bernoulli/__init__.py +0 -0
  65. {rbms-0.2.0 → rbms-0.2.1}/rbms/potts_bernoulli/classes.py +0 -0
  66. {rbms-0.2.0 → rbms-0.2.1}/rbms/potts_bernoulli/functional.py +0 -0
  67. {rbms-0.2.0 → rbms-0.2.1}/rbms/potts_bernoulli/implement.py +0 -0
  68. {rbms-0.2.0 → rbms-0.2.1}/rbms/potts_bernoulli/tools.py +0 -0
  69. {rbms-0.2.0 → rbms-0.2.1}/rbms/potts_bernoulli/utils.py +0 -0
  70. {rbms-0.2.0 → rbms-0.2.1}/rbms/sampling/gibbs.py +0 -0
  71. {rbms-0.2.0 → rbms-0.2.1}/rbms/sampling/pt.py +0 -0
  72. {rbms-0.2.0 → rbms-0.2.1}/rbms/scripts/__init__.py +0 -0
  73. {rbms-0.2.0 → rbms-0.2.1}/rbms/scripts/entrypoint.py +0 -0
  74. {rbms-0.2.0 → rbms-0.2.1}/rbms/scripts/pt_sampling.py +0 -0
  75. {rbms-0.2.0 → rbms-0.2.1}/rbms/scripts/train_rbm.py +0 -0
  76. {rbms-0.2.0 → rbms-0.2.1}/rbms/training/utils.py +0 -0
  77. {rbms-0.2.0 → rbms-0.2.1}/rbms/utils.py +0 -0
  78. {rbms-0.2.0 → rbms-0.2.1}/tests/conftest.py +0 -0
  79. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/bernoulli_bernoulli/implement/test_compute_energy_bbrbm.py +0 -0
  80. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/bernoulli_bernoulli/implement/test_compute_energy_hiddens_bbrbm.py +0 -0
  81. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/bernoulli_bernoulli/implement/test_compute_energy_visibles_bbrbm.py +0 -0
  82. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/bernoulli_bernoulli/implement/test_compute_gradient_bbrbm.py +0 -0
  83. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/bernoulli_bernoulli/implement/test_init_chains_bbrbm.py +0 -0
  84. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/bernoulli_bernoulli/implement/test_init_parameters_bbrbm.py +0 -0
  85. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/bernoulli_bernoulli/implement/test_sample_hiddens_bbrbm.py +0 -0
  86. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/bernoulli_bernoulli/implement/test_sample_visibles_bbrbm.py +0 -0
  87. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/bernoulli_bernoulli/test_bernoulli_utils_bbrbm.py +0 -0
  88. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/bernoulli_bernoulli/test_functional_bbrbm.py +0 -0
  89. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/bernoulli_bernoulli/test_methods_bbrbm.py +0 -0
  90. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/metrics/test_aats.py +0 -0
  91. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/potts_bernoulli/implement/test_compute_energy_hiddens_pbrbm.py +0 -0
  92. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/potts_bernoulli/implement/test_compute_energy_pbrbm.py +0 -0
  93. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/potts_bernoulli/implement/test_compute_energy_visibles_pbrbm.py +0 -0
  94. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/potts_bernoulli/implement/test_compute_gradient_pbrbm.py +0 -0
  95. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/potts_bernoulli/implement/test_init_chains_pbrbm.py +0 -0
  96. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/potts_bernoulli/implement/test_init_parameters_pbrbm.py +0 -0
  97. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/potts_bernoulli/implement/test_sample_hiddens_pbrbm.py +0 -0
  98. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/potts_bernoulli/implement/test_sample_visibles_pbrbm.py +0 -0
  99. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/potts_bernoulli/test_functional_pbrbm.py +0 -0
  100. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/potts_bernoulli/test_methods_pbrbm.py +0 -0
  101. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/potts_bernoulli/test_utils_pbrbm.py +0 -0
  102. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/test_custom_fn.py +0 -0
  103. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/test_utils.py +0 -0
  104. {rbms-0.2.0 → rbms-0.2.1}/tests/unit_test/training/test_pcd.py +0 -0
  105. {rbms-0.2.0 → rbms-0.2.1}/tests/use_cases/test_bbrbm.py +0 -0
  106. {rbms-0.2.0 → rbms-0.2.1}/tests/use_cases/test_pbrbm.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rbms
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Training and analyzing Restricted Boltzmann Machines in PyTorch
5
5
  Project-URL: Homepage, https://github.com/DsysDML/rbms
6
6
  Project-URL: Issues, https://github.com/DsysDML/rbms/issues
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "rbms"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  authors = [
9
9
  {name="Nicolas Béreux", email="nicolas.bereux@gmail.com"},
10
10
  {name="Aurélien Decelle"},
@@ -47,7 +47,9 @@ def _compute_energy_visibles(
47
47
  ) -> Tensor:
48
48
  field = v @ vbias
49
49
  exponent = hbias + (v @ weight_matrix)
50
- log_term = torch.where(exponent < 10, torch.log(1.0 + torch.exp(exponent)), exponent)
50
+ log_term = torch.where(
51
+ exponent < 10, torch.log(1.0 + torch.exp(exponent)), exponent
52
+ )
51
53
  return -field - log_term.sum(1)
52
54
 
53
55
 
@@ -57,7 +59,9 @@ def _compute_energy_hiddens(
57
59
  ) -> Tensor:
58
60
  field = h @ hbias
59
61
  exponent = vbias + (h @ weight_matrix.T)
60
- log_term = torch.where(exponent < 10, torch.log(1.0 + torch.exp(exponent)), exponent)
62
+ log_term = torch.where(
63
+ exponent < 10, torch.log(1.0 + torch.exp(exponent)), exponent
64
+ )
61
65
  return -field - log_term.sum(1)
62
66
 
63
67
 
@@ -140,7 +144,9 @@ def _init_chains(
140
144
 
141
145
  if start_v is None:
142
146
  # Dummy mean visible
143
- mv = torch.ones(size=(num_samples, num_visibles), device=device, dtype=dtype) / 2
147
+ mv = (
148
+ torch.ones(size=(num_samples, num_visibles), device=device, dtype=dtype) / 2
149
+ )
144
150
  v = torch.bernoulli(mv)
145
151
  else:
146
152
  # Dummy mean visible
@@ -249,4 +249,5 @@ class RBM(EBM):
249
249
  for _ in range(n_steps):
250
250
  new_chains = self.sample_hiddens(chains=new_chains, beta=beta)
251
251
  new_chains = self.sample_visibles(chains=new_chains, beta=beta)
252
+ new_chains = self.sample_hiddens(chains=new_chains, beta=beta)
252
253
  return new_chains
@@ -52,11 +52,9 @@ def load_FASTA(
52
52
  weights = weights.squeeze(-1)
53
53
  if binarize:
54
54
  num_categories = len(np.unique(dataset))
55
- dataset_oh = (
55
+ dataset = (
56
56
  one_hot(torch.from_numpy(dataset).int(), num_classes=num_categories)
57
57
  .view(dataset.shape[0], -1)
58
58
  .numpy()
59
59
  )
60
- print("ici")
61
- assert np.allclose(dataset, dataset_oh)
62
60
  return dataset, weights, names
@@ -24,12 +24,12 @@ def fit_batch_pcd(
24
24
  beta: float,
25
25
  centered: bool = True,
26
26
  ) -> Tuple[dict[str, Tensor], dict]:
27
- """Sample the RBM and compute the gradient.
27
+ """Sample the EBM and compute the gradient.
28
28
 
29
29
  Args:
30
30
  batch (Tuple[Tensor, Tensor]): Dataset samples and associated weights.
31
31
  parallel_chains (dict[str, Tensor]): Parallel chains used for gradient computation.
32
- params (RBM): Parameters of the RBM.
32
+ params (EBM): Parameters of the EBM.
33
33
  gibbs_steps (int): Number of Gibbs steps to perform.
34
34
  beta (float): Inverse temperature.
35
35
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes