NNetCpp
Neural network implementation in C++
 All Classes Namespaces Functions Variables
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Neuron Class Reference

#include <Neuron.h>

Inheritance diagram for Neuron:
Node OutputNeuron

Public Member Functions

 Neuron (std::function< double(double)> activationFunc, std::vector< Edge * > inputs, std::vector< Edge * > outputs)
 
 Neuron (std::function< double(double)> activationFunc)
 
void setInputs (std::vector< Edge * > inputs)
 
void setOutputs (std::vector< Edge * > outputs)
 
void calcOutput ()
 
void calcDelta ()
 
double getOutput ()
 
double getDelta ()
 

Protected Member Functions

double sigmoidDelta ()
 

Protected Attributes

double delta = 0
 

Detailed Description

A neuron, part of a neural network.

Constructor & Destructor Documentation

Neuron::Neuron ( std::function< double(double)>  activationFunc,
std::vector< Edge * >  inputs,
std::vector< Edge * >  outputs 
)

Create a new Neuron with the given in- and outputs

Parameters
activationFuncfunction to use for neuron activation
inputsvector of pointers to incoming edges
outputsvector of pointers to outgoing edges
Neuron::Neuron ( std::function< double(double)>  activationFunc)

Create a new Neuron

Parameters
activationFuncfunction to use for neuron activation

Member Function Documentation

void Neuron::calcDelta ( )

Calculate and store the delta from this Neuron according to the GDR. All output Neurons should have their deltas updated before calculating this.

void Neuron::calcOutput ( )

Calculate and store the output from this Neuron. All input Neurons should have their outputs updated before calculating this.

double Neuron::getDelta ( )

Get delta for backpropagation

Returns
the delta of the Neuron
double Neuron::getOutput ( )
virtual

Get the output of this Neuron
Inherits:
Get the output of the node

Returns
the node's output

Implements Node.

void Neuron::setInputs ( std::vector< Edge * >  inputs)

Set the edges in to this Neuron

Parameters
inputsvector of pointers to incoming edges
void Neuron::setOutputs ( std::vector< Edge * >  outputs)

Set the edges out from this Neuron

Parameters
outputsvector of pointers to outgoing edges
double Neuron::sigmoidDelta ( )
protected

Get the derivative of a sigmoid activation function for this node

Returns
the derivative of the sigmoid

Member Data Documentation

double Neuron::delta = 0
protected

Delta for backpropagation


The documentation for this class was generated from the following files: