train: fixed gaussian sampling
This commit is contained in:
+5
-4
@@ -97,7 +97,7 @@ def cd_gaussian_binary(entity: Entity, data_pos: Mat):
|
||||
|
||||
# Positive phase
|
||||
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:
|
||||
h_probs_pos = entity.h_given_v(data_pos)
|
||||
|
||||
@@ -126,12 +126,13 @@ def cd_gaussian_gaussian(entity: Entity, data_pos: Mat):
|
||||
|
||||
# Positive phase
|
||||
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:
|
||||
h_probs_pos = entity.h_given_v(data_pos)
|
||||
|
||||
# Sample hidden states
|
||||
h_probs_pos += sample_gaussian(h_probs_pos)
|
||||
if not params.do_rao_blackwell:
|
||||
# Sample hidden states
|
||||
h_probs_pos += sample_gaussian(h_probs_pos)
|
||||
|
||||
# Update weights (positive phase)
|
||||
dw = np.dot(np.transpose(data_pos), h_probs_pos)
|
||||
|
||||
Reference in New Issue
Block a user