OpenNN::ScalingLayer Class Reference

#include <scaling_layer.h>

List of all members.

Public Types

enum  ScalingMethod { MinimumMaximum, MeanStandardDeviation }

Public Member Functions

 ScalingLayer (void)
 ScalingLayer (const unsigned int &)
 ScalingLayer (const Vector< Vector< double > > &)
 ScalingLayer (const ScalingLayer &)
virtual ~ScalingLayer (void)
ScalingLayeroperator= (const ScalingLayer &)
bool operator== (const ScalingLayer &) const
unsigned int count_scaling_neurons_number (void) const
const Vector< double > & get_minimums (void) const
double get_minimum (const unsigned int &) const
const Vector< double > & get_maximums (void) const
double get_maximum (const unsigned int &) const
const Vector< double > & get_means (void) const
double get_mean (const unsigned int &) const
const Vector< double > & get_standard_deviations (void) const
double get_standard_deviation (const unsigned int &) const
Vector< Vector< double > * > get_minimums_maximums (void)
Vector< Vector< double > * > get_means_standard_deviations (void)
Vector< Vector< double > * > get_statistics (void)
const ScalingMethodget_scaling_method (void) const
std::string write_scaling_method (void) const
const bool & get_display (void) const
void set (void)
void set (const unsigned int &)
void set (const Vector< Vector< double > > &)
void set (TiXmlElement *)
void set (const ScalingLayer &)
virtual void set_default (void)
void set_minimums (const Vector< double > &)
void set_minimum (const unsigned int &, const double &)
void set_maximums (const Vector< double > &)
void set_maximum (const unsigned int &, const double &)
void set_means (const Vector< double > &)
void set_mean (const unsigned int &, const double &)
void set_standard_deviations (const Vector< double > &)
void set_standard_deviation (const unsigned int &, const double &)
void set_minimums_maximums (const Vector< Vector< double > > &)
void set_means_standard_deviations (const Vector< Vector< double > > &)
void set_statistics (const Vector< Vector< double > > &)
void set_scaling_method (const ScalingMethod &)
void set_scaling_method (const std::string &)
void set_display (const bool &)
bool is_empty (void) const
void initialize_random (void)
void check_range (const Vector< double > &) const
Vector< double > calculate_outputs (const Vector< double > &) const
Vector< double > calculate_derivative (const Vector< double > &) const
Vector< double > calculate_second_derivative (const Vector< double > &) const
Vector< double > calculate_minimum_maximum_output (const Vector< double > &) const
Vector< double > calculate_minimum_maximum_derivative (const Vector< double > &) const
Vector< double > calculate_minimum_maximum_second_derivative (const Vector< double > &) const
Vector< double > calculate_mean_standard_deviation_output (const Vector< double > &) const
Vector< double > calculate_mean_standard_deviation_derivative (const Vector< double > &) const
Vector< double > calculate_mean_standard_deviation_second_derivative (const Vector< double > &) const
Matrix< double > arrange_Jacobian (const Vector< double > &) const
Vector< Matrix< double > > arrange_Hessian_form (const Vector< double > &) const
std::string write_minimum_maximum_expression (const Vector< std::string > &, const Vector< std::string > &) const
std::string write_mean_standard_deviation_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
TiXmlElement * to_XML (void) const
virtual void from_XML (TiXmlElement *)

Protected Attributes

Vector< double > minimums
Vector< double > maximums
Vector< double > means
Vector< double > standard_deviations
ScalingMethod scaling_method
bool display


Detailed Description

This class represents a layer of scaling neurons. Scaling layers are included in the definition of a neural network. They are used to normalize variables so they are in an appropriate range for computer processing.

Definition at line 39 of file scaling_layer.h.


Member Enumeration Documentation

Enumeration of available methods for scaling the input variables.

Definition at line 76 of file scaling_layer.h.


Constructor & Destructor Documentation

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

Default constructor. It creates a scaling layer object with no scaling neurons.

Definition at line 37 of file scaling_layer.cpp.

OpenNN::ScalingLayer::ScalingLayer ( const unsigned int &  new_scaling_neurons_number  )  [explicit]

Scaling neurons number constructor. This constructor creates a scaling layer with a given size. The members of this object are initialized with the default values.

Parameters:
new_scaling_neurons_number Number of scaling neurons in the layer.

Definition at line 50 of file scaling_layer.cpp.

OpenNN::ScalingLayer::ScalingLayer ( const Vector< Vector< double > > &  new_statistics  )  [explicit]

Statistics constructor. This constructor creates a scaling layer with given minimums, maximums, means and standard deviations. The rest of members of this object are initialized with the default values.

Parameters:
new_statistics Vector of vectors with the variables statistics.

Definition at line 63 of file scaling_layer.cpp.

OpenNN::ScalingLayer::ScalingLayer ( const ScalingLayer new_scaling_layer  ) 

Copy constructor.

Definition at line 73 of file scaling_layer.cpp.

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

Destructor.

Definition at line 83 of file scaling_layer.cpp.


Member Function Documentation

ScalingLayer & OpenNN::ScalingLayer::operator= ( const ScalingLayer other_scaling_layer  ) 

Assignment operator.

Parameters:
other_scaling_layer Object to be copied.

Definition at line 95 of file scaling_layer.cpp.

bool OpenNN::ScalingLayer::operator== ( const ScalingLayer other_scaling_layer  )  const

Equal to operator. If compares this object with another object of the same class, and returns true if they are equal, and false otherwise.

Parameters:
other_scaling_layer Object to be compared with.

Definition at line 123 of file scaling_layer.cpp.

unsigned int OpenNN::ScalingLayer::count_scaling_neurons_number ( void   )  const

This method returns the number of unscaling neurons in this layer.

Definition at line 145 of file scaling_layer.cpp.

const Vector< double > & OpenNN::ScalingLayer::get_minimums ( void   )  const

This method returns the minimum values of all the scaling neurons. Such values are to be used for scaling variables with the minimums and maximums method.

Definition at line 207 of file scaling_layer.cpp.

double OpenNN::ScalingLayer::get_minimum ( const unsigned int &  i  )  const

This method returns the minimum value of a single neuron in the scaling layer. Such value is to be used for scaling that variable with the minimums and maximums method.

Definition at line 218 of file scaling_layer.cpp.

const Vector< double > & OpenNN::ScalingLayer::get_maximums ( void   )  const

This method returns the maximum values of the scaling layer. Such values are to be used for scaling variables with the minimums and maximums method.

Definition at line 156 of file scaling_layer.cpp.

double OpenNN::ScalingLayer::get_maximum ( const unsigned int &  i  )  const

This method returns the maximum value of a single variable. Such value is to be used for scaling that variable with the minimums and maximums method.

Definition at line 167 of file scaling_layer.cpp.

const Vector< double > & OpenNN::ScalingLayer::get_means ( void   )  const

This method returns the mean values of all the scaling neurons of the multilayer perceptron Such values are to be used for scaling inputs with the means and standard deviation method.

Definition at line 258 of file scaling_layer.cpp.

double OpenNN::ScalingLayer::get_mean ( const unsigned int &  index  )  const

This method returns the mean value of a single input variable of the multilayer perceptron Such a value is to be used for scaling that inputs with the means and standard deviation method.

Parameters:
index Index of input variable.

Definition at line 270 of file scaling_layer.cpp.

const Vector< double > & OpenNN::ScalingLayer::get_standard_deviations ( void   )  const

This method returns the standard deviation values of all the scaling neurons of the multilayer perceptron Such values are to be used for scaling inputs with the means and standard deviation method.

Definition at line 300 of file scaling_layer.cpp.

double OpenNN::ScalingLayer::get_standard_deviation ( const unsigned int &  index  )  const

This method returns the standard deviation value of a single input variable of the multilayer perceptron Such a value is to be used for scaling that inputs with the means and standard deviation method.

Parameters:
index Index of input variable.

Definition at line 312 of file scaling_layer.cpp.

Vector< Vector< double > * > OpenNN::ScalingLayer::get_minimums_maximums ( void   ) 

This method returns the minimums and the maximum values of all the scaling neurons. The format is a vector of pointers to vectors of size two. The first element contains the minimum values of the scaling neurons. The second element contains the maximum values of the scaling neurons. Such values are to be used for scaling inputs with the minimums and maximums method.

Definition at line 345 of file scaling_layer.cpp.

Vector< Vector< double > * > OpenNN::ScalingLayer::get_means_standard_deviations ( void   ) 

This method returns the means and the standard deviation values of all the scaling neurons. The format is a vector of pointers to vectors of size two. The first element contains the mean values of the scaling neurons. The second element contains the standard deviation values of the scaling neurons. Such values are to be used for scaling inputs with the means and standard deviation method.

Definition at line 364 of file scaling_layer.cpp.

Vector< Vector< double > * > OpenNN::ScalingLayer::get_statistics ( void   ) 

This method returns all the available statistics of the inputs and variables. The format is a vector of pointers to vectors of size ten:

  • Mean of scaling neurons.
  • Standard deviation of scaling neurons.
  • Minimum of scaling neurons.
  • Maximum of scaling neurons.

Definition at line 386 of file scaling_layer.cpp.

const ScalingLayer::ScalingMethod & OpenNN::ScalingLayer::get_scaling_method ( void   )  const

This method returns the method used for scaling.

Definition at line 403 of file scaling_layer.cpp.

std::string OpenNN::ScalingLayer::write_scaling_method ( void   )  const

This method returns a string with the name of the method used for scaling.

Definition at line 413 of file scaling_layer.cpp.

const bool & OpenNN::ScalingLayer::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 441 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set ( void   ) 

This method sets the scaling layer to be empty.

Definition at line 451 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set ( const unsigned int &  new_inputs_number  ) 

This method sets a new size in the scaling layer. It also sets the members to their default values.

Definition at line 467 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set ( const Vector< Vector< double > > &  new_statistics  ) 

This method sets the size of the scaling layer and the statistics values.

Parameters:
new_statistics Vector of vectors containing the minimums, maximums, means and standard deviations for the scaling layer. The size of this vector must be 4. The size of each subvector will be the size of the scaling layer.

Definition at line 485 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set ( TiXmlElement *  new_scaling_layer_element  ) 

This method sets the scaling layer members from a XML element.

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

Definition at line 501 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set ( const ScalingLayer new_scaling_layer  ) 

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

Parameters:
new_scaling_layer Object to be copied.

Definition at line 512 of file scaling_layer.cpp.

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

This method sets the members to their default value:

  • Minimus: -1 for all unscaling neurons.
  • Maximums: 1 for al unscaling neurons.
  • Means: 0 for all unscaling neurons.
  • Standard deviations 1 for all unscaling neurons.
  • Scaling method: Minimum and maximum.
  • Display: True.

Definition at line 537 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set_minimums ( const Vector< double > &  new_minimums  ) 

This method sets new minimum values for all the scaling neurons. These values are used for scaling variables with the minimums and maximums method.

Parameters:
new_minimums New set of minimum values for the scaling neurons.

Definition at line 556 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set_minimum ( const unsigned int &  index,
const double &  new_minimum 
)

This method sets a new minimum value for a single scaling neuron. This value is used for scaling that variable with the minimums and maximums method.

Parameters:
index Index of scaling neuron.
new_minimum New minimum value for the scaling neuron with the previous index.

Definition at line 591 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set_maximums ( const Vector< double > &  new_maximum  ) 

This method sets new maximum values for all the scaling neurons. These values are used for scaling the inputs to the multilayer perceptron with the minimums and maximums method.

Parameters:
new_maximum New set of maximum values for the scaling neurons of the multilayer perceptron

Definition at line 629 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set_maximum ( const unsigned int &  index,
const double &  new_maximum 
)

This method sets a new maximum value for a single input variable. This value is used for scaling that inputs to the multilayer perceptron with the minimums and maximums method.

Parameters:
index Index of input variable.
new_maximum New maximum value for that input variable.

Definition at line 663 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set_means ( const Vector< double > &  new_mean  ) 

This method sets new mean values for all the scaling neurons. These values are used for scaling the inputs to the multilayer perceptron with the meand and standard deviation method.

Parameters:
new_mean New set of mean values for the scaling neurons of the multilayer perceptron

Definition at line 702 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set_mean ( const unsigned int &  index,
const double &  new_mean 
)

This method sets a new mean value for a single input variable. These values are used for scaling the inputs to the multilayer perceptron with the meand and standard deviation method.

Parameters:
index Index of input variable.
new_mean New mean values for the input variable with index i.

Definition at line 737 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set_standard_deviations ( const Vector< double > &  new_standard_deviation  ) 

This method sets new standard deviation values for all the scaling neurons. These values are used for scaling the inputs to the multilayer perceptron with the meand and standard deviation method.

Parameters:
new_standard_deviation New set of standard deviation values for the scaling neurons of the multilayer perceptron

Definition at line 779 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set_standard_deviation ( const unsigned int &  index,
const double &  new_standard_deviation 
)

This method sets a new standard deviation value for a single input variable. These values are used for scaling the inputs to the multilayer perceptron with the meand and standard deviation method.

Parameters:
index Index of input variable.
new_standard_deviation New standard deviation value for that input variable.

Definition at line 814 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set_minimums_maximums ( const Vector< Vector< double > > &  new_minimums_maximums  ) 

This method sets both the minimums and the maximum values of all the scaling neurons. The format is a vector of two real vectors. The first element must contain the minimum values for the scaling neurons. The second element must contain the maximum values for the scaling neurons. These values are used for scaling variables with the minimums and maximums method.

Parameters:
new_minimums_maximums New set of minimums and maximum values for the scaling neurons of the layer.

Definition at line 858 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set_means_standard_deviations ( const Vector< Vector< double > > &  new_means_standard_deviations  ) 

This method sets both the mean and the standard deviation values of all the scaling neurons. The format is a vector of two real vectors. The first element must contain the mean values for the scaling neurons. The second elements must contain the standard deviation values for the scaling neurons. These values are used for scaling variables with the meand and standard deviation method.

Parameters:
new_means_standard_deviations New set of mean and standard deviation values for the scaling neurons.

Definition at line 927 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set_statistics ( const Vector< Vector< double > > &  new_statistics  ) 

This method sets all the scaling layer statistics. The format is a vector of four real vectors:

  • Minimum of scaling neurons.
  • Maximum of scaling neurons.
  • Mean of scaling neurons.
  • Standard deviation of scaling neurons.
Parameters:
new_statistics Scaling layer statistics.

Definition at line 993 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set_scaling_method ( const ScalingMethod new_scaling_method  ) 

This method sets the method to be used for scaling the variables.

Parameters:
new_scaling_method New scaling method for the variables.

Definition at line 1048 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::set_scaling_method ( const std::string &  new_scaling_method  ) 

This method sets the method to be used for scaling the variables. The argument is a string containing the name of the method ("None", "MeanStandardDeviation" or "MinimumMaximum").

Parameters:
new_scaling_method New scaling method in the layer.

Definition at line 1060 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::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 1090 of file scaling_layer.cpp.

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

This method returns true if the number of scaling neurons is zero, and false otherwise.

Definition at line 1100 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::initialize_random ( void   ) 

Todo:

Definition at line 1182 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::check_range ( const Vector< double > &  inputs  )  const

This method chechs whether the inputs to the scaling layer have the right size. If not, it displays an error message and exits the program. It also checks whether the input values are inside the range defined by the minimums and maximum values, and displays a warning message if they are outside.

Parameters:
inputs Set of inputs to the scaling layer.

Definition at line 1123 of file scaling_layer.cpp.

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

This method scales some values to produce some scaled values.

Parameters:
inputs Set of inputs to the scaling layer.

Definition at line 1193 of file scaling_layer.cpp.

Vector< double > OpenNN::ScalingLayer::calculate_derivative ( const Vector< double > &  dummy  )  const

This method retuns the derivatives of the scaled inputs with respect to the raw inputs. That derivatives depend on the inputs scaling method to be used.

Definition at line 1250 of file scaling_layer.cpp.

Vector< double > OpenNN::ScalingLayer::calculate_second_derivative ( const Vector< double > &  dummy  )  const

This method retuns the second derivatives of the scaled inputs with respect to the raw inputs. That second derivatives depend on the inputs scaling method to be used.

Definition at line 1287 of file scaling_layer.cpp.

Vector< double > OpenNN::ScalingLayer::calculate_minimum_maximum_output ( const Vector< double > &  inputs  )  const

This method calculates the outputs from the scaling layer with the minimum and maximum method for a set of inputs.

Parameters:
inputs Vector of input values to the scaling layer. The size must be equal to the number of scaling neurons.

Definition at line 1324 of file scaling_layer.cpp.

Vector< double > OpenNN::ScalingLayer::calculate_minimum_maximum_derivative ( const Vector< double > &   )  const

This method calculates the derivatives of the outputs from the scaling layer with the minimum and maximum method. As the minimum and maximum method is a linear method, the derivatives will not depend on the inputs.

Definition at line 1359 of file scaling_layer.cpp.

Vector< double > OpenNN::ScalingLayer::calculate_minimum_maximum_second_derivative ( const Vector< double > &   )  const

This method calculates the second derivatives of the outputs from the scaling layer with the minimum and maximum method. As the minimum and maximum method is a linear method, the second derivatives will be always zero.

Definition at line 1394 of file scaling_layer.cpp.

Vector< double > OpenNN::ScalingLayer::calculate_mean_standard_deviation_output ( const Vector< double > &  inputs  )  const

This method calculates the outputs from the scaling layer with the mean and standard deviation method for a set of inputs.

Parameters:
inputs Vector of input values to the scaling layer. The size must be equal to the number of scaling neurons.

Definition at line 1409 of file scaling_layer.cpp.

Vector< double > OpenNN::ScalingLayer::calculate_mean_standard_deviation_derivative ( const Vector< double > &   )  const

This method calculates the derivatives of the outputs from the scaling layer with the mean and standard deviation method. As the minimum and maximum method is a linear method, the derivatives will not depend on the inputs.

Definition at line 1445 of file scaling_layer.cpp.

Vector< double > OpenNN::ScalingLayer::calculate_mean_standard_deviation_second_derivative ( const Vector< double > &   )  const

This method calculates the second derivatives of the outputs from the scaling layer with the mean and standard deviation method. As the minimum and maximum method is a linear method, the second derivatives will be always zero.

Definition at line 1480 of file scaling_layer.cpp.

Matrix< double > OpenNN::ScalingLayer::arrange_Jacobian ( const Vector< double > &  derivative  )  const

This method arranges a "Jacobian" matrix from the vector of derivatives.

Definition at line 1494 of file scaling_layer.cpp.

Vector< Matrix< double > > OpenNN::ScalingLayer::arrange_Hessian_form ( const Vector< double > &  second_derivative  )  const

This method arranges a "Hessian form" vector of matrices from the vector of second derivatives.

Definition at line 1510 of file scaling_layer.cpp.

std::string OpenNN::ScalingLayer::write_minimum_maximum_expression ( const Vector< std::string > &  inputs_name,
const Vector< std::string > &  outputs_name 
) const

This method returns a string with the expression of the scaling process with the minimum and maximum method.

Parameters:
inputs_name Name of inputs to the scaling layer. The size of this vector must be equal to the number of scaling neurons.
outputs_name Name of outputs from the scaling layer. The size of this vector must be equal to the number of scaling neurons.

Definition at line 1533 of file scaling_layer.cpp.

std::string OpenNN::ScalingLayer::write_mean_standard_deviation_expression ( const Vector< std::string > &  inputs_name,
const Vector< std::string > &  outputs_name 
) const

This method returns a string with the expression of the scaling process with the mean and standard deviation method.

Parameters:
inputs_name Name of inputs to the scaling layer. The size of this vector must be equal to the number of scaling neurons.
outputs_name Name of outputs from the scaling layer. The size of this vector must be equal to the number of scaling neurons.

Definition at line 1554 of file scaling_layer.cpp.

std::string OpenNN::ScalingLayer::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 inputs scaling process.

Definition at line 1573 of file scaling_layer.cpp.

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

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

Definition at line 1612 of file scaling_layer.cpp.

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

This method serializes the scaling 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 1633 of file scaling_layer.cpp.

void OpenNN::ScalingLayer::from_XML ( TiXmlElement *  scaling_layer_element  )  [virtual]

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

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

Definition at line 1712 of file scaling_layer.cpp.


Member Data Documentation

Minimum of input variables.

Definition at line 196 of file scaling_layer.h.

Maximum of input variables.

Definition at line 200 of file scaling_layer.h.

Vector<double> OpenNN::ScalingLayer::means [protected]

Mean of input variables.

Definition at line 204 of file scaling_layer.h.

Standard deviation of input variables.

Definition at line 208 of file scaling_layer.h.

Method for scaling the input variables.

Definition at line 212 of file scaling_layer.h.

Display warning messages to screen.

Definition at line 216 of file scaling_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