- adjusted params
This commit is contained in:
2026-06-06 12:49:09 +02:00
parent 588f58883f
commit 51274ee1ae
+4 -4
View File
@@ -27,7 +27,7 @@ from rbm.status import Status
TEXT = "Call me Ishmael. Some years ago" # the character sequence to learn (matches diagram example) TEXT = "Call me Ishmael. Some years ago" # the character sequence to learn (matches diagram example)
WIN = 2 # sliding-window width (= N in the diagram) WIN = 2 # sliding-window width (= N in the diagram)
STRIDE = 1 # sliding-window step size STRIDE = 1 # sliding-window step size
UNITS = 3 UNITS = 5
H_SIZE = 128 # hidden units per RBM cell H_SIZE = 128 # hidden units per RBM cell
NUM_EPOCHS = 1000 NUM_EPOCHS = 1000
NUM_ITERATIONS = 1 NUM_ITERATIONS = 1
@@ -36,7 +36,7 @@ TRAIN_PARAMS = TrainingParams(
learning_rate = 0.1, learning_rate = 0.1,
momentum = 0.5, momentum = 0.5,
num_epochs = NUM_EPOCHS, num_epochs = NUM_EPOCHS,
do_rao_blackwell = True, do_rao_blackwell = False,
num_gibbs_samples= 1 num_gibbs_samples= 1
) )
#WIN=3 #WIN=3
@@ -56,8 +56,8 @@ def str2vec(ch_str: str) -> Mat:
def to_window(text: str) -> list[str]: def to_window(text: str) -> list[str]:
result = [] result = []
_win = [' ']*UNITS _win = [' ']*UNITS
for ch in text: for _i in range(WIN - 1):
for _i in range(WIN-1): for ch in text:
_win = _win[1:WIN] + [ch] _win = _win[1:WIN] + [ch]
result += _win result += _win