Neuro/Neuron.h

45 lines
1010 B
C
Raw Normal View History

#pragma once
#include <stddef.h>
#include <vector>
2015-10-22 14:02:27 +00:00
#include <list>
class Layer;
class Neuron
{
private:
double outputValue;
std::vector<double> outputWeights;
double gradient;
public:
2015-03-24 12:45:38 +00:00
Neuron(double value = 1.0);
void setOutputValue(double value);
void feedForward(double inputValue);
double getWeightedOutputValue(size_t outputNeuron) const;
2015-10-22 14:02:27 +00:00
2015-10-15 20:37:13 +00:00
void createRandomOutputWeights(size_t numberOfWeights);
2015-10-22 14:02:27 +00:00
void createOutputWeights(std::list<double> weights);
void createOutputWeights(size_t numberOfWeights, double weight);
double getOutputValue() const;
void calcOutputGradients(double targetValue);
void calcHiddenGradients(const Layer &nextLayer);
2015-10-16 21:23:27 +00:00
double getGradient() const;
double getOutputWeight(size_t index) const;
void setOutputWeight(size_t index, double value);
size_t getNumOutputWeights() const;
private:
static double transferFunction(double inputValue);
static double transferFunctionDerivative(double inputValue);
double sumDOW(const Layer &nextLayer) const;
};