#pragma once #include #include #include "../Neuron.h" #include "../Stringifiable.h" namespace NeuralNetwork { namespace FeedForward { /** * @author Tomas Cernik (Tom.Cernik@gmail.com) * @brief Class for Layer of FeedForward network */ class Layer : public Stringifiable { public: Layer(std::size_t size, const ActivationFunction::ActivationFunction &activationFunction):neurons() { neurons.push_back(new BiasNeuron); for(std::size_t i=0;iclone()); } return *this; } ~Layer() { for(auto &neuron:neurons) { delete neuron; } }; /** * @brief This is a virtual function for selecting neuron * @param neuron is position in layer * @returns Specific neuron */ NeuronInterface& operator[](const std::size_t& neuron) { return *neurons[neuron]; } void solve(const std::vector &input, std::vector &output); /** * @returns Size of layer */ std::size_t size() { return neurons.size(); } void setInputSize(std::size_t size) { for(auto& neuron:neurons) { neuron->setInputSize(size); } } using Stringifiable::stringify; virtual void stringify(std::ostream& out) const override; protected: std::vector neurons; }; } }