47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
#ifndef _BACK_PROPAGATION_H_
|
|
#define _BACK_PROPAGATION_H_
|
|
|
|
#include <math.h>
|
|
#include <thread>
|
|
#include <cstddef>
|
|
|
|
#include "../LayerNetwork.h"
|
|
#include "Learning.h"
|
|
|
|
/*
|
|
* http://sydney.edu.au/engineering/it/~comp4302/ann4-3s.pdf
|
|
* http://www.cs.cmu.edu/afs/cs/academic/class/15883-f13/slides/backprop.pdf
|
|
* http://airccse.org/journal/jcsit/0211ijcsit08.pdf
|
|
* http://www.cedar.buffalo.edu/~srihari/CSE574/Chap5/Chap5.3-BackProp.pdf
|
|
* http://stackoverflow.com/questions/13095938/can-somebody-please-explain-the-backpropagation-algorithm-to-me
|
|
* http://ufldl.stanford.edu/wiki/index.php/Backpropagation_Algorithm
|
|
*
|
|
* http://www.cleveralgorithms.com/nature-inspired/neural/backpropagation.html
|
|
*
|
|
*/
|
|
|
|
namespace NeuralNetwork
|
|
{
|
|
namespace Learning
|
|
{
|
|
class BackPropagation : public Learning
|
|
{
|
|
public:
|
|
BackPropagation(LayerNetwork &n): Learning(), network(n) {}
|
|
virtual ~BackPropagation();
|
|
|
|
BackPropagation(const NeuralNetwork::Learning::BackPropagation&) =delete;
|
|
BackPropagation operator=(const NeuralNetwork::Learning::BackPropagation&) =delete;
|
|
|
|
float teach(const std::vector<float>&p,const std::vector<float>&solution);
|
|
virtual void propagate(const std::vector<float>& expectation);
|
|
|
|
protected:
|
|
LayerNetwork &network;
|
|
inline virtual float correction(const float& expected, const float& computed) { return expected - computed;};
|
|
|
|
float **deltas=nullptr;
|
|
};
|
|
}
|
|
}
|
|
#endif |