added Perceptron network

This commit is contained in:
2016-03-07 22:51:28 +01:00
parent 3c924d01f3
commit c130e55f4d
2 changed files with 58 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
#pragma once
#include "./Network.h"
#include <NeuralNetwork/ActivationFunction/Heaviside.h>
namespace NeuralNetwork {
namespace FeedForward {
class Perceptron : private Network{
public:
inline Perceptron(size_t _inputSize,size_t _outputSize):Network(_inputSize) {
appendLayer(_outputSize,ActivationFunction::Heaviside(0.0));
};
using Network::computeOutput;
using Network::randomizeWeights;
using Network::operator[];
protected:
};
}
}

View File

@@ -0,0 +1,38 @@
#pragma once
#include <vector>
#include <cmath>
#include <NeuralNetwork/FeedForward/Network.h>
#include "CorrectionFunction/Linear.h"
namespace NeuralNetwork {
namespace Learning {
/** @class BackPropagation
* @brief
*/
class PerceptronLearning {
public:
inline PerceptronLearning(FeedForward::Network &feedForwardNetwork): network(feedForwardNetwork), learningCoefficient(0.4) {
}
virtual ~PerceptronLearning() {
}
PerceptronLearning(const PerceptronLearning&)=delete;
PerceptronLearning& operator=(const NeuralNetwork::Learning::PerceptronLearning&) = delete;
void teach(const std::vector<float> &input, const std::vector<float> &output);
inline virtual void setLearningCoefficient (const float& coefficient) { learningCoefficient=coefficient; }
protected:
FeedForward::Network &network;
float learningCoefficient;
};
}
}