don't know

This commit is contained in:
2014-12-10 16:01:53 +01:00
parent 993b4d3f04
commit aab9a073e9
35 changed files with 725 additions and 100 deletions

View File

@@ -5,19 +5,15 @@
#include <iostream>
#include <vector>
class X: public Shin::NeuronNetwork::Problem
{
public:
X(const X& a) :q(a.q) {}
X(const std::vector<float> &a):q(a) {}
std::vector<float> representation() const
{
return q;
}
protected:
std::vector<float> q;
X(const X& a) :Problem(a) {}
X(const std::vector<float> &a):Problem() {data=a;}
};
int main()
{
srand(time(NULL));
@@ -26,9 +22,9 @@ int main()
Shin::NeuronNetwork::FeedForwardNetworkQuick q({2,4,1});
Shin::NeuronNetwork::Learning::Reinforcement b(q);
//b.setPropagator(new Shin::NeuronNetwork::Learning::OpticalBackPropagation(q));
b.getPropagator().setLearningCoeficient(3);
b.getPropagator().setLearningCoeficient(0.4);
//b.getPropagator().allowEntropy();
double targetQuality =1;
double targetQuality =2.9;
if(test==2)
{
targetQuality =1.62;
@@ -38,9 +34,8 @@ int main()
b.getPropagator().setLearningCoeficient(0.5);
}
b.setQualityFunction(
[](const Shin::NeuronNetwork::Problem &pr,const Shin::NeuronNetwork::Solution &s)->float
[](const Shin::NeuronNetwork::Problem &p,const Shin::NeuronNetwork::Solution &s)->float
{
std::vector <float> p=pr;
float expect=0.0;
if(p[0] && p[1])
expect=0;
@@ -55,10 +50,10 @@ int main()
if(expect==0)
{
expect=0.1-abs(s[0]);
expect=0.3-abs(s[0]);
}else
{
expect=s[0]-0.9;
expect=s[0]-0.7;
}
// std::cerr << " returnning " << expect*5.0 << "\n";
@@ -93,7 +88,7 @@ int main()
std::cerr << i << " ("<< err <<").\n";
for(int j=0;j<4;j++)
{
std::cerr << "\t" << j%4 << ". FOR: [" << p[j%4]->representation()[0] << "," <<p[j%4]->representation()[1] << "] res: " <<
std::cerr << "\t" << i%4 <<". FOR: [" << p[j%4]->operator[](0) << "," <<p[j%4]->operator[](1) << "] res: " <<
q.solve(*p[j%4])[0] << "\n";
}
}