tests refactored according to new modificatios
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
|
|
||||||
#include "../src/Network"
|
#include "../src/NeuronNetwork/Network"
|
||||||
#include "../src/Problem"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
class X: public S::Problem
|
class X: public Shin::NeuronNetwork::Problem
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
std::vector<bool> representation() const
|
std::vector<bool> representation() const
|
||||||
@@ -15,7 +14,7 @@ class X: public S::Problem
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
S::FeedForwardNetwork n(2,4,2);
|
Shin::NeuronNetwork::FeedForwardNetwork n(2,4,2);
|
||||||
if(n[1]->size() != 4)
|
if(n[1]->size() != 4)
|
||||||
{
|
{
|
||||||
std::cout << "ACtual size:" << n[0]->size();
|
std::cout << "ACtual size:" << n[0]->size();
|
||||||
@@ -23,7 +22,7 @@ int main()
|
|||||||
}
|
}
|
||||||
n[2]->operator[](0)->setPotential(25);
|
n[2]->operator[](0)->setPotential(25);
|
||||||
std::cout << "Potential: " << n[2]->operator[](0)->getPotential() << "\n";
|
std::cout << "Potential: " << n[2]->operator[](0)->getPotential() << "\n";
|
||||||
S::Solution s =n.solve(X());
|
Shin::NeuronNetwork::Solution s =n.solve(X());
|
||||||
if(s.size()!=2)
|
if(s.size()!=2)
|
||||||
{
|
{
|
||||||
std::cout << "1";
|
std::cout << "1";
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
#include "../src/Network"
|
#include "../src/NeuronNetwork/Network"
|
||||||
#include "../src/Problem"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
class X: public S::Problem
|
class X: public Shin::NeuronNetwork::Problem
|
||||||
{
|
{
|
||||||
public: X(bool x,bool y):x(x),y(y) {}
|
public: X(bool x,bool y):x(x),y(y) {}
|
||||||
protected: std::vector<bool> representation() const { return std::vector<bool>({x,y}); }
|
protected: std::vector<bool> representation() const { return std::vector<bool>({x,y}); }
|
||||||
@@ -15,7 +14,7 @@ int main()
|
|||||||
{
|
{
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
int lm=5;
|
int lm=5;
|
||||||
S::FeedForwardNetwork net(2,lm,1);
|
Shin::NeuronNetwork::FeedForwardNetwork net(2,lm,1);
|
||||||
bool x=1;
|
bool x=1;
|
||||||
int prev_err=0;
|
int prev_err=0;
|
||||||
int err=0;
|
int err=0;
|
||||||
@@ -52,7 +51,7 @@ int main()
|
|||||||
{
|
{
|
||||||
bool x= rand()%2;
|
bool x= rand()%2;
|
||||||
bool y=rand()%2;
|
bool y=rand()%2;
|
||||||
S::Solution s =net.solve(X(x,y));
|
Shin::NeuronNetwork::Solution s =net.solve(X(x,y));
|
||||||
if(s[0]!= (x xor y))
|
if(s[0]!= (x xor y))
|
||||||
err++;
|
err++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user