#include <Perceptron.h>
Public Types | |
enum | ActivationFunction { Threshold, SymmetricThreshold, Logistic, HyperbolicTangent, Linear } |
Public Member Functions | |
Perceptron (void) | |
Perceptron (int) | |
Perceptron (int, double) | |
Perceptron (const char *) | |
Perceptron (const Perceptron &) | |
virtual | ~Perceptron (void) |
Perceptron & | operator= (const Perceptron &) |
int | get_inputs_number (void) |
ActivationFunction & | get_activation_function (void) |
std::string | get_activation_function_name (void) |
double | get_bias (void) |
Vector< double > & | get_synaptic_weights (void) |
double | get_synaptic_weight (int) |
int | get_parameters_number (void) |
Vector< double > | get_parameters (void) |
bool | get_display (void) |
void | set (void) |
void | set (int) |
void | set (int, double) |
void | set (const Perceptron &) |
void | set_inputs_number (int) |
void | set_activation_function (const ActivationFunction &) |
void | set_activation_function (const std::string &) |
void | set_bias (double) |
void | set_synaptic_weights (const Vector< double > &) |
void | set_synaptic_weight (int, double) |
void | set_parameters (const Vector< double > &) |
void | set_display (bool) |
void | initialize_bias (double) |
void | initialize_bias_uniform (double, double) |
void | initialize_bias_normal (double, double) |
void | initialize_synaptic_weights (double) |
void | initialize_synaptic_weights_uniform (double, double) |
void | initialize_synaptic_weights_normal (double, double) |
void | initialize_parameters (double) |
double | calculate_combination (const Vector< double > &) |
double | calculate_activation (double) |
double | calculate_activation_derivative (double) |
double | calculate_activation_second_derivative (double) |
double | calculate_output (const Vector< double > &) |
std::string | to_XML (bool) |
void | print (void) |
void | save (const char *) |
void | load (const char *) |
Definition at line 27 of file Perceptron.h.
Enumeration of available activation functions for the perceptron neuron model.
Definition at line 63 of file Perceptron.h.
Flood::Perceptron::Perceptron | ( | void | ) | [explicit] |
Default constructor. It creates a perceptron object with zero inputs. The neuron's bias is initialized to zero. This constructor also initializes the rest of class members to their default values:
Definition at line 35 of file Perceptron.cpp.
Flood::Perceptron::Perceptron | ( | int | new_inputs_number | ) | [explicit] |
Inputs number constructor. It creates a perceptron object with a given number of inputs. The neuron's free paramameters (bias and synaptic weights) are initialized at random with a normal distribution of mean 0 and standard deviation 1. This constructor also initializes the rest of class members to their default values:
new_inputs_number | Number of inputs in the neuron. |
Definition at line 51 of file Perceptron.cpp.
Flood::Perceptron::Perceptron | ( | int | new_inputs_number, | |
double | new_parameters_value | |||
) | [explicit] |
Inputs number and initialization constructor. This creates a perceptron with a given number of inputs. It also initializes the bias and synaptic weights with a given value.
new_inputs_number | Number of inputs in the neuron. | |
new_parameters_value | Bias and synaptic weights initialization value. |
Definition at line 62 of file Perceptron.cpp.
Flood::Perceptron::Perceptron | ( | const char * | filename | ) | [explicit] |
File constructor. It creates a perceptron object by loading its members from a XML-type file. Please check the format of that file in the User's Guide.
filename | Name of perceptron XML-type. |
Definition at line 72 of file Perceptron.cpp.
Flood::Perceptron::Perceptron | ( | const Perceptron & | other_perceptron | ) |
Copy constructor. It creates a percdeptron object by copying its members with those for other perceptron object.
other_perceptron | Perceptron object to be copied. |
Definition at line 81 of file Perceptron.cpp.
Flood::Perceptron::~Perceptron | ( | void | ) | [virtual] |
double Flood::Perceptron::calculate_activation | ( | double | combination | ) |
This method returns the activation from the neuron for a combination. The output depends on the activation function used.
combination | Combination of the neuron. |
Definition at line 712 of file Perceptron.cpp.
double Flood::Perceptron::calculate_activation_derivative | ( | double | combination | ) |
This method returns the activation derivative of the neuron for a combination. The output derivative depends on the activation function used.
combination | Combination of the neuron. |
Definition at line 779 of file Perceptron.cpp.
double Flood::Perceptron::calculate_activation_second_derivative | ( | double | combination | ) |
This method returns the activation second derivative of the neuron for a combination. The second derivative of the output depends on the activation function used.
combination | Combination of the neuron. |
Definition at line 840 of file Perceptron.cpp.
double Flood::Perceptron::calculate_combination | ( | const Vector< double > & | input | ) |
This method returns the combination to the neuron for a set of input signals, using the dot product combination function.
input | Set of input signals to the neuron. |
Definition at line 675 of file Perceptron.cpp.
double Flood::Perceptron::calculate_output | ( | const Vector< double > & | input | ) |
This method returns the output from the neuron for a set of input signals. The output depends on the activation function used.
input | Set of input signals to the neuron. |
Definition at line 901 of file Perceptron.cpp.
Perceptron::ActivationFunction & Flood::Perceptron::get_activation_function | ( | void | ) |
This method returns the activation function of the neuron.
Definition at line 133 of file Perceptron.cpp.
std::string Flood::Perceptron::get_activation_function_name | ( | void | ) |
This method returns a string with the name of the activation function of the neuron.
Definition at line 143 of file Perceptron.cpp.
double Flood::Perceptron::get_bias | ( | void | ) |
bool Flood::Perceptron::get_display | ( | void | ) |
This method returns true if messages from this class are to be displayed on the screen, or false if messages from this class are not to be displayed on the screen.
Definition at line 244 of file Perceptron.cpp.
int Flood::Perceptron::get_inputs_number | ( | void | ) | [inline] |
Vector< double > Flood::Perceptron::get_parameters | ( | void | ) |
This method returns the parameters (bias and synaptic weights) of the perceptron.
Definition at line 510 of file Perceptron.cpp.
int Flood::Perceptron::get_parameters_number | ( | void | ) |
This method returns the number of parameters (bias and synaptic weights) in the perceptron.
Definition at line 498 of file Perceptron.cpp.
double Flood::Perceptron::get_synaptic_weight | ( | int | synaptic_weight_index | ) |
This method returns the synaptic weight value with index i of the neuron.
synaptic_weight_index | Synaptic weight index. |
Definition at line 215 of file Perceptron.cpp.
Vector< double > & Flood::Perceptron::get_synaptic_weights | ( | void | ) |
This method returns the synaptic weight values of the neuron.
Definition at line 204 of file Perceptron.cpp.
void Flood::Perceptron::initialize_bias | ( | double | value | ) |
This method initializes the bias with a given value.
value | Initialization value. |
Definition at line 565 of file Perceptron.cpp.
void Flood::Perceptron::initialize_bias_normal | ( | double | mean, | |
double | standard_deviation | |||
) |
This method initializes the neuron's bias with random values chosen from a normal distribution.
mean | Mean of normal distribution. | |
standard_deviation | Standard deviation of normal distribution. |
Definition at line 624 of file Perceptron.cpp.
void Flood::Perceptron::initialize_bias_uniform | ( | double | minimum, | |
double | maximum | |||
) |
This method initializes the neuron's bias with a random value chosen from a uniform distribution.
minimum | Minimum initialization value. | |
maximum | Maximum initialization value. |
Definition at line 577 of file Perceptron.cpp.
void Flood::Perceptron::initialize_parameters | ( | double | value | ) |
This method initializes the bias and the synaptic weights with a given value.
value | Parameters initialization value. |
Definition at line 662 of file Perceptron.cpp.
void Flood::Perceptron::initialize_synaptic_weights_normal | ( | double | mean, | |
double | standard_deviation | |||
) |
This method initializes the neuron's synaptic weights with random values chosen from a normal distribution.
mean | Mean of normal distribution. | |
standard_deviation | Standard deviation of normal distribution. |
Definition at line 651 of file Perceptron.cpp.
void Flood::Perceptron::initialize_synaptic_weights_uniform | ( | double | minimum, | |
double | maximum | |||
) |
This method initializes the neuron's synaptic weights with random values chosen from an uniform distribution.
minimum | Minimum initialization value. | |
maximum | Maximum initialization value. |
Definition at line 612 of file Perceptron.cpp.
void Flood::Perceptron::load | ( | const char * | filename | ) |
This method loads from a XML-type file the members of the neuron. Please mind about the file format, which is specified in the User's Guide.
Definition at line 1026 of file Perceptron.cpp.
Perceptron & Flood::Perceptron::operator= | ( | const Perceptron & | other_perceptron | ) |
Assignment operator. It assigns to the current perceptron the members of an existing perceptron.
other_perceptron | Assigning perceptron object . |
Definition at line 107 of file Perceptron.cpp.
void Flood::Perceptron::print | ( | void | ) |
This method prints to the screen the members of this object in XML-type format.
Definition at line 980 of file Perceptron.cpp.
void Flood::Perceptron::save | ( | const char * | filename | ) |
This method saves to a XML-type file a string representation of this object.
filename | Name of perceptron XML-type file. |
Definition at line 994 of file Perceptron.cpp.
void Flood::Perceptron::set | ( | const Perceptron & | other_perceptron | ) |
This method sets the members of this perceptron object with those from other perceptron object.
other_perceptron | Setting perceptron object. |
Definition at line 316 of file Perceptron.cpp.
void Flood::Perceptron::set | ( | int | new_inputs_number, | |
double | new_parameters_value | |||
) |
This method sets the number of inputs to a given value and initializes the bias and the synaptic weights with a given value.
new_inputs_number | Number of inputs in the neuron. | |
new_parameters_value | Parameters initialization value. |
Definition at line 298 of file Perceptron.cpp.
void Flood::Perceptron::set | ( | int | new_inputs_number | ) |
This method sets a new number of inputs. It also sets the other members of this object to their defaul values.
new_inputs_number | Number of inputs in the neuron. |
Definition at line 272 of file Perceptron.cpp.
void Flood::Perceptron::set | ( | void | ) |
This method sets the number of inputs to zero and the rest of members to their default values.
Definition at line 254 of file Perceptron.cpp.
void Flood::Perceptron::set_activation_function | ( | const std::string & | new_activation_function_name | ) |
This method sets a new activation function in the perceptron with a string containing the name of the activation function.
new_activation_function_name | String with name of activation function. |
Definition at line 347 of file Perceptron.cpp.
void Flood::Perceptron::set_activation_function | ( | const ActivationFunction & | new_activation_function | ) |
This method sets a new activation function in the neuron.
new_activation_function | Activation function. |
Definition at line 335 of file Perceptron.cpp.
void Flood::Perceptron::set_bias | ( | double | new_bias | ) |
This method sets a new bias value for the perceptron.
new_bias | Bias value. |
Definition at line 381 of file Perceptron.cpp.
void Flood::Perceptron::set_display | ( | bool | new_display | ) |
This method sets a new display value. If it is set to true messages from this class are to be displayed on the screen; if it is set to false messages from this class are not to be displayed on the screen.
new_display | Display value. |
Definition at line 452 of file Perceptron.cpp.
void Flood::Perceptron::set_inputs_number | ( | int | new_inputs_number | ) |
This method sets a new number of inputs in the neuron. The new free paramameters (bias and synaptic weights) are initialized at random with a normal distribution of mean 0 and standard deviation 1.
new_inputs_number | Number of inputs in the neuton. |
Definition at line 465 of file Perceptron.cpp.
void Flood::Perceptron::set_parameters | ( | const Vector< double > & | new_parameters | ) |
This method set a new set of parameters (bias and synaptic weights) to the perceptron.
new_parameters | New set of parameters |
Definition at line 532 of file Perceptron.cpp.
void Flood::Perceptron::set_synaptic_weight | ( | int | synaptic_weight_index, | |
double | new_synaptic_weight | |||
) |
This method sets the synaptic weight value with index i for the neuron.
synaptic_weight_index | Synaptic weight index. | |
new_synaptic_weight | Synaptic weight value. |
Definition at line 421 of file Perceptron.cpp.
void Flood::Perceptron::set_synaptic_weights | ( | const Vector< double > & | new_synaptic_weights | ) |
This method a new set of synaptic weights for the perceptron.
new_synaptic_weights | Synaptic weight values. |
Definition at line 392 of file Perceptron.cpp.
std::string Flood::Perceptron::to_XML | ( | bool | show_declaration | ) |
This method returns a XML-type string representation of this perceptron object.
show_declaration | True if a XML-type declaration is to be included at the begining, false otherwise. |
Definition at line 931 of file Perceptron.cpp.