commit a0397e9d06b20bb81695383ceb78a5dcb49de32f
parent 8d6fe97d4f4dc3a399b534c3b6a7975f0a129a25
Author: David Freifeld <freifeld.david@gmail.com>
Date: Wed, 24 Jun 2020 18:57:30 -0700
Bug tentatively marked as fixed
Diffstat:
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/bpnn.cpp b/bpnn.cpp
@@ -77,6 +77,12 @@ Network::Network(char* path, int inputs, int hidden, int outputs, int neurons, i
void Network::feedforward()
{
+ for (int j = 0; j < layers[0].contents->rows(); j++) {
+ for (int k = 0; k < layers[0].contents->cols(); k++) {
+ (*layers[0].dZ)(j,k) = (*layers[0].activation_deriv)((*layers[0].contents)(j,k));
+ (*layers[0].contents)(j,k) = (*layers[0].activation)((*layers[0].contents)(j,k));
+ }
+ }
for (int i = 0; i < length-1; i++) {
*layers[i+1].contents = (*layers[i].contents) * (*layers[i].weights);
for (int j = 0; j < layers[i+1].contents->rows(); j++) {
@@ -86,15 +92,12 @@ void Network::feedforward()
for (int i = 1; i < length; i++) {
for (int j = 0; j < layers[i].contents->rows(); j++) {
for (int k = 0; k < layers[i].contents->cols(); k++) {
- // std::cout << *layers[i].contents << "\n\n\n" << j << " " << k << " vs " << layers[i].contents->rows() << " " << layers[i].contents->cols() << "\n";
- std::cout << (*layers[i].contents)(j,k) << " --> ";
(*layers[i].dZ)(j,k) = (*layers[i].activation_deriv)((*layers[i].contents)(j,k));
(*layers[i].contents)(j,k) = (*layers[i].activation)((*layers[i].contents)(j,k));
- std::cout << (*layers[i].contents)(j,k) << "\n";
}
}
}
- std::cout << "\n\nDONE\n\n";
+ // std::cout << "\n\nDONE\n\n";
}
void Network::list_net()