OpenNN::ProbabilisticLayer Class Reference

#include <probabilistic_layer.h>

List of all members.

Public Types

enum  ProbabilisticMethod { Competitive, Softmax }

Public Member Functions

 ProbabilisticLayer (void)
 ProbabilisticLayer (const unsigned int &)
 ProbabilisticLayer (const ProbabilisticLayer &)
virtual ~ProbabilisticLayer (void)
ProbabilisticLayeroperator= (const ProbabilisticLayer &)
bool operator== (const ProbabilisticLayer &) const
const unsigned int & get_probabilistic_neurons_number (void) const
const ProbabilisticMethodget_probabilistic_method (void) const
std::string write_probabilistic_method (void) const
const bool & get_display (void) const
void set (void)
void set (const unsigned int &)
void set (const ProbabilisticLayer &)
void set_probabilistic_neurons_number (const unsigned int &)
void set_probabilistic_method (const ProbabilisticMethod &)
void set_probabilistic_method (const std::string &)
virtual void set_default (void)
void set_display (const bool &)
void initialize_random (void)
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
Vector< double > calculate_competitive_output (const Vector< double > &) const
Matrix< double > calculate_competitive_Jacobian (const Vector< double > &) const
Vector< Matrix< double > > calculate_competitive_Hessian_form (const Vector< double > &) const
Vector< double > calculate_softmax_output (const Vector< double > &) const
Matrix< double > calculate_softmax_Jacobian (const Vector< double > &) const
Vector< Matrix< double > > calculate_softmax_Hessian_form (const Vector< double > &) const
std::string write_competitive_expression (const Vector< std::string > &, const Vector< std::string > &) const
std::string write_softmax_expression (const Vector< std::string > &, const Vector< std::string > &) const
std::string write_expression (const Vector< std::string > &, const Vector< std::string > &) const
std::string to_string (void) const
virtual TiXmlElement * to_XML (void) const
virtual void from_XML (TiXmlElement *)

Protected Attributes

unsigned int probabilistic_neurons_number
ProbabilisticMethod probabilistic_method
bool display


Detailed Description

This class represents a layer of probabilistic neurons. The neural network defined in OpenNN includes a probabilistic layer for those problems when the outptus are to be interpreted as probabilities.

Definition at line 39 of file probabilistic_layer.h.


Member Enumeration Documentation

Enumeration of available methods for interpreting variables as probabilities.

Definition at line 72 of file probabilistic_layer.h.


Constructor & Destructor Documentation

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

Default constructor. It creates a probabilistic layer object with zero probabilistic neurons.

Definition at line 41 of file probabilistic_layer.cpp.

OpenNN::ProbabilisticLayer::ProbabilisticLayer ( const unsigned int &  new_probabilistic_neurons_number  )  [explicit]

Probabilistic neurons number constructor. It creates a probabilistic layer with a given size.

Parameters:
new_probabilistic_neurons_number Number of neurons in the layer.

Definition at line 53 of file probabilistic_layer.cpp.

OpenNN::ProbabilisticLayer::ProbabilisticLayer ( const ProbabilisticLayer other_probabilistic_layer  ) 

Copy constructor. It creates a copy of an existing probabilistic layer object.

Parameters:
other_probabilistic_layer Probabilistic layer to be copied.

Definition at line 65 of file probabilistic_layer.cpp.

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

Destructor. This destructor does not delete any pointer.

Definition at line 76 of file probabilistic_layer.cpp.


Member Function Documentation

ProbabilisticLayer & OpenNN::ProbabilisticLayer::operator= ( const ProbabilisticLayer other_probabilistic_layer  ) 

Assignment operator. It assigns to this object the members of an existing probabilistic layer object.

Parameters:
other_probabilistic_layer Probabilistic layer object to be assigned.

Definition at line 87 of file probabilistic_layer.cpp.

bool OpenNN::ProbabilisticLayer::operator== ( const ProbabilisticLayer other_probabilistic_layer  )  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_probabilistic_layer Probabilistic layer to be compared with.

Definition at line 111 of file probabilistic_layer.cpp.

const unsigned int & OpenNN::ProbabilisticLayer::get_probabilistic_neurons_number ( void   )  const

This method returns the number of probabilistic neurons in the layer.

Definition at line 132 of file probabilistic_layer.cpp.

const ProbabilisticLayer::ProbabilisticMethod & OpenNN::ProbabilisticLayer::get_probabilistic_method ( void   )  const

This method returns the method to be used for interpreting the outputs as probabilistic values. The two methods available for that are Competitive and Softmax.

Definition at line 143 of file probabilistic_layer.cpp.

std::string OpenNN::ProbabilisticLayer::write_probabilistic_method ( void   )  const

This method returns a string with the probabilistic method for the outputs ("Competitive" or "Softmax").

Definition at line 153 of file probabilistic_layer.cpp.

const bool & OpenNN::ProbabilisticLayer::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 181 of file probabilistic_layer.cpp.

void OpenNN::ProbabilisticLayer::set ( void   ) 

This method sets a probabilistic layer with zero probabilistic neurons. It also sets the rest of members to their default values.

Definition at line 192 of file probabilistic_layer.cpp.

void OpenNN::ProbabilisticLayer::set ( const unsigned int &  new_probabilistic_neurons_number  ) 

This method resizes the size of the probabilistic layer. It also sets the rest of class members to their default values.

Parameters:
new_probabilistic_neurons_number New size for the probabilistic layer.

Definition at line 206 of file probabilistic_layer.cpp.

void OpenNN::ProbabilisticLayer::set ( const ProbabilisticLayer other_probabilistic_layer  ) 

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

Parameters:
other_probabilistic_layer Probabilistic layer object to be copied.

Definition at line 219 of file probabilistic_layer.cpp.

void OpenNN::ProbabilisticLayer::set_probabilistic_neurons_number ( const unsigned int &  new_probabilistic_neurons_number  ) 

This method resizes the size of the probabilistic layer.

Parameters:
new_probabilistic_neurons_number New size for the probabilistic layer.

Definition at line 234 of file probabilistic_layer.cpp.

void OpenNN::ProbabilisticLayer::set_probabilistic_method ( const ProbabilisticMethod new_probabilistic_method  ) 

This method sets the chosen method for probabilistic postprocessing. Current probabilistic methods include Competitive and Softmax.

Parameters:
new_probabilistic_method Method for interpreting the outputs as probabilistic values.

Definition at line 262 of file probabilistic_layer.cpp.

void OpenNN::ProbabilisticLayer::set_probabilistic_method ( const std::string &  new_probabilistic_method  ) 

This method sets a new method for probabilistic processing from a string with the name. Current probabilistic methods include Competitive and Softmax.

Parameters:
new_probabilistic_method Method for interpreting the outputs as probabilistic values.

Definition at line 274 of file probabilistic_layer.cpp.

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

This method sets the members to their default values:

  • Probabilistic method: Softmax.
  • Display: True.

Definition at line 248 of file probabilistic_layer.cpp.

void OpenNN::ProbabilisticLayer::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 304 of file probabilistic_layer.cpp.

void OpenNN::ProbabilisticLayer::initialize_random ( void   ) 

Todo:

Definition at line 314 of file probabilistic_layer.cpp.

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

This method processes the input to the probabilistic layer in order to obtain a set of outputs which can be interpreted as probabilities. This posprocessing is performed according to the probabilistic method to be used.

Parameters:
inputs Set of inputs to the probabilistic layer.

Definition at line 326 of file probabilistic_layer.cpp.

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

This method returns the partial derivatives of the outputs from the probabilistic layer with respect to its inputs, depending on the probabilistic method to be used. This quantity is the Jacobian matrix of the probabilistic function.

Parameters:
inputs Inputs to the probabilistic layer.

Definition at line 384 of file probabilistic_layer.cpp.

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

This method calculates the Hessian form of the probabilistic layer. This is a vector of matrices. The elements contain second partial derivatives of the outputs from the layer with resptect to the inputs to it.

Definition at line 441 of file probabilistic_layer.cpp.

Vector< double > OpenNN::ProbabilisticLayer::calculate_competitive_output ( const Vector< double > &  inputs  )  const

This method returns the outputs from the layer for given inputs when the probabilistic method is the competitive.

Parameters:
inputs Vector of input values to the probabilistic layer.

Definition at line 497 of file probabilistic_layer.cpp.

Matrix< double > OpenNN::ProbabilisticLayer::calculate_competitive_Jacobian ( const Vector< double > &   )  const

This method throws an exception, since the competitive function is not derivable.

Definition at line 507 of file probabilistic_layer.cpp.

Vector< Matrix< double > > OpenNN::ProbabilisticLayer::calculate_competitive_Hessian_form ( const Vector< double > &   )  const

This method throws an exception, since the competitive function is not derivable.

Definition at line 523 of file probabilistic_layer.cpp.

Vector< double > OpenNN::ProbabilisticLayer::calculate_softmax_output ( const Vector< double > &  inputs  )  const

This method returns the outputs of the softmax function for given inputs.

Parameters:
inputs Input values to the probabilistic layer.

Definition at line 540 of file probabilistic_layer.cpp.

Matrix< double > OpenNN::ProbabilisticLayer::calculate_softmax_Jacobian ( const Vector< double > &  inputs  )  const

This method returns the partial derivatives of the softmax outputs with respect to the inputs.

Parameters:
inputs Input values to the probabilistic layer.

Definition at line 551 of file probabilistic_layer.cpp.

Vector< Matrix< double > > OpenNN::ProbabilisticLayer::calculate_softmax_Hessian_form ( const Vector< double > &   )  const

This method returns the second partial derivatives of the softmax outputs with respect to the inputs, in the so called Hessian form.

Todo:

Definition at line 582 of file probabilistic_layer.cpp.

std::string OpenNN::ProbabilisticLayer::write_competitive_expression ( const Vector< std::string > &  inputs_names,
const Vector< std::string > &  outputs_names 
) const

This method returns a string with the expression of the competitive probabilistic outputs function.

Parameters:
inputs_names Names of inputs to the probabilistic layer.
outputs_names Names of outputs to the probabilistic layer.

Definition at line 740 of file probabilistic_layer.cpp.

std::string OpenNN::ProbabilisticLayer::write_softmax_expression ( const Vector< std::string > &  inputs_names,
const Vector< std::string > &  outputs_names 
) const

This method returns a string with the expression of the softmax probabilistic outputs function.

Parameters:
inputs_names Names of inputs to the probabilistic layer.
outputs_names Names of outputs to the probabilistic layer.

Definition at line 759 of file probabilistic_layer.cpp.

std::string OpenNN::ProbabilisticLayer::write_expression ( const Vector< std::string > &  inputs_names,
const Vector< std::string > &  outputs_names 
) const

This method returns a string with the expression of the probabilistic outputs function, depending on the probabilistic method to be used.

Parameters:
inputs_names Names of inputs to the probabilistic layer.
outputs_names Names of outputs to the probabilistic layer.

Definition at line 779 of file probabilistic_layer.cpp.

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

This method returns a string representation of the current probabilistic layer object.

Definition at line 594 of file probabilistic_layer.cpp.

TiXmlElement * OpenNN::ProbabilisticLayer::to_XML ( void   )  const [virtual]

This method serializes the probabilistic layer 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 612 of file probabilistic_layer.cpp.

void OpenNN::ProbabilisticLayer::from_XML ( TiXmlElement *  probabilistic_layer_element  )  [virtual]

This method deserializes a TinyXML element into this probabilistic layer object.

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

Definition at line 662 of file probabilistic_layer.cpp.


Member Data Documentation

Number of probabilistic neurons in the layer.

Definition at line 141 of file probabilistic_layer.h.

Probabilistic processing method.

Definition at line 145 of file probabilistic_layer.h.

Display messages to screen.

Definition at line 149 of file probabilistic_layer.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