OpenNN::MultilayerPerceptron Class Reference

#include <multilayer_perceptron.h>

List of all members.

Public Member Functions

 MultilayerPerceptron (void)
 MultilayerPerceptron (const Vector< PerceptronLayer > &)
 MultilayerPerceptron (const Vector< unsigned int > &)
 MultilayerPerceptron (const unsigned int &, const unsigned int &)
 MultilayerPerceptron (const unsigned int &, const unsigned int &, const unsigned int &)
 MultilayerPerceptron (const MultilayerPerceptron &)
virtual ~MultilayerPerceptron (void)
MultilayerPerceptronoperator= (const MultilayerPerceptron &)
bool operator== (const MultilayerPerceptron &) const
Vector< unsigned int > arrange_architecture (void) const
unsigned int count_inputs_number (void) const
unsigned int count_layers_number (void) const
Vector< unsigned int > get_layers_inputs_number (void) const
Vector< unsigned int > arrange_layers_perceptrons_numbers (void) const
int count_outputs_number (void) const
const Vector< PerceptronLayer > & get_layers (void) const
const PerceptronLayerget_layer (const unsigned int &) const
PerceptronLayerget_layer_pointer (const unsigned int &)
unsigned int count_perceptrons_number (void) const
Vector< unsigned int > count_cumulative_perceptrons_number (void) const
Vector< unsigned int > arrange_layers_parameters_number (void) const
Vector< unsigned int > arrange_layers_cumulative_parameters_number (void) const
Vector< Vector< double > > arrange_layers_biases (void) const
Vector< Matrix< double > > arrange_layers_synaptic_weights (void) const
Vector< Vector< double > > get_layers_parameters (void) const
unsigned int count_parameters_number (void) const
Vector< double > arrange_parameters (void) const
unsigned int get_layer_index (const unsigned int &) const
unsigned int get_perceptron_index (const unsigned int &, const unsigned int &) const
unsigned int get_layer_bias_index (const unsigned int &, const unsigned int &) const
unsigned int get_layer_synaptic_weight_index (const unsigned int &, const unsigned int &, const unsigned int &) const
Vector< unsigned int > arrange_parameter_indices (const unsigned int &) const
Matrix< unsigned int > arrange_parameters_indices (void) const
Vector
< Perceptron::ActivationFunction
get_layers_activation_function (void) const
Vector< std::string > write_layers_activation_function (void) const
const bool & get_display (void) const
void set (void)
void set (const Vector< PerceptronLayer > &)
void set (const Vector< unsigned int > &)
void set (const unsigned int &, const unsigned int &)
void set (const unsigned int &, const unsigned int &, const unsigned int &)
void set (const MultilayerPerceptron &)
virtual void set_default (void)
void set_inputs_number (const unsigned int)
void set_layers_perceptrons_number (const Vector< unsigned int > &)
void set_layer_perceptrons_number (const unsigned int &, const unsigned int &)
void set_layers (const Vector< PerceptronLayer > &)
void set_layers_biases (const Vector< Vector< double > > &)
void set_layers_synaptic_weights (const Vector< Matrix< double > > &)
void set_layers_parameters (const Vector< Vector< double > > &)
void set_parameters (const Vector< double > &)
void initialize_biases (const double &)
void initialize_synaptic_weights (const double &)
void initialize_parameters (const double &)
void initialize_parameters_uniform (void)
void initialize_parameters_uniform (const double &, const double &)
void initialize_parameters_uniform (const Vector< double > &, const Vector< double > &)
void initialize_parameters_uniform (const Vector< Vector< double > > &)
void initialize_parameters_normal (void)
void initialize_parameters_normal (const double &, const double &)
void initialize_parameters_normal (const Vector< double > &, const Vector< double > &)
void initialize_parameters_normal (const Vector< Vector< double > > &)
void initialize_parameters (void)
double calculate_parameters_norm (void) const
void set_layers_activation_function (const Vector< Perceptron::ActivationFunction > &)
void set_layers_activation_function (const Vector< std::string > &)
void set_display (const bool &)
bool is_empty (void) const
void grow_input (const unsigned int &)
void grow_layer (const unsigned int &, const unsigned int &)
void prune_input (const unsigned int &)
void prune_layer (const unsigned int &, const unsigned int &)
void initialize_random (void)
Vector< double > calculate_layer_combination_combination (const unsigned int &, const Vector< double > &) const
Matrix< double > calculate_layer_combination_combination_Jacobian (const unsigned int &, const Vector< double > &) const
Vector< double > calculate_output_layer_combination (const unsigned int &, const Vector< double > &) const
Vector< Matrix< double > > calculate_output_layers_delta (const Vector< Vector< double > > &) const
Matrix< Vector< Matrix< double > > > calculate_output_interlayers_Delta (const Vector< Vector< Vector< double > > > &, const Matrix< Matrix< double > > &, const Vector< Matrix< double > > &) const
Vector< double > calculate_interlayer_combination_combination (const unsigned int &, const unsigned int &, const Vector< double > &) const
Matrix< double > calculate_interlayer_combination_combination_Jacobian (const unsigned int &, const unsigned int &, const Vector< double > &) const
Vector< Vector< double > > calculate_layers_input (const Vector< double > &) const
Vector< Vector< double > > arrange_layers_input (const Vector< double > &, const Vector< Vector< double > > &) const
Vector< Vector< double > > calculate_layers_combination (const Vector< double > &) const
Vector< Matrix< double > > calculate_layers_combination_Jacobian (const Vector< double > &) const
Vector< Matrix< double > > calculate_layers_combination_parameters_Jacobian (const Vector< Vector< double > > &) const
Vector< Vector< Vector< double > > > calculate_perceptrons_combination_parameters_gradient (const Vector< Vector< double > > &) const
Vector< Vector< double > > calculate_layers_activation (const Vector< double > &) const
Vector< Vector< double > > calculate_layers_activation_derivative (const Vector< double > &) const
Vector< Vector< double > > calculate_layers_activation_second_derivative (const Vector< double > &) const
Vector< Matrix< double > > calculate_layers_Jacobian (const Vector< double > &) const
Vector< Vector< Matrix< double > > > calculate_layers_Hessian_form (const Vector< double > &) const
Matrix< Matrix< double > > calculate_interlayers_combination_combination_Jacobian (const Vector< double > &) const
Matrix< Matrix< double > > calculate_interlayers_combination_combination_Jacobian (const Vector< Vector< double > > &) const
Vector< Vector< Vector< double > > > calculate_first_order_forward_propagation (const Vector< double > &) const
Vector< Vector< Vector< double > > > calculate_second_order_forward_propagation (const Vector< double > &) const
Vector< double > calculate_outputs (const Vector< double > &) const
Matrix< double > calculate_Jacobian (const Vector< double > &) const
Vector< Matrix< double > > calculate_Hessian_form (const Vector< double > &) const
Matrix< double > calculate_parameters_Jacobian (const Vector< double > &, const Vector< double > &) const
Vector< Matrix< double > > calculate_parameters_Hessian_form (const Vector< double > &, const Vector< double > &) const
TiXmlElement * to_XML (void) const
void from_XML (TiXmlElement *)
std::string write_expression (const Vector< std::string > &, const Vector< std::string > &) const
std::string to_string (void) const

Protected Attributes

Vector< PerceptronLayerlayers
bool display


Detailed Description

This class represents the concept of multilayer perceptron. A multilayer perceptron is a feed-forward network of layers of perceptrons. This is the most important class included in the definition of a neural network.

Definition at line 44 of file multilayer_perceptron.h.


Constructor & Destructor Documentation

OpenNN::MultilayerPerceptron::MultilayerPerceptron ( void   )  [explicit]

Default constructor. It creates a multilayer perceptron object witout any layer. This constructor also initializes the rest of class members to their default values.

Definition at line 39 of file multilayer_perceptron.cpp.

OpenNN::MultilayerPerceptron::MultilayerPerceptron ( const Vector< PerceptronLayer > &  new_layers  )  [explicit]

Layers constructor. It creates a multilayer perceptron object with given layers of perceptrons. This constructor also initializes the rest of class members to their default values.

Definition at line 51 of file multilayer_perceptron.cpp.

OpenNN::MultilayerPerceptron::MultilayerPerceptron ( const Vector< unsigned int > &  new_architecture  )  [explicit]

Architecture constructor. It creates a multilayer perceptron object with an arbitrary architecture. The architecture is represented by a vector of unsigned integers. The first element is the number of inputs. The rest of elements are the number of perceptrons in the subsequent layers. The multilayer perceptron parameters are initialized at random.

Parameters:
new_architecture Vector of unsigned integers representing the architecture of the multilayer perceptron.

Definition at line 67 of file multilayer_perceptron.cpp.

OpenNN::MultilayerPerceptron::MultilayerPerceptron ( const unsigned int &  new_inputs_number,
const unsigned int &  new_neurons_number 
) [explicit]

One layer constructor. It creates a one-layer perceptron object. The multilayer perceptron parameters are initialized at random. This constructor also initializes the rest of class members to their default values:

Parameters:
new_inputs_number Number of inputs in the layer.
new_neurons_number Number of neurons in the layer.

Definition at line 85 of file multilayer_perceptron.cpp.

OpenNN::MultilayerPerceptron::MultilayerPerceptron ( const unsigned int &  new_inputs_number,
const unsigned int &  new_hidden_neurons_number,
const unsigned int &  new_outputs_number 
) [explicit]

Two layers constructor. It creates a multilayer perceptron object with a hidden layer of perceptrons and an outputs layer of perceptrons. The multilayer perceptron parameters are initialized at random. This constructor also initializes the rest of class members to their default values.

Parameters:
new_inputs_number Number of inputs in the multilayer perceptron
new_hidden_neurons_number Number of neurons in the hidden layer of the multilayer perceptron
new_outputs_number Number of outputs neurons.

Definition at line 102 of file multilayer_perceptron.cpp.

OpenNN::MultilayerPerceptron::MultilayerPerceptron ( const MultilayerPerceptron other_multilayer_perceptron  ) 

Copy constructor. It creates a copy of an existing multilayer perceptron object.

Parameters:
other_multilayer_perceptron Multilayer perceptron object to be copied.

Definition at line 116 of file multilayer_perceptron.cpp.

OpenNN::MultilayerPerceptron::~MultilayerPerceptron ( void   )  [virtual]

Destructor. This destructor does not delete any pointer.

Definition at line 127 of file multilayer_perceptron.cpp.


Member Function Documentation

MultilayerPerceptron & OpenNN::MultilayerPerceptron::operator= ( const MultilayerPerceptron other_multilayer_perceptron  ) 

Assignment operator. It assigns to this object the members of an existing multilayer perceptron object.

Parameters:
other_multilayer_perceptron Multilayer perceptron object to be assigned.

Definition at line 138 of file multilayer_perceptron.cpp.

bool OpenNN::MultilayerPerceptron::operator== ( const MultilayerPerceptron other_multilayer_perceptron  )  const

Equal to operator. It compares this object with another object of the same class. It returns true if the members of the two objects have the same values, and false otherwise. @ param other_multilayer_perceptron Multilayer perceptron to be compared with.

Definition at line 160 of file multilayer_perceptron.cpp.

Vector<unsigned int> OpenNN::MultilayerPerceptron::arrange_architecture ( void   )  const [inline]

This method returns a vector with the architecture of the multilayer perceptron The elements of this vector are as follows

  • Number of inputs.
  • Size of the first hidden layer.
  • ...
  • Number of outputs neurons.

Definition at line 95 of file multilayer_perceptron.h.

unsigned int OpenNN::MultilayerPerceptron::count_inputs_number ( void   )  const [inline]

This method returns the number of inputs to the multilayer perceptron.

Definition at line 122 of file multilayer_perceptron.h.

unsigned int OpenNN::MultilayerPerceptron::count_layers_number ( void   )  const [inline]

This method returns the number of layers in the multilayer perceptron.

Definition at line 138 of file multilayer_perceptron.h.

Vector<unsigned int> OpenNN::MultilayerPerceptron::get_layers_inputs_number ( void   )  const [inline]

This method returns a vector with the number of inputs of each layer.

Definition at line 145 of file multilayer_perceptron.h.

Vector<unsigned int> OpenNN::MultilayerPerceptron::arrange_layers_perceptrons_numbers ( void   )  const [inline]

This method returns a vector with the size of each layer.

Definition at line 162 of file multilayer_perceptron.h.

int OpenNN::MultilayerPerceptron::count_outputs_number ( void   )  const [inline]

This method returns the number of outputs neurons in the multilayer perceptron.

Definition at line 179 of file multilayer_perceptron.h.

const Vector< PerceptronLayer > & OpenNN::MultilayerPerceptron::get_layers ( void   )  const

This method returns the layers of the multilayer perceptron The format is a reference to the vector of vectors of perceptrons. Note that each layer might have a different size.

Definition at line 182 of file multilayer_perceptron.cpp.

const PerceptronLayer & OpenNN::MultilayerPerceptron::get_layer ( const unsigned int &  i  )  const

This method returns a reference to the vector of perceptrons in a single layer.

Parameters:
i Index of layer.

Definition at line 193 of file multilayer_perceptron.cpp.

PerceptronLayer * OpenNN::MultilayerPerceptron::get_layer_pointer ( const unsigned int &  i  ) 

This method returns a pointer to a given layer of perceptrons.

Parameters:
i Index of perceptron layer.

Definition at line 223 of file multilayer_perceptron.cpp.

unsigned int OpenNN::MultilayerPerceptron::count_perceptrons_number ( void   )  const

This method returns the total number of perceptrons in the multilayer perceptron. This is equal to the sum of the perceptrons of all layers.

Definition at line 253 of file multilayer_perceptron.cpp.

Vector< unsigned int > OpenNN::MultilayerPerceptron::count_cumulative_perceptrons_number ( void   )  const

This method returns a vector of size the number of layers, where each element is equal to the total number of neurons in the current and all the previous layers.

Definition at line 265 of file multilayer_perceptron.cpp.

Vector< unsigned int > OpenNN::MultilayerPerceptron::arrange_layers_parameters_number ( void   )  const

This method returns a vector of integers with size the number of layers, where each element contains the number of parameters in the corresponding layer.

Definition at line 292 of file multilayer_perceptron.cpp.

Vector< unsigned int > OpenNN::MultilayerPerceptron::arrange_layers_cumulative_parameters_number ( void   )  const

This method returns a vector of integers with size the number of layers, where each element contains the total number of parameters in the corresponding and the previous layers.

Definition at line 312 of file multilayer_perceptron.cpp.

Vector< Vector< double > > OpenNN::MultilayerPerceptron::arrange_layers_biases ( void   )  const

This method returns the bias values from the neurons in all the layers. The format is a vector of vectors of real values. The size of this vector is the number of layers. The size of each subvector is the number of neurons in the corresponding layer.

Definition at line 336 of file multilayer_perceptron.cpp.

Vector< Matrix< double > > OpenNN::MultilayerPerceptron::arrange_layers_synaptic_weights ( void   )  const

This method returns the synaptic weight values from the neurons in all the layers. The format is a vector of matrices of real values. The size of this vector is the number of layers. The number of rows of each sub_matrix is the number of neurons in the corresponding layer. The number of columns of each sub_matrix is the number of inputs to the corresponding layer.

Definition at line 359 of file multilayer_perceptron.cpp.

Vector< Vector< double > > OpenNN::MultilayerPerceptron::get_layers_parameters ( void   )  const

This method returns the neural parameter values (biases and synaptic weights) from the neurons in all the layers. The format is a vector of matrices of real values. The size of this vector is the number of layers. The number of rows of each sub_matrix is the number of neurons in the corresponding layer. The number of columns of each sub_matrix is the number of parameters (inputs + 1) to the corresponding layer.

Definition at line 383 of file multilayer_perceptron.cpp.

unsigned int OpenNN::MultilayerPerceptron::count_parameters_number ( void   )  const

This method returns the number of parameters (biases and synaptic weights) in the multilayer perceptron.

Definition at line 402 of file multilayer_perceptron.cpp.

Vector< double > OpenNN::MultilayerPerceptron::arrange_parameters ( void   )  const

This method returns the values of all the biases and synaptic weights in the multilayer perceptron as a single vector.

Definition at line 421 of file multilayer_perceptron.cpp.

unsigned int OpenNN::MultilayerPerceptron::get_layer_index ( const unsigned int &  neuron_index  )  const

This method returns the index of the layer at which a perceptron belongs to.

Parameters:
neuron_index Index of the neuron.

Definition at line 449 of file multilayer_perceptron.cpp.

unsigned int OpenNN::MultilayerPerceptron::get_perceptron_index ( const unsigned int &  layer_index,
const unsigned int &  perceptron_position 
) const

This method returns the index of a neuron, given the layer it belongs and its position in that layer.

Parameters:
layer_index Index of layer.
perceptron_position Position on the perceptron in that layer.

Definition at line 484 of file multilayer_perceptron.cpp.

unsigned int OpenNN::MultilayerPerceptron::get_layer_bias_index ( const unsigned int &  layer_index,
const unsigned int &  perceptron_index 
) const

This method returns the index in the vector of parameters of a bias.

Parameters:
layer_index Index of layer.
perceptron_index Index of perceptron within that layer.

Definition at line 505 of file multilayer_perceptron.cpp.

unsigned int OpenNN::MultilayerPerceptron::get_layer_synaptic_weight_index ( const unsigned int &  layer_index,
const unsigned int &  perceptron_index,
const unsigned int &  input_index 
) const

This method returns the index in the vector of parameters of a synaptic weight.

Parameters:
layer_index Index of layer.
perceptron_index Index of perceptron within that layer.
input_index Index of inputs within that perceptron.

Definition at line 567 of file multilayer_perceptron.cpp.

Vector< unsigned int > OpenNN::MultilayerPerceptron::arrange_parameter_indices ( const unsigned int &  parameter_index  )  const

This method returns the layer, neuron and parameter indices of a neural parameter.

Parameters:
parameter_index Index of parameter within the parameters vector.

Definition at line 653 of file multilayer_perceptron.cpp.

Matrix< unsigned int > OpenNN::MultilayerPerceptron::arrange_parameters_indices ( void   )  const

This method returns a matrix with the indices of the multilayer_perceptron_pointer parameters. That indices include the layer index, the neuron index and the parameter index. The number of rows is the number of multilayer_perceptron_pointer parameters. The number of columns is 3.

Definition at line 685 of file multilayer_perceptron.cpp.

Vector< Perceptron::ActivationFunction > OpenNN::MultilayerPerceptron::get_layers_activation_function ( void   )  const

This method returns the activation function of every layer in a single vector.

Definition at line 722 of file multilayer_perceptron.cpp.

Vector< std::string > OpenNN::MultilayerPerceptron::write_layers_activation_function ( void   )  const

This method returns a vector of strings with the name of the activation functions for the layers. The size of this vector is the number of layers.

Definition at line 742 of file multilayer_perceptron.cpp.

const bool & OpenNN::MultilayerPerceptron::get_display ( void   )  const

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 762 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set ( void   ) 

This method sets an empty multilayer_perceptron_pointer architecture.

Definition at line 803 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set ( const Vector< PerceptronLayer > &  new_layers  ) 

This method sets a multilayer_perceptron_pointer architecture with given layers of perceptrons.

Parameters:
new_layers Vector of vectors of perceptrons, which represent the multilayer_perceptron_pointer architecture.

Definition at line 814 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set ( const Vector< unsigned int > &  new_architecture  ) 

This method sets the architecture of the multilayer perceptron. The architecture is represented as a vector of unsigned integers. The number of layers is the size of that vector minus one. The first element in the vector represents the number of inputs. The rest of elements represent the corresponding number of perceptrons in each layer. All the parameters of the multilayer perceptron are initialized at random.

Parameters:
new_architecture Architecture of the multilayer perceptron.

Definition at line 830 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set ( const unsigned int &  new_inputs_number,
const unsigned int &  new_perceptrons_number 
)

This method sets a new architecture with just one layer.

Parameters:
new_inputs_number Number of inputs to the multilayer perceptron.
new_perceptrons_number Number of perceptrons in the unique layer. This is also the number of outputs.

Definition at line 891 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set ( const unsigned int &  new_inputs_number,
const unsigned int &  new_hidden_neurons_number,
const unsigned int &  new_outputs_number 
)

This method sets a new multilayer_perceptron_pointer architecture with two layers, a hidden layer and an outputs layer.

Parameters:
new_inputs_number Number of inputs to the multilayer perceptron.
new_hidden_neurons_number Number of neurons in the hidden layer.
new_outputs_number Number of outputs from the multilayer perceptron.

Definition at line 931 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set ( const MultilayerPerceptron other_multilayer_perceptron  ) 

This method sets the members of this object to be the members of another object of the same class.

Parameters:
other_multilayer_perceptron Object to be copied.

Definition at line 981 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set_default ( void   )  [virtual]

This method sets those members not related to the multilayer perceptron architecture to their default values:

  • First perceptron layers activation function: Hyperbolic tangent.
  • Last perceptron layer activation function: Linear.
  • Display: True.

Definition at line 777 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set_inputs_number ( const unsigned int  new_inputs_number  ) 

This method set a new number of inputs in the multilayer perceptron.

Parameters:
new_inputs_number Number of inputs.

Definition at line 994 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set_layers_perceptrons_number ( const Vector< unsigned int > &  new_layers_size  ) 

This method sets the size of the layers of the multilayer perceptron. It neither modifies the number of inputs nor the number of outputs.

Parameters:
new_layers_size New numbers of neurons for the layers of the multilayer perceptron The number of elements of this vector is the number of layers.

Definition at line 1018 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set_layer_perceptrons_number ( const unsigned int &  layer_index,
const unsigned int &  new_layer_perceptrons_number 
)

This method sets the size of the layer of the multilayer perceptron when this is unique. All the parameters of the multilayer perceptron are initialized at random.

Parameters:
layer_index Index of layer.
new_layer_perceptrons_number New numbers of neurons for that layer of the multilayer perceptron

Definition at line 1033 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set_layers ( const Vector< PerceptronLayer > &  new_layers  ) 

This method sets a new multilayer_perceptron_pointer architecture by means of a pack of layers of perceptrons.

Parameters:
new_layers Vector o vectors of perceptron neurons representing a multilayer_perceptron_pointer architecture arranged in layers.

Definition at line 1055 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set_layers_biases ( const Vector< Vector< double > > &  new_layers_biases  ) 

This method sets all the biases of the layers in the multilayer perceptron The format is a vector of vectors of real numbers. The size of this vector is the number of layers. The size of each subvector is the number of neurons in the corresponding layer.

Parameters:
new_layers_biases New set of biases in the layers.

Definition at line 1069 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set_layers_synaptic_weights ( const Vector< Matrix< double > > &  new_layers_synaptic_weights  ) 

This method sets all the synaptic weights of the layers in the multilayer perceptron The format is a vector of matrices of real numbers. The size of this vector is the number of layers. The number of rows of each sub_matrix is the number of neurons in the corresponding layer. The number of columns of each sub_matrix is the number of inputs to the corresponding layer.

Parameters:
new_layers_synaptic_weights New set of synaptic weights in the layers.

Definition at line 1110 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set_layers_parameters ( const Vector< Vector< double > > &  new_layers_parameters  ) 

This method sets the multilayer_perceptron_pointer parameters of all layers in the multilayer perceptron The argument is a vector of vectors of real numbers. The number of elements is the number of layers. Each element contains the vector of parameters of a single layer

Parameters:
new_layers_parameters New vector of layers parameters.

Definition at line 1149 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set_parameters ( const Vector< double > &  new_parameters  ) 

This method sets all the biases and synaptic weights in the multilayer perceptron from a single vector.

Parameters:
new_parameters New set of biases and synaptic weights values.

Definition at line 1184 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::initialize_biases ( const double &  value  ) 

This method initializes the biases of all the perceptrons in the multilayer perceptron with a given value.

Parameters:
value Biases initialization value.

Definition at line 1429 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::initialize_synaptic_weights ( const double &  value  ) 

This method initializes the synaptic weights of all the perceptrons in the multilayer perceptron with a given value.

Parameters:
value Synaptic weights initialization value.

Definition at line 1445 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::initialize_parameters ( const double &  value  ) 

This method initializes all the biases and synaptic weights in the neural newtork with a given value.

Parameters:
value Multilayer perceptron parameters initialization value.

Definition at line 1462 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::initialize_parameters_uniform ( void   ) 

This method initializes all the biases and synaptic weights in the neural newtork at random with values comprised between -1 and +1.

Definition at line 1477 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::initialize_parameters_uniform ( const double &  minimum,
const double &  maximum 
)

This method initializes all the biases and synaptic weights in the multilayer perceptron at random with values comprised between a minimum and a maximum values.

Parameters:
minimum Minimum initialization value.
maximum Maximum initialization value.

Definition at line 1496 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::initialize_parameters_uniform ( const Vector< double > &  minimum,
const Vector< double > &  maximum 
)

This method initializes all the biases and synaptic weights in the multilayer perceptron at random, with values comprised between different minimum and maximum numbers for each parameter.

Parameters:
minimum Vector of minimum initialization values.
maximum Vector of maximum initialization values.

Definition at line 1515 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::initialize_parameters_uniform ( const Vector< Vector< double > > &  minimum_maximum  ) 

This method initializes all the biases and synaptic weights in the multilayer perceptron at random, with values comprised between a different minimum and maximum numbers for each parameter. All minimum are maximum initialization values must be given from a vector of two real vectors. The first element must contain the minimum inizizalization value for each parameter. The second element must contain the maximum inizizalization value for each parameter.

Parameters:
minimum_maximum Vector of minimum and maximum initialization values.

Definition at line 1536 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::initialize_parameters_normal ( void   ) 

This method initializes all the biases and synaptic weights in the newtork with random values chosen from a normal distribution with mean 0 and standard deviation 1.

Definition at line 1553 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::initialize_parameters_normal ( const double &  mean,
const double &  standard_deviation 
)

This method initializes all the biases and synaptic weights in the multilayer perceptron with random random values chosen from a normal distribution with a given mean and a given standard deviation.

Parameters:
mean Mean of normal distribution.
standard_deviation Standard deviation of normal distribution.

Definition at line 1572 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::initialize_parameters_normal ( const Vector< double > &  mean,
const Vector< double > &  standard_deviation 
)

This method initializes all the biases an synaptic weights in the multilayer perceptron with random values chosen from normal distributions with different mean and standard deviation for each parameter.

Parameters:
mean Vector of mean values.
standard_deviation Vector of standard deviation values.

Definition at line 1591 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::initialize_parameters_normal ( const Vector< Vector< double > > &  mean_standard_deviation  ) 

This method initializes all the biases and synaptic weights in the multilayer perceptron with random values chosen from normal distributions with different mean and standard deviation for each parameter. All mean and standard deviation values are given from a vector of two real vectors. The first element must contain the mean value for each parameter. The second element must contain the standard deviation value for each parameter.

Parameters:
mean_standard_deviation Vector of mean and standard deviation values.

Definition at line 1612 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::initialize_parameters ( void   ) 

This method initializes the parameters at random with values chosen from a normal distribution with mean 0 and standard deviation 1.

Definition at line 1628 of file multilayer_perceptron.cpp.

double OpenNN::MultilayerPerceptron::calculate_parameters_norm ( void   )  const

This method returns the norm of the vector of multilayer_perceptron_pointer parameters.

Definition at line 1638 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set_layers_activation_function ( const Vector< Perceptron::ActivationFunction > &  new_layers_activation_function  ) 

This class sets a new activation (or transfer) function in all the layers of the multilayer perceptron

Parameters:
new_layers_activation_function Activation function for the layers. The size of this Vector must be equal to the number of layers, and each element corresponds to the activation function of one layer.

Definition at line 1234 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set_layers_activation_function ( const Vector< std::string > &  new_layers_activation_function  ) 

This method sets a new activation (or transfer) function in all the layers. The argument is a string containing the name of the function ("Logistic", "HyperbolicTangent", "Threshold", etc).

Parameters:
new_layers_activation_function Activation function for the layers.

Definition at line 1270 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::set_display ( const 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.

Parameters:
new_display Display value.

Definition at line 1288 of file multilayer_perceptron.cpp.

bool OpenNN::MultilayerPerceptron::is_empty ( void   )  const

This method returns true if the number of layers in the multilayer perceptron is zero, and false otherwise.

Definition at line 1298 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::grow_input ( const unsigned int &   ) 

Todo:

Definition at line 1315 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::grow_layer ( const unsigned int &  ,
const unsigned int &   
)

Todo:

Definition at line 1324 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::prune_input ( const unsigned int &   ) 

Todo:

Definition at line 1333 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::prune_layer ( const unsigned int &  ,
const unsigned int &   
)

Todo:

Definition at line 1342 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::initialize_random ( void   ) 

This method sets a random architecture in the multilayer perceptron. It also sets random activation functions for each layer. This method is useful for testing purposes.

Definition at line 1353 of file multilayer_perceptron.cpp.

Vector< double > OpenNN::MultilayerPerceptron::calculate_layer_combination_combination ( const unsigned int &  layer_index,
const Vector< double > &  previous_layer_combination 
) const

This method returns the combination vector of a given layer as a function of the combination vector of the previous layer.

Parameters:
layer_index Index of layer.
previous_layer_combination Combination vector of previous layer.

Definition at line 1835 of file multilayer_perceptron.cpp.

Matrix< double > OpenNN::MultilayerPerceptron::calculate_layer_combination_combination_Jacobian ( const unsigned int &  layer_index,
const Vector< double > &  previous_layer_activation_derivative 
) const

This method returns the partial derivatives of the combinations of one layer with respect to the combinations in the previous layer. Note that, for efficiency issues, the argument here is the activation derivative of the previous layer, and not the combination of the previous layer. This quantity is the Jacobian matrix of the layer combination-combination function.

Parameters:
layer_index Index of layer.
previous_layer_activation_derivative Vector of activation derivatives of the previous layer.

Definition at line 1898 of file multilayer_perceptron.cpp.

Vector< double > OpenNN::MultilayerPerceptron::calculate_output_layer_combination ( const unsigned int &  layer_index,
const Vector< double > &  layer_combinations 
) const

This method calculates the output values from the neural network from the combination values of a given layer.

Parameters:
layer_index Index of a layer.
layer_combinations Combination values of the layer with the previous index.

Definition at line 2051 of file multilayer_perceptron.cpp.

Vector< Matrix< double > > OpenNN::MultilayerPerceptron::calculate_output_layers_delta ( const Vector< Vector< double > > &  layers_activation_derivative  )  const

This method calculates the output delta matrix for each layer in the multilayer perceptron. The format is a vector of matrices.

Parameters:
layers_activation_derivative Activation derivative values for each layer.

Definition at line 2096 of file multilayer_perceptron.cpp.

Matrix< Vector< Matrix< double > > > OpenNN::MultilayerPerceptron::calculate_output_interlayers_Delta ( const Vector< Vector< Vector< double > > > &  second_order_forward_propagation,
const Matrix< Matrix< double > > &  interlayers_combination_combination_Jacobian,
const Vector< Matrix< double > > &  output_layers_delta 
) const

Todo:
Parameters:
second_order_forward_propagation 
interlayers_combination_combination_Jacobian 
output_layers_delta 

Definition at line 2152 of file multilayer_perceptron.cpp.

Vector< double > OpenNN::MultilayerPerceptron::calculate_interlayer_combination_combination ( const unsigned int &  domain_layer_index,
const unsigned int &  image_layer_index,
const Vector< double > &  domain_layer_combination 
) const

This method returns the combination vector of a layer (image) with respect to the combination vector of another layer (domain).

Parameters:
domain_layer_index Index of domain layer.
image_layer_index Index of image layer.
domain_layer_combination Combination vector of domain layer.

Definition at line 1960 of file multilayer_perceptron.cpp.

Matrix< double > OpenNN::MultilayerPerceptron::calculate_interlayer_combination_combination_Jacobian ( const unsigned int &  domain_layer_index,
const unsigned int &  image_layer_index,
const Vector< double > &  domain_layer_combination 
) const

This method returns the partial derivatives of the combinations of a layer (image) with respect to the combinations of another layer (domain). This quantity is the Jacobian matrix of the interlayers combination combination function.

Parameters:
image_layer_index Index of image layer.
domain_layer_index Index of domain layer.
domain_layer_combination Vector of combination values of the domain layer.

Definition at line 1999 of file multilayer_perceptron.cpp.

Vector< Vector< double > > OpenNN::MultilayerPerceptron::calculate_layers_input ( const Vector< double > &  inputs  )  const

This method returns a vector of vectors, where each element contains the input values of a layer in response to an inputs to the multilayer perceptron

Parameters:
inputs Input values to the multilayer perceptron

Definition at line 2527 of file multilayer_perceptron.cpp.

Vector< Vector< double > > OpenNN::MultilayerPerceptron::arrange_layers_input ( const Vector< double > &  inputs,
const Vector< Vector< double > > &  layers_activation 
) const

This method returns the layers inputs from the multilayer perceptron inputs and the layers outputs. The format is a vector of subvectors. The size of the vector is the number of layers. The size of each subvector is the number of inputs to the corresponding layer.

Parameters:
inputs Input values to the multilayer perceptron.
layers_activation Output values from each layer.

Definition at line 2467 of file multilayer_perceptron.cpp.

Vector< Vector< double > > OpenNN::MultilayerPerceptron::calculate_layers_combination ( const Vector< double > &  inputs  )  const

This method returns a vector of vectors, where each element contains the combination values of a layer in response to an inputs to the multilayer perceptron

Parameters:
inputs Input values to the multilayer perceptron

Definition at line 2550 of file multilayer_perceptron.cpp.

Vector< Matrix< double > > OpenNN::MultilayerPerceptron::calculate_layers_combination_Jacobian ( const Vector< double > &  inputs  )  const

This method returns the Jacobians of all the layer combination functions. The format of this quantity is a vector of matrices.

Definition at line 2602 of file multilayer_perceptron.cpp.

Vector< Matrix< double > > OpenNN::MultilayerPerceptron::calculate_layers_combination_parameters_Jacobian ( const Vector< Vector< double > > &  layers_inputs  )  const

This method returns the Jacobian matix of the combination function for each layer. The format is a vector of matrices. The size of the vector is the number of layers.

Parameters:
layers_inputs Input values for each layer.

Definition at line 2657 of file multilayer_perceptron.cpp.

Vector< Vector< Vector< double > > > OpenNN::MultilayerPerceptron::calculate_perceptrons_combination_parameters_gradient ( const Vector< Vector< double > > &  layers_inputs  )  const

This method returns the combination parameters gradient of all neurons in the network architecture. The format is a vector of subvectors of subsubvectors. The size of the vector is the number of layers. The size of each subvector is the number of perceptrons in the layer. The size of each subsubvector is the number of inputs to the perceptron. That quantities will be useful for calculating some multilayer perceptron derivatives.

Parameters:
layers_inputs Vector of subvectors with the inputs to each layer.

Definition at line 2684 of file multilayer_perceptron.cpp.

Vector< Vector< double > > OpenNN::MultilayerPerceptron::calculate_layers_activation ( const Vector< double > &  inputs  )  const

This method returns a vector of vectors, where each element contains the activation values of a layer in response to an inputs to the multilayer perceptron

Parameters:
inputs Input values to the multilayer perceptron

Definition at line 2753 of file multilayer_perceptron.cpp.

Vector< Vector< double > > OpenNN::MultilayerPerceptron::calculate_layers_activation_derivative ( const Vector< double > &  inputs  )  const

This method returns a vector of vectors, where each element contains the activation derivatives of a layer in response to an inputs to the multilayer perceptron

Parameters:
inputs Input values to the multilayer perceptron

Definition at line 2800 of file multilayer_perceptron.cpp.

Vector< Vector< double > > OpenNN::MultilayerPerceptron::calculate_layers_activation_second_derivative ( const Vector< double > &  inputs  )  const

This method returns a vector of vectors with the forward propagation values, their derivatives and their second derivatives. The size of the vector is equal to the number of layers. The elements are the following:

  • Activation second derivative from layers.
  • Activation second derivative from outputs layer.
Parameters:
inputs Set of inputs to the multilayer perceptron

Definition at line 2857 of file multilayer_perceptron.cpp.

Vector< Matrix< double > > OpenNN::MultilayerPerceptron::calculate_layers_Jacobian ( const Vector< double > &  inputs  )  const

This method returns the partial derivatives of the outputs from each layer with respect to the inputs to the corresponding layer, for a vector of inputs to the neural netwok. The format of this quantity is a vector of matrices.

Parameters:
inputs Vector of inputs to the multilayer perceptron

Definition at line 2910 of file multilayer_perceptron.cpp.

Vector< Vector< Matrix< double > > > OpenNN::MultilayerPerceptron::calculate_layers_Hessian_form ( const Vector< double > &  inputs  )  const

This method returns the second partial derivatives of the outputs from each layer with respect to the inputs to the corresponding layer, for a vector of inputs to the neural netwok. The format of this quantity is a vector of vectors of matrices.

Parameters:
inputs Vector of inputs to the multilayer perceptron

Definition at line 2938 of file multilayer_perceptron.cpp.

Matrix< Matrix< double > > OpenNN::MultilayerPerceptron::calculate_interlayers_combination_combination_Jacobian ( const Vector< double > &  inputs  )  const

This method returns the partial derivatives of the combination of one neuron with respect to the combination of another neuron for all layers in the multilayer perceptron This quantity is a Jacobian form, and it is represented as a matrix of matrices.

Parameters:
inputs Vector of inputs to the multilayer perceptron

Definition at line 2965 of file multilayer_perceptron.cpp.

Matrix< Matrix< double > > OpenNN::MultilayerPerceptron::calculate_interlayers_combination_combination_Jacobian ( const Vector< Vector< double > > &  layers_combination  )  const

This method returns the partial derivatives of the combination of one neuron with respect to the combination of another neuron for all layers in the multilayer perceptron This quantity is a Jacobian form, and it is represented as a matrix of matrices.

Parameters:
layers_combination Vector vectors representing the combinations of all layers.

Definition at line 2998 of file multilayer_perceptron.cpp.

Vector< Vector< Vector< double > > > OpenNN::MultilayerPerceptron::calculate_first_order_forward_propagation ( const Vector< double > &  inputs  )  const

This method returns the first order forward propagation quantities from the multilayer perceptron for a given inputs. That quantites include the activation and the activation derivative of all layers. The format is a vector of vectors of vectors. The first index refers to the quantity (0 for the activation and 1 for the activation derivative). The second index is the index of the layer. The third index is the index of the neuron.

Parameters:
inputs Vector of inputs to the multilayer perceptron

Definition at line 3052 of file multilayer_perceptron.cpp.

Vector< Vector< Vector< double > > > OpenNN::MultilayerPerceptron::calculate_second_order_forward_propagation ( const Vector< double > &  inputs  )  const

This method returns the second order forward propagation quantities from the multilayer perceptron for a given inputs. That quantites include the activation, the activation derivative and the activation second derivative of all layers. The format is a vector of vectors of vectors. The first index refers to the activation derivative order (0 for the activation, 1 for the activation derivative and 2 for the activation second derivative). The second index is the index of the layer. The third index is the index of the neuron.

Parameters:
inputs Vector of inputs to the multilayer perceptron

Definition at line 3113 of file multilayer_perceptron.cpp.

Vector< double > OpenNN::MultilayerPerceptron::calculate_outputs ( const Vector< double > &  inputs  )  const

This method returns the outputs from the multilayer_perceptron_pointer architecture for an inputs to the multilayer_perceptron_pointer architecture. That is, it computes the inputs-outputs relationship of the raw multilayer perceptron

Parameters:
inputs Vector of inputs to the first layer of the multilayer_perceptron_pointer architecture.

Definition at line 1654 of file multilayer_perceptron.cpp.

Matrix< double > OpenNN::MultilayerPerceptron::calculate_Jacobian ( const Vector< double > &  inputs  )  const

This method returns the partial derivatives of the outputs from the last layer with respect to the inputs to the first layer in the multilayer perceptron That is, it computes the inputs-outputs partial derivatives of the raw multilayer perceptron

Parameters:
inputs Vector of inputs to the first layer of the multilayer_perceptron_pointer architecture.

Definition at line 1705 of file multilayer_perceptron.cpp.

Vector< Matrix< double > > OpenNN::MultilayerPerceptron::calculate_Hessian_form ( const Vector< double > &  inputs  )  const

This method returns the second partial derivatives of the outputs from the last layer with respect to the inputs to the first layer. That is, the Hessian matrix of the multilayer_perceptron_pointer architectue inputs-outputs function.

Todo:

Definition at line 1756 of file multilayer_perceptron.cpp.

Matrix< double > OpenNN::MultilayerPerceptron::calculate_parameters_Jacobian ( const Vector< double > &  inputs,
const Vector< double > &   
) const

This method calculates the parameters matrix of the multilayer perceptron for an inputs vector. The elements of that matrix are the partial derivatives of the outputs with respect to the multilayer_perceptron_pointer parameters.

Definition at line 2298 of file multilayer_perceptron.cpp.

Vector< Matrix< double > > OpenNN::MultilayerPerceptron::calculate_parameters_Hessian_form ( const Vector< double > &  inputs,
const Vector< double > &   
) const

This method returns the second partial derivatives of the outputs from the multilayer_perceptron_pointer with respect to the multilayer_perceptron_pointer parameters.

Todo:

Definition at line 2351 of file multilayer_perceptron.cpp.

TiXmlElement * OpenNN::MultilayerPerceptron::to_XML ( void   )  const

This method serializes the multilayer perceptron object into a XML element of the TinyXML library. See the OpenNN manual for more information about the format of this element.

Definition at line 3192 of file multilayer_perceptron.cpp.

void OpenNN::MultilayerPerceptron::from_XML ( TiXmlElement *  multilayer_perceptron_element  ) 

This method deserializes a TinyXML element into this multilayer perceptron object.

Parameters:
multilayer_perceptron_element Pointer to a XML element containing the member data.

Definition at line 3253 of file multilayer_perceptron.cpp.

std::string OpenNN::MultilayerPerceptron::write_expression ( const Vector< std::string > &  inputs_name,
const Vector< std::string > &  outputs_name 
) const

This method returns a string with the expression of the forward propagation process in a multilayer perceptron.

Todo:

Definition at line 3359 of file multilayer_perceptron.cpp.

std::string OpenNN::MultilayerPerceptron::to_string ( void   )  const

This method returns a string representation of the current multilayer perceptron object.

Definition at line 3173 of file multilayer_perceptron.cpp.


Member Data Documentation

MultilayerPerceptron's layers. It is built as a vector of vectors of perceptrons. The size of this vector is equal to the number of layers. The size of each subvector is equal to the number of neurons in the corresponding layer.

Definition at line 390 of file multilayer_perceptron.h.

Display messages to screen.

Definition at line 394 of file multilayer_perceptron.h.


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

Generated on Sun Aug 26 11:58:18 2012 for OpenNN by  doxygen 1.5.9