From 3b68b9ad798a5349099635d4b93693be295ef12c Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Thu, 18 Dec 2025 15:49:18 +0100 Subject: [PATCH] - fixed v_to_ph parameter consideration - matrix: use different random implementations --- src/rbm/entity.py | 2 +- src/rbm/matrix.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rbm/entity.py b/src/rbm/entity.py index addeff6..9ff2cea 100644 --- a/src/rbm/entity.py +++ b/src/rbm/entity.py @@ -62,7 +62,7 @@ class Entity: def v_to_ph(self, v: np.ndarray) -> np.ndarray: state = self.state.v_to_h(v) - if self.params.do_gaussian_visible: + if self.params.do_gaussian_hidden: return state return prob(state) diff --git a/src/rbm/matrix.py b/src/rbm/matrix.py index 2158e35..4b7768e 100644 --- a/src/rbm/matrix.py +++ b/src/rbm/matrix.py @@ -1,13 +1,13 @@ import numpy as np import time -rng = np.random.default_rng(int(time.monotonic())) +np.random.seed(int(time.monotonic())) def uniform(shape: tuple, mu: float = 0.5, std: float = 1.0) -> np.ndarray: - return std * (rng.uniform(size=shape) + mu - 0.5) + return std * (np.random.rand(shape[0], shape[1]) + mu - 0.5) -def gaussian(shape: tuple, mu: float = 0.5, std: float = 1.0) -> np.ndarray: - return rng.normal(size=shape, loc=mu, scale=std) +def gaussian(shape: tuple, mu: float = 0.0, std: float = 1.0) -> np.ndarray: + return std * (np.random.randn(shape[0], shape[1]) + mu) def sample(src: np.ndarray) -> np.ndarray: return (src > uniform(src.shape)).astype(float)