- added ready of armadillo dat-file (Quick and dirty)

- added stack training for DeepStack
This commit is contained in:
2025-12-17 12:43:10 +01:00
parent 3ec170234b
commit 99657265af
3 changed files with 57 additions and 3 deletions
+20
View File
@@ -1,5 +1,25 @@
import numpy as np
from status import Status
from cd_train import cd_jens
from stack import Stack, StackType
class StackDeep(Stack):
def __init__(self, name: str):
Stack.__init__(self, StackType.Deep, name)
def batch_from(self, batch: np.ndarray, from_layer_id: int = 0):
_batch = np.matrix.copy(batch)
for index, layer in enumerate(self.layers):
if index == from_layer_id:
break
_batch = layer.v_to_ph(_batch)
return _batch
def train(self, batch: np.ndarray):
_batch = np.matrix.copy(batch)
for index, layer in enumerate(self.layers):
print(f"Train layer {index}")
_batch = self.batch_from(batch, index)
layer.train(_batch, cd_func=cd_jens, status=Status())