perceptron implementation changed + perceptronLearningAlgorithm and tests

This commit is contained in:
2016-03-08 23:10:38 +01:00
parent 4ef010b965
commit a48298b342
7 changed files with 97 additions and 7 deletions

View File

@@ -13,7 +13,15 @@ namespace FeedForward {
using Network::computeOutput;
using Network::randomizeWeights;
using Network::operator[];
inline std::size_t size() const {
return layers[1]->size();
}
inline NeuronInterface& operator[](const std::size_t& neuron) {
return layers[1]->operator[](neuron);
}
protected:
};
}

View File

@@ -3,19 +3,18 @@
#include <vector>
#include <cmath>
#include <NeuralNetwork/FeedForward/Network.h>
#include "CorrectionFunction/Linear.h"
#include <NeuralNetwork/FeedForward/Perceptron.h>
namespace NeuralNetwork {
namespace Learning {
/** @class BackPropagation
* @brief
/** @class PerceptronLearning
* @brief Basic algorithm for learning Perceptron
*/
class PerceptronLearning {
public:
inline PerceptronLearning(FeedForward::Network &feedForwardNetwork): network(feedForwardNetwork), learningCoefficient(0.4) {
inline PerceptronLearning(FeedForward::Perceptron &perceptronNetwork): perceptron(perceptronNetwork), learningCoefficient(0.1) {
}
virtual ~PerceptronLearning() {
@@ -30,7 +29,7 @@ namespace NeuralNetwork {
protected:
FeedForward::Network &network;
FeedForward::Perceptron &perceptron;
float learningCoefficient;
};