removed old code
This commit is contained in:
15
Makefile
15
Makefile
@@ -7,7 +7,7 @@ all:|pre libs
|
||||
pre:
|
||||
@mkdir -p lib
|
||||
|
||||
libs: ml nn
|
||||
libs: nn
|
||||
|
||||
test: all
|
||||
make -C tests
|
||||
@@ -17,18 +17,6 @@ _install:
|
||||
@mkdir -p build/lib
|
||||
@cp lib/*.so build/lib/
|
||||
|
||||
ml: | ml_build lib/MachineLearning.a lib/MachineLearning.so
|
||||
|
||||
lib/MachineLearning.so: ./src/MachineLearning/MachineLearning.so
|
||||
cp ./src/MachineLearning/MachineLearning.so ./lib/
|
||||
|
||||
lib/MachineLearning.a: ./src/MachineLearning/MachineLearning.a
|
||||
cp ./src/MachineLearning/MachineLearning.a ./lib/
|
||||
cp ./src/MachineLearning/MachineLearning.nm ./lib/
|
||||
|
||||
ml_build:
|
||||
@make -C src/MachineLearning
|
||||
|
||||
nn: | nn_build lib/NeuralNetwork.a lib/NeuralNetwork.so
|
||||
|
||||
lib/NeuralNetwork.so: ./src/NeuralNetwork/NeuralNetwork.so
|
||||
@@ -57,7 +45,6 @@ documentation:
|
||||
doxygen
|
||||
|
||||
clean:
|
||||
@make -C src/MachineLearning clean
|
||||
@make -C src/NeuralNetwork clean
|
||||
@make -C tests clean
|
||||
#@rm -f ./*.so ./*.a ./*.nm
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
#ifndef _S_ML_LEARNING_H_
|
||||
#define _S_ML_LEARNING_H_
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace Shin
|
||||
{
|
||||
namespace MachineLearning
|
||||
{
|
||||
const float LearningCoeficient=0.4;
|
||||
const float DefaultNoiseSize=500;
|
||||
class Learning
|
||||
{
|
||||
public:
|
||||
inline Learning() {};
|
||||
inline virtual ~Learning() {};
|
||||
|
||||
inline virtual void setLearningCoeficient (const float& coef) { learningCoeficient=coef; };
|
||||
|
||||
inline virtual void allowThreading() final {allowThreads=1;}
|
||||
inline virtual void disableThreading() final {allowThreads=0;}
|
||||
|
||||
inline virtual void allowNoise() final {noise=1;}
|
||||
inline virtual void disableNoise() final {noise=0;}
|
||||
inline virtual void setNoiseSize(const unsigned& milipercents) final { noiseSize=milipercents; }
|
||||
|
||||
protected:
|
||||
float learningCoeficient=Shin::MachineLearning::LearningCoeficient;
|
||||
bool allowThreads=0;
|
||||
bool noise=0;
|
||||
unsigned noiseSize=Shin::MachineLearning::DefaultNoiseSize;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,24 +0,0 @@
|
||||
OBJFILES=\
|
||||
QLearning.o
|
||||
|
||||
LINKFILES=
|
||||
|
||||
LIBNAME=MachineLearning
|
||||
|
||||
include ../../Makefile.const
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIBNAME).so $(LIBNAME).a
|
||||
|
||||
$(LIBNAME).so: $(OBJFILES)
|
||||
$(CXX) -shared $(CXXFLAGS) $(OBJFILES) $(LINKFILES) -o $(LIBNAME).so
|
||||
|
||||
$(LIBNAME).a: $(OBJFILES) ./Learning.h
|
||||
rm -f $(LIBNAME).a # create new library
|
||||
ar rcv $(LIBNAME).a $(OBJFILES) $(LINKFILES)
|
||||
ranlib $(LIBNAME).a
|
||||
nm --demangle $(LIBNAME).a > $(LIBNAME).nm
|
||||
|
||||
clean:
|
||||
@rm -f ./*.o ./*.so ./*.a ./*.nm ./*/*.o
|
||||
@@ -1 +0,0 @@
|
||||
./QFunction.h
|
||||
@@ -1,122 +0,0 @@
|
||||
#include "./QFunction"
|
||||
|
||||
Shin::NeuronNetwork::RL::QFunction::QFunction():learningCoeficient(0.1)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Shin::NeuronNetwork::RL::QFunction::~QFunction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Shin::NeuronNetwork::RL::QFunctionTable::QFunctionTable(float maxIODiff) :QFunction(),diff(maxIODiff),data(Shin::NeuronNetwork::RL::QFunctionTable::IOComparator(maxIODiff))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
float Shin::NeuronNetwork::RL::QFunctionTable::getScore(Shin::NeuronNetwork::Solution& s, Shin::NeuronNetwork::Problem& p)
|
||||
{
|
||||
auto element=data.find(p);
|
||||
if(element==data.end())
|
||||
return 0;
|
||||
auto solution=element->second.find(s);
|
||||
if(solution==element->second.end())
|
||||
return 0;
|
||||
return solution->second.first/solution->second.second;
|
||||
}
|
||||
|
||||
void Shin::NeuronNetwork::RL::QFunctionTable::learn(Shin::NeuronNetwork::Solution& s, Shin::NeuronNetwork::Problem& p, float quality)
|
||||
{
|
||||
auto element=data.find(p);
|
||||
if(element==data.end())
|
||||
{
|
||||
data[p]=std::map<Solution,std::pair<float,int>,Shin::NeuronNetwork::RL::QFunctionTable::IOComparator>(Shin::NeuronNetwork::RL::QFunctionTable::IOComparator(diff));
|
||||
element=data.find(p);
|
||||
}
|
||||
auto solution=element->second.find(s);
|
||||
if(solution==element->second.end())
|
||||
{
|
||||
element->second[s].first=quality;
|
||||
element->second[s].second=1;
|
||||
}else
|
||||
{
|
||||
solution->second.first+=quality;
|
||||
solution->second.second++;
|
||||
}
|
||||
}
|
||||
Shin::NeuronNetwork::RL::QFunctionNetwork::QFunctionNetwork() : b(nullptr),function(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Shin::NeuronNetwork::RL::QFunctionNetwork::~QFunctionNetwork()
|
||||
{
|
||||
if(function !=nullptr)
|
||||
{
|
||||
delete b;
|
||||
delete function;
|
||||
}
|
||||
}
|
||||
|
||||
void Shin::NeuronNetwork::RL::QFunctionNetwork::initialiseNetwork(size_t input, size_t size,size_t choices)
|
||||
{
|
||||
if(function == nullptr)
|
||||
{
|
||||
function = new FeedForward({(int)input,(int)size,(int)choices});
|
||||
b= new Learning::BackPropagation(*function);
|
||||
}
|
||||
}
|
||||
|
||||
void Shin::NeuronNetwork::RL::QFunctionNetwork::learn(Shin::NeuronNetwork::Solution& s, Shin::NeuronNetwork::Problem& p, float quality)
|
||||
{
|
||||
register int loops=abs(quality)/10;
|
||||
if(quality > 0)
|
||||
{
|
||||
while(loops-- >= 0)
|
||||
{
|
||||
b->teach(p,s);
|
||||
}
|
||||
}else
|
||||
{
|
||||
Shin::NeuronNetwork::Solution e;
|
||||
for(int j=s.size()-1;j>=0;j--)
|
||||
{
|
||||
e.push_back(((float)(100-(rand()%101)))/100.0);
|
||||
}
|
||||
while(loops-->=0)
|
||||
{
|
||||
b->teach(p,e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Shin::NeuronNetwork::RL::QFunctionNetwork::learn(Shin::NeuronNetwork::Problem& p, int, float quality)
|
||||
{
|
||||
if(quality>0)
|
||||
{
|
||||
b->setLearningCoeficient(learningA);
|
||||
}else
|
||||
{
|
||||
b->setLearningCoeficient(learningB);
|
||||
}
|
||||
// int choice= getChoice(p);
|
||||
Shin::NeuronNetwork::Solution s=function->solve(p);
|
||||
learn(s,p,quality);
|
||||
}
|
||||
|
||||
int Shin::NeuronNetwork::RL::QFunctionNetwork::getChoice(Shin::NeuronNetwork::Problem& p)
|
||||
{
|
||||
Solution s=function->solve(p);
|
||||
float max=-888888888888; //TODO
|
||||
int j=0;
|
||||
for(size_t i=0;i<s.size();i++)
|
||||
{
|
||||
if(s[i]>max)
|
||||
{
|
||||
max=s[i];
|
||||
j=i;
|
||||
}
|
||||
}
|
||||
return j;
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
#ifndef _Q_FUNCTION_H_
|
||||
#define _Q_FUNCTION_H_
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "Unsupervised.h"
|
||||
|
||||
#include "../Solution.h"
|
||||
//#include "../FeedForward.h"
|
||||
//#include "BackPropagation.h"
|
||||
//#include "OpticalBackPropagation.h"
|
||||
|
||||
|
||||
namespace Shin
|
||||
{
|
||||
namespace MachineLearning
|
||||
{
|
||||
class QFunction
|
||||
{
|
||||
public:
|
||||
QFunction();
|
||||
virtual ~QFunction();
|
||||
//virtual void learnDelayed(std::vector<std::pair<Solution,Problem>> &p, float quality)=0;
|
||||
//virtual void learn(Solution &s, Problem &p, float quality)=0;
|
||||
protected:
|
||||
float learningCoeficient;
|
||||
};
|
||||
/*
|
||||
class QFunctionTable : public QFunction
|
||||
{
|
||||
public:
|
||||
QFunctionTable(float maxIODiff=0.01);
|
||||
virtual void learnDelayed(std::vector<std::pair<Solution,Problem>> &p, float quality) override;
|
||||
virtual void learn(Solution &s, Problem &p, float quality) override;
|
||||
virtual float getScore(Solution &s, Problem &p);
|
||||
inline size_t size() {return data.size();}
|
||||
auto begin() {return data.begin();};
|
||||
auto end() {return data.end();};
|
||||
protected:
|
||||
float diff;
|
||||
struct IOComparator
|
||||
{
|
||||
IOComparator(float maxDiff=0):maxIODifference(maxDiff) {}
|
||||
bool operator() (const IO& l, const IO& r) const
|
||||
{
|
||||
if(l.size()!=r.size())
|
||||
{
|
||||
if(l.size() <r.size())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
for(size_t i=0;i<l.size();i++)
|
||||
{
|
||||
register float diff=l[i]-r[i];
|
||||
if(fabs(diff) > maxIODifference)
|
||||
{
|
||||
if(diff < maxIODifference)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
float maxIODifference=0.1;
|
||||
};
|
||||
std::map<Problem,std::map<Solution,std::pair<float,int>,IOComparator>,IOComparator> data;
|
||||
};
|
||||
|
||||
class QFunctionNetwork : public QFunction
|
||||
{
|
||||
public:
|
||||
QFunctionNetwork();
|
||||
QFunctionNetwork(const QFunctionNetwork&) =delete;
|
||||
virtual ~QFunctionNetwork();
|
||||
|
||||
QFunctionNetwork operator=(const QFunctionNetwork&) =delete;
|
||||
void initialiseNetwork(size_t input, size_t size,size_t choices);
|
||||
|
||||
virtual void learnDelayed(std::vector<std::pair<Solution,Problem>> &p, float quality) override;
|
||||
virtual void learnDelayed(std::vector<std::pair<Problem,int>> &p, float quality);
|
||||
virtual void learn(Solution &s, Problem &p, float quality) override;
|
||||
virtual void learn(Problem &s, int choice, float quality);
|
||||
|
||||
virtual int getChoice(Problem &p);
|
||||
virtual Solution getSolution(Problem &p) {return function->solve(p);}
|
||||
private:
|
||||
Learning::BackPropagation *b;
|
||||
FeedForward * function;
|
||||
};
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
./QLearning.h
|
||||
@@ -1,32 +0,0 @@
|
||||
#include "./QLearning"
|
||||
|
||||
void Shin::MachineLearning::QLearning::learnDelayed(std::vector< std::pair< Shin::Problem, int > >& p, float quality)
|
||||
{
|
||||
std::vector<std::pair<Problem,Solution>> q;
|
||||
register int solSize=0;
|
||||
if(p.size()>0)
|
||||
solSize=getSolution(p[0].first).size();
|
||||
if (!solSize)
|
||||
return;
|
||||
|
||||
for(size_t i=0;i<p.size();i++)
|
||||
{
|
||||
Solution s;
|
||||
for(int j=0;j<solSize;j++)
|
||||
{
|
||||
s.push_back(j==p[i].second?1:0);
|
||||
}
|
||||
q.push_back(std::pair<Problem,Solution>(p[i].first,s));
|
||||
}
|
||||
learnDelayed(q,quality);
|
||||
}
|
||||
|
||||
void Shin::MachineLearning::QLearning::learnDelayed(std::vector< std::pair<Shin::Problem, Shin::Solution> >& p, float quality)
|
||||
{
|
||||
for(int i=p.size()-1;i>=0;i--)
|
||||
{
|
||||
auto &pair=p[i];
|
||||
learn(pair.first,pair.second,quality);
|
||||
quality*=0.3;
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
#ifndef _QLEARNING_H_
|
||||
#define _QLEARNING_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
|
||||
#include "Unsupervised.h"
|
||||
#include "../NeuralNetwork/FeedForward.h"
|
||||
|
||||
/*
|
||||
* #include "BackPropagation.h"
|
||||
* #include "OpticalBackPropagation.h"
|
||||
* #include "../FeedForward.h"
|
||||
* #include "Unsupervised.h"
|
||||
* #include "QFunction.h"
|
||||
*/
|
||||
|
||||
/*
|
||||
* http://www2.econ.iastate.edu/tesfatsi/RLUsersGuide.ICAC2005.pdf
|
||||
* http://www.autonlab.org/tutorials/rl06.pdf
|
||||
* http://www.nbu.bg/cogs/events/2000/Readings/Petrov/rltutorial.pdf
|
||||
*
|
||||
* http://www.applied-mathematics.net/qlearning/qlearning.html
|
||||
* http://nn.cs.utexas.edu/downloads/papers/stanley.gecco02_1.pdf
|
||||
*
|
||||
* http://stackoverflow.com/questions/740389/good-implementations-of-reinforced-learning
|
||||
*
|
||||
* http://stackoverflow.com/questions/10722064/training-a-neural-network-with-reinforcement-learning
|
||||
*
|
||||
* http://remi.coulom.free.fr/Thesis/
|
||||
* http://remi.coulom.free.fr/Publications/Thesis.pdf
|
||||
*
|
||||
* http://link.springer.com/article/10.1007/BF00992696
|
||||
*
|
||||
* http://scholar.google.cz/scholar?start=10&q=reinforcement+learning+feedforward&hl=en&as_sdt=0,5&as_vis=1
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Shin
|
||||
{
|
||||
namespace MachineLearning
|
||||
{
|
||||
class QLearning: Learning
|
||||
{
|
||||
public:
|
||||
inline QLearning() {};
|
||||
virtual ~QLearning() {} ;
|
||||
|
||||
QLearning(const QLearning&) =delete;
|
||||
QLearning& operator=(const QLearning&) =delete;
|
||||
|
||||
virtual void learnDelayed(std::vector<std::pair<Problem,Solution>> &p, float quality) final;
|
||||
virtual void learnDelayed(std::vector<std::pair<Problem,int>> &p, float quality) final;
|
||||
|
||||
virtual void learn(Problem &p,Solution &s, const float& quality)=0;
|
||||
virtual void learn(Problem &p,int action, const float& quality)=0;
|
||||
|
||||
inline virtual void setLearningCoeficient(const float& a) override {setLearningCoeficient(a,a);};
|
||||
inline void setLearningCoeficient(const float& ok, const float& err) {learningA=ok;learningB=err;};
|
||||
|
||||
virtual Solution getSolution(Problem &p)=0;
|
||||
virtual int getChoice(Problem &p)=0;
|
||||
protected:
|
||||
float learningA=0.05;
|
||||
float learningB=0.008;
|
||||
|
||||
};
|
||||
|
||||
class QLearningNetwork : public QLearning
|
||||
{
|
||||
public:
|
||||
QLearningNetwork(size_t input, size_t size, size_t actions): QLearning(),function({input,size,actions}),actionsSize(actions) {}
|
||||
QLearningNetwork(std::initializer_list<size_t> s): QLearning(),function(s),actionsSize(*s.end()) {}
|
||||
|
||||
QLearningNetwork(const QLearningNetwork&)=delete;
|
||||
QLearningNetwork operator=(const QLearningNetwork&)=delete;
|
||||
|
||||
virtual void learn(Problem &p,Solution &s, const float& quality) override;
|
||||
virtual void learn(Problem &p,int action, const float& quality) override;
|
||||
|
||||
virtual Solution getSolution(Problem &p) override {return function.solve(p);}
|
||||
virtual int getChoice(Problem &p) override;
|
||||
protected:
|
||||
Shin::NeuralNetwork::FeedForward function;
|
||||
size_t actionsSize;
|
||||
};
|
||||
|
||||
class QLearningTable : public QLearning
|
||||
{
|
||||
public:
|
||||
QLearningTable():QLearning(),data() {};
|
||||
|
||||
QLearningTable(const QLearningTable&)=delete;
|
||||
QLearningTable operator=(const QLearningTable&)=delete;
|
||||
|
||||
virtual void learn(Problem &p,Solution &s, const float& quality) override;
|
||||
virtual void learn(Problem &p,int action, const float& quality) override;
|
||||
|
||||
virtual Solution getSolution(Problem &p) override;
|
||||
virtual int getChoice(Problem &p) override;
|
||||
protected:
|
||||
std::map<Problem,std::map<int,std::pair<float,int>>> data;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
./Reinforcement.h
|
||||
@@ -1,70 +0,0 @@
|
||||
#include "./Reinforcement"
|
||||
|
||||
Shin::NeuronNetwork::Learning::Reinforcement::Reinforcement(Shin::NeuronNetwork::FeedForward& n): Unsupervised(n), p(new BackPropagation(n))
|
||||
{
|
||||
p->setLearningCoeficient(1);
|
||||
}
|
||||
|
||||
Shin::NeuronNetwork::Learning::Reinforcement::~Reinforcement()
|
||||
{
|
||||
delete p;
|
||||
}
|
||||
|
||||
void Shin::NeuronNetwork::Learning::Reinforcement::setQualityFunction(std::function< float(const Problem&,const Solution&) > f)
|
||||
{
|
||||
qualityFunction=f;
|
||||
}
|
||||
|
||||
float Shin::NeuronNetwork::Learning::Reinforcement::learn(const Shin::NeuronNetwork::Problem& problem)
|
||||
{
|
||||
//network[2]->operator[](0)->setWeight(0,-5);
|
||||
Solution s=network.solve(problem);
|
||||
float quality=qualityFunction(problem,s);
|
||||
Solution q;
|
||||
//std::cerr << s[0] << "\n";
|
||||
|
||||
register int i=abs((int)quality);
|
||||
|
||||
if(quality > 0)
|
||||
{
|
||||
for(register size_t j=0;j<s.size();j++)
|
||||
{
|
||||
q.push_back(s[j]);//*((float)(990+(rand()%21))/1000.0));
|
||||
}
|
||||
}else if(quality <= 0 && i >= 0)
|
||||
{
|
||||
for(register size_t j=0;j<s.size();j++)
|
||||
{
|
||||
q.push_back(((float)(100-(rand()%101)))/100.0);
|
||||
}
|
||||
}
|
||||
|
||||
for(;i>=0;i--)
|
||||
{
|
||||
p->propagate(q);
|
||||
if(quality < 0)
|
||||
network.solve(problem); // resolve problem ??? TOTO: should it be here?
|
||||
}
|
||||
return quality;
|
||||
}
|
||||
|
||||
float Shin::NeuronNetwork::Learning::Reinforcement::learnSet(const std::vector< Shin::NeuronNetwork::Problem* >& problems)
|
||||
{
|
||||
float err=0;
|
||||
for(Shin::NeuronNetwork::Problem *pr:problems)
|
||||
{
|
||||
err+=learn(*pr);
|
||||
}
|
||||
return err/problems.size();
|
||||
}
|
||||
|
||||
void Shin::NeuronNetwork::Learning::Reinforcement::setCoef(double q)
|
||||
{
|
||||
p->setLearningCoeficient(q);
|
||||
}
|
||||
|
||||
void Shin::NeuronNetwork::Learning::Reinforcement::setPropagator(Shin::NeuronNetwork::Learning::BackPropagation* prop)
|
||||
{
|
||||
delete p;
|
||||
p=prop;
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
#ifndef _REINFORCEMENT_H_
|
||||
#define _REINFORCEMENT_H_
|
||||
|
||||
#include <math.h>
|
||||
#include <cstddef>
|
||||
|
||||
#include "../Problem.h"
|
||||
#include "../FeedForward.h"
|
||||
#include "BackPropagation"
|
||||
#include "Unsupervised"
|
||||
#include "functional"
|
||||
|
||||
/*
|
||||
* http://www2.econ.iastate.edu/tesfatsi/RLUsersGuide.ICAC2005.pdf
|
||||
* http://www.autonlab.org/tutorials/rl06.pdf
|
||||
* http://www.nbu.bg/cogs/events/2000/Readings/Petrov/rltutorial.pdf
|
||||
*
|
||||
* http://www.applied-mathematics.net/qlearning/qlearning.html
|
||||
* http://nn.cs.utexas.edu/downloads/papers/stanley.gecco02_1.pdf
|
||||
*
|
||||
* http://stackoverflow.com/questions/740389/good-implementations-of-reinforced-learning
|
||||
*
|
||||
* http://stackoverflow.com/questions/10722064/training-a-neural-network-with-reinforcement-learning
|
||||
*
|
||||
* http://remi.coulom.free.fr/Thesis/
|
||||
* http://remi.coulom.free.fr/Publications/Thesis.pdf
|
||||
*
|
||||
* http://link.springer.com/article/10.1007/BF00992696
|
||||
*
|
||||
* http://scholar.google.cz/scholar?start=10&q=reinforcement+learning+feedforward&hl=en&as_sdt=0,5&as_vis=1
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Shin
|
||||
{
|
||||
namespace NeuronNetwork
|
||||
{
|
||||
namespace Learning
|
||||
{
|
||||
class Reinforcement : public Unsupervised
|
||||
{
|
||||
public:
|
||||
Reinforcement(FeedForward &n);
|
||||
~Reinforcement();
|
||||
Reinforcement(const Reinforcement&) =delete;
|
||||
Reinforcement& operator=(const Reinforcement&) =delete;
|
||||
|
||||
void setQualityFunction(std::function<float(const Problem&,const Solution&)>);
|
||||
float learn(const Shin::NeuronNetwork::Problem &p);
|
||||
float learnSet(const std::vector<Shin::NeuronNetwork::Problem*> &);
|
||||
void setCoef(double q);
|
||||
inline BackPropagation& getPropagator() {return *p;};
|
||||
void setPropagator(BackPropagation *p);
|
||||
protected:
|
||||
float learningCoeficient=3;
|
||||
std::function<float(const Problem&,const Solution&)> qualityFunction=nullptr;
|
||||
BackPropagation *p;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef _UNSUPERVISEDLEARNING_H_
|
||||
#define _UNSUPERVISEDLEARNING_H_
|
||||
|
||||
#include "./Learning.h"
|
||||
|
||||
namespace Shin
|
||||
{
|
||||
namespace MachineLearning
|
||||
{
|
||||
class Unsupervised : public Learning
|
||||
{
|
||||
public:
|
||||
Unsupervised(): Learning() {};
|
||||
virtual ~Unsupervised() {};
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -27,8 +27,7 @@ int main(int argc,char**)
|
||||
s.push_back(Shin::Solution(std::vector<float>({0})));
|
||||
p.push_back(X(std::vector<bool>({1})));
|
||||
|
||||
Shin::NeuralNetwork::FeedForward q({1,5000,5000,15000,2});
|
||||
Shin::NeuralNetwork::Learning::BackPropagation b(q);
|
||||
NeuralNetwork::FeedForward q({1,5000,5000,15000,2});
|
||||
if(argc > 1)
|
||||
{
|
||||
std::cerr << "THREADING\n";
|
||||
@@ -36,7 +35,7 @@ int main(int argc,char**)
|
||||
}
|
||||
#include <chrono>
|
||||
auto t1 = std::chrono::high_resolution_clock::now();
|
||||
for(int i=0;i<100;i++)
|
||||
for(int i=0;i<1000;i++)
|
||||
{
|
||||
//b.teach(p[i%2],s[i%2]);
|
||||
q.solve(p[i%2])[0];
|
||||
|
||||
Reference in New Issue
Block a user