#include "../src/NeuralNetwork/FeedForward.h" #include "../src/NeuralNetwork/Learning/BackPropagation" #include #include //typedef Shin::NeuronNetwork::Problem X; class X: public Shin::Problem { public: X(const X& a) :Problem(a) {} X(const std::vector &a):Problem() { for (bool s:a) data.push_back((float)s);} protected: }; int main(int argc,char**) { srand(time(NULL)); std::vector s; std::vector p; // s.push_back(Shin::Solution(std::vector({1}))); p.push_back(X(std::vector({0}))); s.push_back(Shin::Solution(std::vector({0}))); p.push_back(X(std::vector({1}))); NeuralNetwork::FeedForward q({1,5000,5000,15000,2}); if(argc > 1) { std::cerr << "THREADING\n"; q.setThreads(2); } #include auto t1 = std::chrono::high_resolution_clock::now(); for(int i=0;i<1000;i++) { //b.teach(p[i%2],s[i%2]); q.solve(p[i%2])[0]; //std::cerr << i%2 <<". FOR: [" << p[i%2].representation()[0] << "] res: " << q.solve(p[i%2])[0] << " should be " << s[i%2][0]<<"\n"; } auto t2 = std::chrono::high_resolution_clock::now(); std::cout << "Time: " << std::chrono::duration_cast(t2-t1).count() << std::endl; }