started moving learning algos to new namespace Machnine Learning
This commit is contained in:
@@ -1,38 +1,31 @@
|
||||
#include "../src/NeuronNetwork/FeedForward"
|
||||
#include "../src/NeuronNetwork/FeedForward"
|
||||
#include "../src/NeuronNetwork/Learning/BackPropagation"
|
||||
#include "../src/NeuralNetwork/FeedForward"
|
||||
#include "../src/NeuralNetwork/Learning/BackPropagation"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
class X: public Shin::NeuronNetwork::Problem
|
||||
class X: public Shin::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.data) {}
|
||||
X(const std::vector<float> &a):Problem(a) {}
|
||||
};
|
||||
|
||||
int main(int argc, char**)
|
||||
{
|
||||
srand(time(NULL));
|
||||
std::vector<Shin::NeuronNetwork::Solution> s;
|
||||
std::vector<Shin::Solution> s;
|
||||
std::vector<X> p;
|
||||
|
||||
//
|
||||
s.push_back(Shin::NeuronNetwork::Solution(std::vector<float>({1})));
|
||||
s.push_back(Shin::Solution(std::vector<float>({1})));
|
||||
p.push_back(X(std::vector<float>({0})));
|
||||
|
||||
s.push_back(Shin::NeuronNetwork::Solution(std::vector<float>({0})));
|
||||
s.push_back(Shin::Solution(std::vector<float>({0})));
|
||||
p.push_back(X(std::vector<float>({1})));
|
||||
|
||||
Shin::NeuronNetwork::FeedForward q({1,5000,5000,5000,1});
|
||||
Shin::NeuronNetwork::Learning::BackPropagation b(q);
|
||||
Shin::NeuralNetwork::FeedForward q({1,5000,5000,5000,1});
|
||||
Shin::NeuralNetwork::Learning::BackPropagation b(q);
|
||||
|
||||
if(argc >1)
|
||||
{
|
||||
@@ -42,6 +35,6 @@ int main(int argc, char**)
|
||||
for(int i=0;i<2;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][0] << "] res: " << q.solve(p[i%2])[0] << " should be " << s[i%2][0]<<"\n";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user