SuperNN  1.0.0
Public Member Functions | Public Attributes | List of all members
SuperNN::Neuron Struct Reference

Neuron, that can contain connections to neurons in the next layers. More...

Public Member Functions

 Neuron (bool _b=false)
 Constructor. More...
 
virtual ~Neuron ()
 
void connect (unsigned to_layer, unsigned to_neuron)
 Adds a connection to a neuron. More...
 
const Connectionoperator[] (unsigned c) const
 Returns a const reference to a connection. More...
 
Connectionoperator[] (unsigned c)
 Returns a reference to a connection. More...
 
void set_activation (ActFuncType type, double s=1)
 Sets the neuron activation function. More...
 
unsigned size () const
 Returns the number of synaptic connections. More...
 

Public Attributes

ActFuncType act_func
 Used activation function. More...
 
bool bias
 Marks if it's a bias neuron. More...
 
std::vector< Connectionconns
 Synaptic connections. More...
 
double delta
 Last local error gradient. More...
 
bool delta_ok
 Marks if the delta has been calculated for the current iteration. More...
 
double err
 Last error (desired - actual). More...
 
double net
 Last sum of the neuron inputs. More...
 
double out
 Last output of the neuron ( g(net) ) More...
 
double steep
 Activation function steepness. More...
 

Detailed Description

Neuron, that can contain connections to neurons in the next layers.

Definition at line 70 of file neuron.hpp.

Constructor & Destructor Documentation

SuperNN::Neuron::Neuron ( bool  _b = false)

Constructor.

Bias neurons (acts like an input neuron with fixed input of 1) should be placed in the input layer. There's no need for more than one bias neuron, as neurons can be connected to any neuron in any next layer.

Parameters
_bMarks if the neuron is a bias neuron
Returns
Neuron instance

Definition at line 41 of file neuron.cpp.

SuperNN::Neuron::~Neuron ( )
virtual

Definition at line 37 of file neuron.cpp.

Member Function Documentation

void SuperNN::Neuron::connect ( unsigned  to_layer,
unsigned  to_neuron 
)

Adds a connection to a neuron.

Parameters
to_layerLayer where the target neuron is located
to_neuronPosition of the target neuron in it's layer

Definition at line 46 of file neuron.cpp.

const Connection& SuperNN::Neuron::operator[] ( unsigned  c) const
inline

Returns a const reference to a connection.

Parameters
cConnection position
Returns
Const reference to the connection

Definition at line 90 of file neuron.hpp.

Connection& SuperNN::Neuron::operator[] ( unsigned  c)
inline

Returns a reference to a connection.

Parameters
cConnection position
Returns
Reference to the connection

Definition at line 101 of file neuron.hpp.

void SuperNN::Neuron::set_activation ( ActFuncType  type,
double  s = 1 
)

Sets the neuron activation function.

Parameters
typeActivation function type
sActivation function steepness

Definition at line 51 of file neuron.cpp.

unsigned SuperNN::Neuron::size ( ) const
inline

Returns the number of synaptic connections.

Returns
Number of synaptic connections

Definition at line 111 of file neuron.hpp.

Member Data Documentation

ActFuncType SuperNN::Neuron::act_func

Used activation function.

Definition at line 148 of file neuron.hpp.

bool SuperNN::Neuron::bias

Marks if it's a bias neuron.

Definition at line 157 of file neuron.hpp.

std::vector<Connection> SuperNN::Neuron::conns

Synaptic connections.

Definition at line 133 of file neuron.hpp.

double SuperNN::Neuron::delta

Last local error gradient.

Definition at line 145 of file neuron.hpp.

bool SuperNN::Neuron::delta_ok

Marks if the delta has been calculated for the current iteration.

Definition at line 154 of file neuron.hpp.

double SuperNN::Neuron::err

Last error (desired - actual).

Only for output neurons

Definition at line 142 of file neuron.hpp.

double SuperNN::Neuron::net

Last sum of the neuron inputs.

Definition at line 136 of file neuron.hpp.

double SuperNN::Neuron::out

Last output of the neuron ( g(net) )

Definition at line 139 of file neuron.hpp.

double SuperNN::Neuron::steep

Activation function steepness.

Definition at line 151 of file neuron.hpp.