33 lines
713 B
C++
33 lines
713 B
C++
#pragma once
|
|
|
|
#include <vector>
|
|
#include <cmath>
|
|
#include <NeuralNetwork/FeedForward/Network.h>
|
|
|
|
namespace NeuralNetwork {
|
|
namespace Learning {
|
|
|
|
/** @class BackPropagation
|
|
* @brief
|
|
*/
|
|
class BackPropagation {
|
|
|
|
public:
|
|
BackPropagation(): learningCoefficient(0.4) {
|
|
|
|
}
|
|
virtual ~BackPropagation() {
|
|
}
|
|
|
|
void teach(FeedForward::Network &n,const std::vector<float> &input, const std::vector<float> &output);
|
|
|
|
inline virtual void setLearningCoefficient (const float& coefficient) { learningCoefficient=coefficient; }
|
|
|
|
protected:
|
|
inline virtual float correction(const float & expected, const float &computed) const {
|
|
return expected-computed;
|
|
};
|
|
float learningCoefficient;
|
|
};
|
|
}
|
|
} |