OpenNN  2.2
Open Neural Networks Library
Public Types | Public Member Functions | Protected Attributes | List of all members
OpenNN::UnscalingLayer Class Reference

#include <unscaling_layer.h>

Public Types

enum  UnscalingMethod { NoUnscaling, MinimumMaximum, MeanStandardDeviation }
 

Public Member Functions

 UnscalingLayer (void)
 
 UnscalingLayer (const size_t &)
 
 UnscalingLayer (const Vector< Statistics< double > > &)
 
 UnscalingLayer (const tinyxml2::XMLDocument &)
 
 UnscalingLayer (const UnscalingLayer &)
 
virtual ~UnscalingLayer (void)
 
UnscalingLayeroperator= (const UnscalingLayer &)
 
bool operator== (const UnscalingLayer &) const
 
size_t get_unscaling_neurons_number (void) const
 
Vector< Statistics< double > > get_statistics (void) const
 
Matrix< double > arrange_statistics (void) const
 
Vector< double > arrange_minimums (void) const
 
Vector< double > arrange_maximums (void) const
 
const UnscalingMethodget_unscaling_method (void) const
 
std::string write_unscaling_method (void) const
 
std::string write_unscaling_method_text (void) const
 
const bool & get_display (void) const
 
void set (void)
 
void set (const size_t &)
 
void set (const Vector< Statistics< double > > &)
 
void set (const tinyxml2::XMLDocument &)
 
void set (const UnscalingLayer &)
 
virtual void set_default (void)
 
void set_statistics (const Vector< Statistics< double > > &)
 
void set_item_statistics (const size_t &, const Statistics< double > &)
 
void set_minimum (const size_t &, const double &)
 
void set_maximum (const size_t &, const double &)
 
void set_mean (const size_t &, const double &)
 
void set_standard_deviation (const size_t &, const double &)
 
void set_unscaling_method (const UnscalingMethod &)
 
void set_unscaling_method (const std::string &)
 
void set_display (const bool &)
 
void prune_unscaling_neuron (const size_t &)
 
bool is_empty (void) const
 
void initialize_random (void)
 
Vector< double > calculate_outputs (const Vector< double > &) const
 
Vector< double > calculate_derivatives (const Vector< double > &) const
 
Vector< double > calculate_second_derivatives (const Vector< double > &) const
 
Vector< double > calculate_minimum_maximum_outputs (const Vector< double > &) const
 
Vector< double > calculate_minimum_maximum_derivatives (const Vector< double > &) const
 
Vector< double > calculate_minimum_maximum_second_derivatives (const Vector< double > &) const
 
Vector< double > calculate_mean_standard_deviation_outputs (const Vector< double > &) const
 
Vector< double > calculate_mean_standard_deviation_derivatives (const Vector< double > &) const
 
Vector< double > calculate_mean_standard_deviation_second_derivatives (const Vector< double > &) const
 
Matrix< double > arrange_Jacobian (const Vector< double > &) const
 
Vector< Matrix< double > > arrange_Hessian_form (const Vector< double > &) const
 
void check_range (const Vector< double > &) const
 
std::string to_string (void) const
 
tinyxml2::XMLDocument * to_XML (void) const
 
void from_XML (const tinyxml2::XMLDocument &)
 
std::string write_none_expression (const Vector< std::string > &, const Vector< std::string > &) const
 
std::string write_minimum_maximum_expression (const Vector< std::string > &, const Vector< std::string > &) const
 
std::string write_mean_stadard_deviation_expression (const Vector< std::string > &, const Vector< std::string > &) const
 
std::string write_expression (const Vector< std::string > &, const Vector< std::string > &) const
 

Protected Attributes

Vector< Statistics< double > > statistics
 
UnscalingMethod unscaling_method
 
bool display
 

Detailed Description

This class represents a layer of unscaling neurons. Unscaling layers are included in the definition of a neural network. They are used to unnormalize variables so they are in the original range after computer processing.

Definition at line 43 of file unscaling_layer.h.

Member Function Documentation

Vector< double > OpenNN::UnscalingLayer::arrange_maximums ( void  ) const

Returns a vector with the maximum values of all unscaling neurons. The size is the number of neurons in the layer.

Definition at line 192 of file unscaling_layer.cpp.

Vector< double > OpenNN::UnscalingLayer::arrange_minimums ( void  ) const

Returns a vector with the minimum values of all unscaling neurons. The size is the number of neurons in the layer.

Definition at line 172 of file unscaling_layer.cpp.

Matrix< double > OpenNN::UnscalingLayer::arrange_statistics ( void  ) const

Returns a single matrix with the statistics of all unscaling neurons. The number of rows is the number of unscaling neurons, and the number of columns is 4 (minimum, maximum, mean and standard deviation).

Definition at line 152 of file unscaling_layer.cpp.

Vector< double > OpenNN::UnscalingLayer::calculate_derivatives ( const Vector< double > &  inputs) const

This method retuns the derivatives of the unscaled outputs with respect to the scaled outputs. That derivatives depend on the method for unscaling the outputs to be used.

Definition at line 752 of file unscaling_layer.cpp.

Vector< double > OpenNN::UnscalingLayer::calculate_mean_standard_deviation_derivatives ( const Vector< double > &  ) const

Calculates the derivatives of the outputs from the unscaling 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 965 of file unscaling_layer.cpp.

Vector< double > OpenNN::UnscalingLayer::calculate_mean_standard_deviation_outputs ( const Vector< double > &  inputs) const

Calculates the outputs from the unscaling layer with the mean and standard deviation method for a set of inputs.

Parameters
inputsVector of input values to the unscaling layer. The size must be equal to the number of unscaling neurons.

Definition at line 930 of file unscaling_layer.cpp.

Vector< double > OpenNN::UnscalingLayer::calculate_mean_standard_deviation_second_derivatives ( const Vector< double > &  ) const

Calculates the second derivatives of the outputs from the unscaling 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 1000 of file unscaling_layer.cpp.

Vector< double > OpenNN::UnscalingLayer::calculate_minimum_maximum_derivatives ( const Vector< double > &  ) const

Calculates the derivatives of the outputs from the unscaling 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 880 of file unscaling_layer.cpp.

Vector< double > OpenNN::UnscalingLayer::calculate_minimum_maximum_outputs ( const Vector< double > &  inputs) const

Calculates the outputs from the unscaling layer with the minimum and maximum method for a set of inputs.

Parameters
inputsVector of input values to the unscaling layer. The size must be equal to the number of unscaling neurons.

Definition at line 845 of file unscaling_layer.cpp.

Vector< double > OpenNN::UnscalingLayer::calculate_minimum_maximum_second_derivatives ( const Vector< double > &  ) const

Calculates the second derivatives of the outputs from the unscaling 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 915 of file unscaling_layer.cpp.

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

Calculates the outputs from the unscaling layer for a given set of inputs to that layer.

Parameters
inputsSet of inputs to the unscaling layer.

Definition at line 687 of file unscaling_layer.cpp.

Vector< double > OpenNN::UnscalingLayer::calculate_second_derivatives ( const Vector< double > &  inputs) const

This method retuns the second derivatives of the unscaled outputs with respect to the scaled outputs. That second derivatives depend on the method for unscaling the outputs to be used.

Definition at line 808 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::check_range ( const Vector< double > &  outputs) const

Checks whether the outptus from the unscaling layer are inside the range defined by the minimums and maximum values. It displays a warning message if they are outside.

Parameters
outputsSet of outptus from the unscaling layer.

Definition at line 569 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::from_XML ( const tinyxml2::XMLDocument &  document)

Deserializes a TinyXML document into this unscaling layer object.

Parameters
documentXML document containing the member data.

Definition at line 1188 of file unscaling_layer.cpp.

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

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 287 of file unscaling_layer.cpp.

Vector< Statistics< double > > OpenNN::UnscalingLayer::get_statistics ( void  ) const

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

  • Mean of variables.
  • Standard deviation of variables.
  • Minimum of variables.
  • Maximum of variables.

Definition at line 139 of file unscaling_layer.cpp.

const UnscalingLayer::UnscalingMethod & OpenNN::UnscalingLayer::get_unscaling_method ( void  ) const

Returns the method used for unscaling (no unscaling, minimum and maximum or mean and standard deviation).

Definition at line 212 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::initialize_random ( void  )

Initializes at random the statistics of all neurons in the layer and the unscaling method.

Definition at line 640 of file unscaling_layer.cpp.

UnscalingLayer & OpenNN::UnscalingLayer::operator= ( const UnscalingLayer other_unscaling_layer)

Assignment operator.

Parameters
other_unscaling_layerObject to be copied.

Definition at line 79 of file unscaling_layer.cpp.

bool OpenNN::UnscalingLayer::operator== ( const UnscalingLayer other_unscaling_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_unscaling_layerObject to be compared with.

Definition at line 102 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::prune_unscaling_neuron ( const size_t &  index)

Removes a single unscaling neuron from the unscaling layer.

Parameters
indexIndex of neuron to be removed.

Definition at line 538 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::set ( const size_t &  new_unscaling_neurons_number)

Sets a new size in the unscaling layer. It also sets the members to their default values.

Definition at line 310 of file unscaling_layer.cpp.

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

Sets the size of the unscaling layer and the statistics values.

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

Definition at line 325 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::set ( const tinyxml2::XMLDocument &  new_unscaling_layer_document)

Sets the unscaling layer members from a XML document.

Parameters
new_unscaling_layer_documentPointer to a TinyXML document containing the member data.

Definition at line 338 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::set_default ( void  )
virtual

This member sets the default values for the unscaling layer:

  • 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.
  • Unscaling method: Minimum and maximum.
  • Display: True.

Definition at line 372 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::set_display ( const bool &  new_display)

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_displayDisplay value.

Definition at line 527 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::set_item_statistics ( const size_t &  i,
const Statistics< double > &  item_statistics 
)

Sets the minimum, maximum, mean and standard deviation values of a single unscaling neuron.

Parameters
iIndex of unscaling neuron.
item_statisticsStatistics values for that neuron.

Definition at line 422 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::set_maximum ( const size_t &  i,
const double &  new_maximum 
)

Sets the maximum value of a given unscaling neuron.

Parameters
iIndex of unscaling neuron.
new_maximumMaximum value.

Definition at line 446 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::set_mean ( const size_t &  i,
const double &  new_mean 
)

Sets the mean value of a given unscaling neuron.

Parameters
iIndex of unscaling neuron.
new_meanMean value.

Definition at line 458 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::set_minimum ( const size_t &  i,
const double &  new_minimum 
)

Sets the minimum value of a given unscaling neuron.

Parameters
iIndex of unscaling neuron.
new_minimumMinimum value.

Definition at line 434 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::set_standard_deviation ( const size_t &  i,
const double &  new_standard_deviation 
)

Sets the standard deviation value of a given unscaling neuron.

Parameters
iIndex of unscaling neuron.
new_standard_deviationStandard deviation value.

Definition at line 470 of file unscaling_layer.cpp.

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

Sets the statistics for all the neurons in the unscaling layer from a vector. The size of this vector must be equal to the number of unscaling neurons.

Parameters
new_statisticsUnscaling neurons statistics.

Definition at line 387 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::set_unscaling_method ( const UnscalingMethod new_unscaling_method)

Sets the method to be used for unscaling the outputs from the multilayer perceptron

Parameters
new_unscaling_methodNew unscaling method for the output variables.

Definition at line 481 of file unscaling_layer.cpp.

void OpenNN::UnscalingLayer::set_unscaling_method ( const std::string &  new_unscaling_method)

Sets the method to be used for unscaling the outputs from the multilayer perceptron The argument is a string containing the name of the method ("NoUnscaling", "MeanStandardDeviation" or "MinimumMaximum").

Parameters
new_unscaling_methodNew unscaling method for the output variables.

Definition at line 493 of file unscaling_layer.cpp.

tinyxml2::XMLDocument * OpenNN::UnscalingLayer::to_XML ( void  ) const

Serializes this unscaling layer object into a TinyXML document-> Please read the OpenNN manual for more information about this.

Definition at line 1079 of file unscaling_layer.cpp.

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

Returns a string with the expression of the unscaling process in this layer.

Parameters
inputs_nameName of inputs to the unscaling layer. The size of this vector must be equal to the number of unscaling neurons.
outputs_nameName of outputs from the unscaling layer. The size of this vector must be equal to the number of unscaling neurons.

Definition at line 1429 of file unscaling_layer.cpp.

std::string OpenNN::UnscalingLayer::write_mean_stadard_deviation_expression ( const Vector< std::string > &  inputs_name,
const Vector< std::string > &  outputs_name 
) const

Returns a string with the expression of the unscaling process with the mean and standard deviation method.

Parameters
inputs_nameName of inputs to the unscaling layer. The size of this vector must be equal to the number of unscaling neurons.
outputs_nameName of outputs from the unscaling layer. The size of this vector must be equal to the number of unscaling neurons.

Definition at line 1408 of file unscaling_layer.cpp.

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

Returns a string with the expression of the unscaling process with the minimum and maximum method.

Parameters
inputs_nameName of inputs to the unscaling layer. The size of this vector must be equal to the number of unscaling neurons.
outputs_nameName of outputs from the unscaling layer. The size of this vector must be equal to the number of unscaling neurons.

Definition at line 1387 of file unscaling_layer.cpp.

std::string OpenNN::UnscalingLayer::write_none_expression ( const Vector< std::string > &  inputs_name,
const Vector< std::string > &  outputs_name 
) const

Returns a string with the expression of the unscaling process with the none method.

Parameters
inputs_nameName of inputs to the unscaling layer. The size of this vector must be equal to the number of unscaling neurons.
outputs_nameName of outputs from the unscaling layer. The size of this vector must be equal to the number of unscaling neurons.

Definition at line 1366 of file unscaling_layer.cpp.

std::string OpenNN::UnscalingLayer::write_unscaling_method ( void  ) const

Returns a string with the name of the method used for unscaling ("MinimumMaximum", "MeanStandardDeviation" or "NoUnscaling").

Definition at line 223 of file unscaling_layer.cpp.

std::string OpenNN::UnscalingLayer::write_unscaling_method_text ( void  ) const

Returns a string with the name of the method used for unscaling, as paragraph text.

Definition at line 255 of file unscaling_layer.cpp.


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