jacobian

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit c24114eb07e7d6c01207afd2e2775cc0266e91df
parent d14f074a4193fcde119fba02eb782462e114a8d9
Author: David Freifeld <freifeld.david@gmail.com>
Date:   Thu, 25 Jun 2020 12:16:59 -0700

Successful training of biases

Diffstat:
Mbpnn.cpp | 3++-
Mexample.cpp | 6+++---
2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/bpnn.cpp b/bpnn.cpp @@ -172,13 +172,14 @@ void Network::backpropagate() deltas.push_back(layers[i-1].contents->transpose() * gradients[counter]); counter++; } - for (int i = 0; i < gradients.size()-1; i++) { + for (int i = 0; i < length-1; i++) { Eigen::MatrixXd gradient = gradients[i]; // printf("Test2?\n"); // std::cout << "Batch sz: " << batch_size << "\n"; //std::cout << "Comparing " << length-3-i << " " <<length-2-i << " " << i << "\n"; //std::cout << deltas[i] << "DELTABOVE\n\n" << layers[length-2-i].contents->transpose() << "X_T\n\n" << *layers[length-2-i].weights << "WEIGHT2\n\n" << gradients[i] << "GRAD\n\n"; *layers[length-2-i].weights -= learning_rate * deltas[i]; + *layers[length-1-i].bias -= learning_rate * gradients[i]; // printf("Test2.5?\n"); //std::cout << deltas[i] << "\n\n" << *layers[length-2-i].bias << "(layer "<< length-2-i << " cuz " << length << " - 2 - " << i << ")\n"; // *layers[length-2-i].bias -= learning_rate * (deltas[i]); diff --git a/example.cpp b/example.cpp @@ -3,14 +3,14 @@ int main() { - Network net ("./extra.txt", 4, 1, 1, 5, 10, 5); + Network net ("./extra.txt", 4, 1, 1, 2, 10, 0.1); net.set_activation(0, "linear"); net.set_activation(1, "sigmoid"); net.set_activation(2, "sigmoid"); net.set_activation(3, "resig"); - // net.list_net(); + net.list_net(); net.train(50); - // net.list_net(); + net.list_net(); //char line[1024]; //net.stream->getline(line, 1024); //std::cout << line << "\n";