added L2-Regulation

This commit is contained in:
2026-01-06 18:00:26 +01:00
parent ff6254a15d
commit 542b8ae9b0
6 changed files with 61 additions and 77 deletions
+2 -2
View File
@@ -16,7 +16,7 @@ class TestModel(Model):
else:
# Hidden binary
self.unit1 = Entity((96 * 96, 333), EntityParams(do_gaussian_visible=True, do_gaussian_hidden=False),
TrainingParams(learning_rate=0.001, momentum=0.9, num_epochs=1000))
TrainingParams(learning_rate=0.001, momentum=0.9, num_epochs=1000, l2_lambda=0.4))
def forward(self, x: Mat):
x = self.unit1.forward(x)
@@ -38,7 +38,7 @@ if __name__ == "__main__":
model.init(0.1)
# load state
model.load()
# model.load()
# Load train data
train_batch = read_armadillo(os.path.join(prj_root, f"{prj_name}.training.dat"))