feat: str methods for Autoencoder

This commit is contained in:
Lenoctambule
2026-03-29 09:41:33 +02:00
parent 7aabc5db48
commit 44bf4c0286
3 changed files with 10 additions and 2 deletions

View File

@@ -17,6 +17,9 @@ class NNLayer:
self.output_linear = None
self.activation_func = activation_func
def __str__(self):
return f'[ {self.W.shape[0]} => {self.W.shape[1]}\tlr:{self.lr}\tactivation:{self.activation_func.__name__} ]' # noqa
def forward(self, V: np.ndarray) -> np.ndarray:
self.input = normalize(V)
self.output_linear = self.input @ self.W + self.B
@@ -50,6 +53,9 @@ class DeepNNLayer:
activation_func)
)
def __str__(self):
return '\n'.join([str(layer) for layer in self.layers])
def forward(self, v: np.ndarray) -> np.ndarray:
for layer in self.layers:
v = layer.forward(v)