new test, and multithreading in FFQ, MT in BP not working

This commit is contained in:
2014-11-12 22:26:38 +01:00
parent f81b5a5b5f
commit 24a72dbffb
10 changed files with 194 additions and 45 deletions

View File

@@ -18,7 +18,7 @@ class X: public Shin::NeuronNetwork::Problem
std::vector<bool> q;
};
int main()
int main(int argc)
{
srand(time(NULL));
std::vector<Shin::NeuronNetwork::Solution> s;
@@ -31,22 +31,29 @@ int main()
s.push_back(Shin::NeuronNetwork::Solution(std::vector<double>({0})));
p.push_back(X(std::vector<bool>({1})));
Shin::NeuronNetwork::FeedForwardNetworkQuick q({1,5000,5000,1});
Shin::NeuronNetwork::FeedForwardNetworkQuick q({1,5000,5000,5000,500,500,500,500});
Shin::NeuronNetwork::Learning::BackPropagation b(q);
int i=0;
std::cerr << i%4 <<". FOR: [" << p[i%2].representation()[0] << "] res: " << q.solve(p[i%2])[0] << " should be " << s[i%2][0]<<"\n";
if(argc > 1)
{
std::cerr << "THREADING\n";
q.setThreads(4);
}
for(int i=0;i<5;i++)
{
//b.teach(p[i%2],s[i%2]);
std::cerr << i%2 <<". FOR: [" << p[i%2].representation()[0] << "] res: " << q.solve(p[i%2])[0] << " should be " << s[i%2][0]<<"\n";
}
for(int i=0;i<5;i++)
{
//b.teach(p[i%2],s[i%2]);
// std::cerr << i%2 <<". FOR: [" << p[i%2].representation()[0] << "] res: " << q.solve(p[i%2])[0] << " should be " << s[i%2][0]<<"\n";
std::cerr << i%2 <<". FOR: [" << p[i%2].representation()[0] << "] res: " << q.solve(p[i%2])[0] << " should be " << s[i%2][0]<<"\n";
}
for(int i=0;i<2;i++)
{
// b.teach(p[i%2],s[i%2]);
std::cerr << i%4 <<". FOR: [" << p[i%4].representation()[0] << "," <<p[i%4].representation()[0] << "] res: " << q.solve(p[i%4])[0] << " should be " <<
s[i%4][0]<<"\n";
// std::cerr << i%4 <<". FOR: [" << p[i%4].representation()[0] << "," <<p[i%4].representation()[0] << "] res: " << q.solve(p[i%4])[0] << " should be " <<
// s[i%4][0]<<"\n";
}
/*
for(int i=0;i<40;i++)