added feedForward and moving Reccurent neuron to normal

This commit is contained in:
2016-01-28 22:17:36 +01:00
parent 13b179dd57
commit 3e383e9add
12 changed files with 265 additions and 252 deletions

View File

@@ -0,0 +1,43 @@
#pragma once
#include <cstddef>
#include <vector>
#include "../Neuron.h"
namespace NeuralNetwork {
namespace FeedForward {
/**
* @author Tomas Cernik (Tom.Cernik@gmail.com)
* @brief Class for Layer of FeedForward network
*/
class Layer
{
public:
~Layer() {};
/**
* @brief This is a virtual function for selecting neuron
* @param neuron is position in layer
* @returns Specific neuron
*/
Neuron& operator[](const std::size_t& neuron) {
return neurons[neuron];
}
void solve(const std::vector<float> &input, std::vector<float> &output);
/**
* @returns Size of layer
*/
std::size_t size() {
return neurons.size();
}
protected:
std::vector<Neuron> neurons;
};
}
}

View File

@@ -0,0 +1,53 @@
#pragma once
#include "../Network.h"
#include "Layer.h"
#include <vector>
#include <sstream>
#include <iomanip>
#include <limits>
namespace NeuralNetwork {
namespace FeedForward {
/**
* @author Tomas Cernik (Tom.Cernik@gmail.com)
* @brief FeedForward model of Artifical neural network
*/
class Network: public NeuralNetwork::Network {
public:
/**
* @brief Constructor for Network
* @param _inputSize is number of inputs to network
* @param _outputSize is size of output from network
* @param hiddenUnits is number of hiddenUnits to be created
*/
inline Network(size_t _inputSize):NeuralNetwork::Network() {
};
/**
* @brief Virtual destructor for Network
*/
virtual ~Network() {
};
/**
* @brief This is a function to compute one iterations of network
* @param input is input of network
* @returns output of network
*/
virtual std::vector<float> computeOutput(const std::vector<float>& input) override;
using NeuralNetwork::Network::stringify;
void stringify(std::ostream& out) const override {
}
protected:
std::vector<Layer> layers;
};
}
}