rbms 0.3.0__tar.gz → 0.3.2__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.3.0 → rbms-0.3.2}/PKG-INFO +1 -1
- {rbms-0.3.0 → rbms-0.3.2}/pyproject.toml +1 -1
- {rbms-0.3.0 → rbms-0.3.2}/rbms/dataset/__init__.py +2 -2
- {rbms-0.3.0 → rbms-0.3.2}/rbms/dataset/dataset_class.py +5 -4
- {rbms-0.3.0 → rbms-0.3.2}/rbms/dataset/load_h5.py +0 -8
- {rbms-0.3.0 → rbms-0.3.2}/rbms/io.py +3 -1
- {rbms-0.3.0 → rbms-0.3.2}/rbms/training/pcd.py +0 -1
- {rbms-0.3.0 → rbms-0.3.2}/rbms/training/utils.py +1 -1
- {rbms-0.3.0 → rbms-0.3.2}/.github/workflows/codecov.yaml +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/.github/workflows/test.yaml +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/.github/workflows/whats_new.yaml +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/.gitignore +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/LICENSE +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/MANIFEST.in +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/README.md +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/__init__.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/bernoulli_bernoulli/__init__.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/bernoulli_bernoulli/classes.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/bernoulli_bernoulli/functional.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/bernoulli_bernoulli/implement.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/classes.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/const.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/custom_fn.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/dataset/fasta_utils.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/dataset/load_fasta.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/dataset/parser.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/dataset/utils.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/map_model.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/metrics/__init__.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/metrics/aats.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/parser.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/partition_function/ais.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/partition_function/exact.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/plot.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/potts_bernoulli/__init__.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/potts_bernoulli/classes.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/potts_bernoulli/functional.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/potts_bernoulli/implement.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/potts_bernoulli/tools.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/potts_bernoulli/utils.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/sampling/gibbs.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/sampling/pt.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/scripts/__init__.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/scripts/entrypoint.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/scripts/pt_sampling.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/scripts/train_rbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/rbms/utils.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/conftest.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/bernoulli_bernoulli/implement/test_compute_energy_bbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/bernoulli_bernoulli/implement/test_compute_energy_hiddens_bbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/bernoulli_bernoulli/implement/test_compute_energy_visibles_bbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/bernoulli_bernoulli/implement/test_compute_gradient_bbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/bernoulli_bernoulli/implement/test_init_chains_bbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/bernoulli_bernoulli/implement/test_init_parameters_bbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/bernoulli_bernoulli/implement/test_sample_hiddens_bbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/bernoulli_bernoulli/implement/test_sample_visibles_bbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/bernoulli_bernoulli/test_bernoulli_utils_bbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/bernoulli_bernoulli/test_functional_bbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/bernoulli_bernoulli/test_methods_bbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/metrics/test_aats.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/implement/test_compute_energy_hiddens_pbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/implement/test_compute_energy_pbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/implement/test_compute_energy_visibles_pbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/implement/test_compute_gradient_pbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/implement/test_init_chains_pbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/implement/test_init_parameters_pbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/implement/test_sample_hiddens_pbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/implement/test_sample_visibles_pbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/test_functional_pbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/test_methods_pbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/test_utils_pbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/test_custom_fn.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/test_utils.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/training/test_pcd.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/use_cases/test_bbrbm.py +0 -0
- {rbms-0.3.0 → rbms-0.3.2}/tests/use_cases/test_pbrbm.py +0 -0
|
@@ -42,6 +42,8 @@ def load_dataset(
|
|
|
42
42
|
alphabet=alphabet,
|
|
43
43
|
device=device,
|
|
44
44
|
)
|
|
45
|
+
if not binarize:
|
|
46
|
+
is_binary = False
|
|
45
47
|
case _:
|
|
46
48
|
raise ValueError(
|
|
47
49
|
"""
|
|
@@ -51,8 +53,6 @@ def load_dataset(
|
|
|
51
53
|
- '.fasta'
|
|
52
54
|
"""
|
|
53
55
|
)
|
|
54
|
-
if not binarize:
|
|
55
|
-
is_binary = False
|
|
56
56
|
|
|
57
57
|
# Select subset of dataset w.r.t. labels
|
|
58
58
|
if subset_labels is not None and labels is not None:
|
|
@@ -130,13 +130,14 @@ class RBMDataset(Dataset):
|
|
|
130
130
|
test_size: Optional[float] = None,
|
|
131
131
|
) -> Tuple[Self, Self | None]:
|
|
132
132
|
num_samples = self.data.shape[0]
|
|
133
|
+
if test_size is None:
|
|
134
|
+
test_size = 1.0 - train_size
|
|
135
|
+
|
|
133
136
|
# Shuffle dataset
|
|
134
137
|
permutation_index = rng.permutation(num_samples)
|
|
135
138
|
train_size = int(train_size * num_samples)
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
else:
|
|
139
|
-
test_size = num_samples - train_size
|
|
139
|
+
test_size = int(test_size * num_samples)
|
|
140
|
+
|
|
140
141
|
train_dataset = RBMDataset(
|
|
141
142
|
data=self.data[permutation_index[:train_size]].cpu().numpy(),
|
|
142
143
|
labels=self.labels[permutation_index[:train_size]].cpu().numpy(),
|
|
@@ -31,14 +31,6 @@ def load_HDF5(
|
|
|
31
31
|
f"Ignoring labels since its dimension ({labels.shape[0]}) does not match the number of samples ({dataset.shape[0]})."
|
|
32
32
|
)
|
|
33
33
|
labels = None
|
|
34
|
-
# From BEG to Potts
|
|
35
|
-
if not binarize:
|
|
36
|
-
X = (dataset[:, :] + 1) / 2
|
|
37
|
-
for i in range(X.shape[0]):
|
|
38
|
-
for j in range(X.shape[1]):
|
|
39
|
-
if X[i, j] == 0.5:
|
|
40
|
-
X[i, j] = 2
|
|
41
|
-
return X, labels
|
|
42
34
|
if "cont" not in str(filename.resolve()):
|
|
43
35
|
unique_values = np.unique(dataset)
|
|
44
36
|
is_ising = np.all(unique_values == np.array([-1, 1]))
|
|
@@ -133,7 +133,9 @@ def load_model(
|
|
|
133
133
|
if "seed" in f["hyperparameters"].keys():
|
|
134
134
|
hyperparameters["seed"] = int(f["hyperparameters"]["seed"][()])
|
|
135
135
|
if "train_size" in f["hyperparameters"].keys():
|
|
136
|
-
hyperparameters["train_size"] =
|
|
136
|
+
hyperparameters["train_size"] = float(
|
|
137
|
+
f["hyperparameters"]["train_size"][()]
|
|
138
|
+
)
|
|
137
139
|
params = load_params(
|
|
138
140
|
filename=filename, index=index, device=device, dtype=dtype, map_model=map_model
|
|
139
141
|
)
|
|
@@ -15,7 +15,6 @@ from rbms.potts_bernoulli.utils import ensure_zero_sum_gauge
|
|
|
15
15
|
from rbms.training.utils import create_machine, setup_training
|
|
16
16
|
from rbms.utils import check_file_existence, log_to_csv
|
|
17
17
|
from rbms.parser import default_args, set_args_default
|
|
18
|
-
from rbms.potts_bernoulli.utils import ensure_zero_sum_gauge
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
def fit_batch_pcd(
|
|
@@ -137,7 +137,7 @@ def create_machine(
|
|
|
137
137
|
hyperparameters["gibbs_steps"] = gibbs_steps
|
|
138
138
|
hyperparameters["filename"] = str(filename)
|
|
139
139
|
hyperparameters["learning_rate"] = learning_rate
|
|
140
|
-
hyperparameters["train_size"] =
|
|
140
|
+
hyperparameters["train_size"] = train_size
|
|
141
141
|
hyperparameters["seed"] = seed
|
|
142
142
|
|
|
143
143
|
save_model(
|
|
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
|
{rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/bernoulli_bernoulli/implement/test_compute_energy_bbrbm.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/bernoulli_bernoulli/implement/test_init_chains_bbrbm.py
RENAMED
|
File without changes
|
|
File without changes
|
{rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/bernoulli_bernoulli/implement/test_sample_hiddens_bbrbm.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/implement/test_compute_energy_pbrbm.py
RENAMED
|
File without changes
|
|
File without changes
|
{rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/implement/test_compute_gradient_pbrbm.py
RENAMED
|
File without changes
|
{rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/implement/test_init_chains_pbrbm.py
RENAMED
|
File without changes
|
{rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/implement/test_init_parameters_pbrbm.py
RENAMED
|
File without changes
|
{rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/implement/test_sample_hiddens_pbrbm.py
RENAMED
|
File without changes
|
{rbms-0.3.0 → rbms-0.3.2}/tests/unit_test/potts_bernoulli/implement/test_sample_visibles_pbrbm.py
RENAMED
|
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
|