train: fixed gaussian sampling

This commit is contained in:
2026-01-03 19:30:47 +01:00
parent e6c959d890
commit 6546c37657
+3 -2
View File
@@ -97,7 +97,7 @@ def cd_gaussian_binary(entity: Entity, data_pos: Mat):
# Positive phase # Positive phase
if params.do_batch_sample: if params.do_batch_sample:
h_probs_pos = entity.h_given_v(sample_gaussian(data_pos)) h_probs_pos = entity.h_given_v(data_pos + sample_gaussian(data_pos))
else: else:
h_probs_pos = entity.h_given_v(data_pos) h_probs_pos = entity.h_given_v(data_pos)
@@ -126,10 +126,11 @@ def cd_gaussian_gaussian(entity: Entity, data_pos: Mat):
# Positive phase # Positive phase
if params.do_batch_sample: if params.do_batch_sample:
h_probs_pos = entity.h_given_v(sample_gaussian(data_pos)) h_probs_pos = entity.h_given_v(data_pos + sample_gaussian(data_pos))
else: else:
h_probs_pos = entity.h_given_v(data_pos) h_probs_pos = entity.h_given_v(data_pos)
if not params.do_rao_blackwell:
# Sample hidden states # Sample hidden states
h_probs_pos += sample_gaussian(h_probs_pos) h_probs_pos += sample_gaussian(h_probs_pos)