#include <neural++.hpp>
Public Member Functions | |
Synapsis (Neuron *i, Neuron *o, double w, double d) | |
Constructor. | |
Synapsis (Neuron *i, Neuron *o, double(*a)(double), double(*d)(double)) | |
Constructor. | |
Synapsis (Neuron *i, Neuron *o, double w, double(*a)(double), double(*d)(double)) | |
Constructor. | |
Neuron * | getIn () |
Neuron * | getOut () |
void | setWeight (double w) |
Set the weight of the synapsis. | |
void | setDelta (double d) |
It sets the delta (how much to change the weight after an update) of the synapsis. | |
double | getWeight () |
Return the weight of the synapsis. | |
double | getDelta () |
Return the delta of the synapsis. | |
double | getPrevDelta () |
Get the delta of the synapsis at the previous iteration. | |
double | momentum (int N, int x) |
Get the inertial momentum of a synapsis. | |
Private Attributes | |
double | delta |
double | prev_delta |
double | weight |
Neuron * | in |
Neuron * | out |
double(* | actv_f )(double) |
double(* | deriv )(double) |
Don't use this class directly unless you know what you're doing, use NeuralNet instead
Constructor.
i | Input neuron | |
o | Output neuron | |
w | Weight for the synapsis | |
d | Delta for the synapsis |
Constructor.
i | Input neuron | |
o | Output neuron | |
a | Activation function | |
d | Derivate for activation function |
neuralpp::Synapsis::Synapsis | ( | Neuron * | i, | |
Neuron * | o, | |||
double | w, | |||
double(*)(double) | a, | |||
double(*)(double) | d | |||
) |
Constructor.
i | Input neuron | |
o | Output neuron | |
w | Weight for the synapsis (default: random) | |
a | Activation function | |
d | Derivate for activation function |
Neuron* neuralpp::Synapsis::getIn | ( | ) |
Neuron* neuralpp::Synapsis::getOut | ( | ) |
void neuralpp::Synapsis::setWeight | ( | double | w | ) |
Set the weight of the synapsis.
w | Weight to be set |
void neuralpp::Synapsis::setDelta | ( | double | d | ) |
It sets the delta (how much to change the weight after an update) of the synapsis.
d | Delta to be set |
double neuralpp::Synapsis::getWeight | ( | ) |
Return the weight of the synapsis.
double neuralpp::Synapsis::getDelta | ( | ) |
Return the delta of the synapsis.
double neuralpp::Synapsis::getPrevDelta | ( | ) |
Get the delta of the synapsis at the previous iteration.
double neuralpp::Synapsis::momentum | ( | int | N, | |
int | x | |||
) |
Get the inertial momentum of a synapsis.
This value is inversely proportional to the number of steps done in the learning phase (quite high at the beginning, decreasing to zero towards the end of the learning algorithm), and is needed to avoid strong oscillations in output values at the beginning, caused by the random values assigned to the synaptical weights
N | The number of iterations the network must have to adjust the output values | |
x | The number of iterations already taken |
double neuralpp::Synapsis::delta [private] |
double neuralpp::Synapsis::prev_delta [private] |
double neuralpp::Synapsis::weight [private] |
Neuron* neuralpp::Synapsis::in [private] |
Neuron* neuralpp::Synapsis::out [private] |
double(* neuralpp::Synapsis::actv_f)(double) [private] |
double(* neuralpp::Synapsis::deriv)(double) [private] |