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

#include <bounding_layer.h>

Public Types

enum  BoundingMethod { NoBounding, Boundind }
 

Public Member Functions

 BoundingLayer (void)
 
 BoundingLayer (const size_t &)
 
 BoundingLayer (const tinyxml2::XMLDocument &)
 
 BoundingLayer (const BoundingLayer &)
 
virtual ~BoundingLayer (void)
 
BoundingLayeroperator= (const BoundingLayer &)
 
bool operator== (const BoundingLayer &) const
 
bool is_empty (void) const
 
size_t get_bounding_neurons_number (void) const
 
const Vector< double > & get_lower_bounds (void) const
 
double get_lower_bound (const size_t &) const
 
const Vector< double > & get_upper_bounds (void) const
 
double get_upper_bound (const size_t &) const
 
Vector< Vector< double > * > get_bounds (void)
 
void set (void)
 
void set (const size_t &)
 
void set (const tinyxml2::XMLDocument &)
 
void set (const BoundingLayer &)
 
void set_lower_bounds (const Vector< double > &)
 
void set_lower_bound (const size_t &, const double &)
 
void set_upper_bounds (const Vector< double > &)
 
void set_upper_bound (const size_t &, const double &)
 
void set_bounds (const Vector< Vector< double > > &)
 
void set_display (const bool &)
 
void set_default (void)
 
void prune_bounding_neuron (const size_t &)
 
void initialize_random (void)
 
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
 
Matrix< double > arrange_Jacobian (const Vector< double > &) const
 
Vector< Matrix< double > > arrange_Hessian_form (const Vector< double > &) const
 
std::string write_expression (const Vector< std::string > &, const Vector< std::string > &) const
 
std::string to_string (void) const
 
tinyxml2::XMLDocument * to_XML (void) const
 
void from_XML (const tinyxml2::XMLDocument &)
 

Protected Attributes

Vector< double > lower_bounds
 
Vector< double > upper_bounds
 
bool display
 

Detailed Description

This class represents a layer of bounding neurons. A bounding layer is used to ensure that variables will never fall below or above given values.

Definition at line 41 of file bounding_layer.h.

Constructor & Destructor Documentation

OpenNN::BoundingLayer::BoundingLayer ( void  )
explicit

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

Definition at line 26 of file bounding_layer.cpp.

OpenNN::BoundingLayer::BoundingLayer ( const size_t &  bounding_neurons_number)
explicit

Bounding neurons number constructor. It creates a bounding layer with a given size.

Parameters
bounding_neurons_numberNumber of bounding neurons in the layer.

Definition at line 38 of file bounding_layer.cpp.

OpenNN::BoundingLayer::BoundingLayer ( const tinyxml2::XMLDocument &  bounding_layer_document)
explicit

XML constructor. It creates a bounding layer and loads its members from a XML document.

Parameters
bounding_layer_documentTinyXML document with the member data.

Definition at line 52 of file bounding_layer.cpp.

OpenNN::BoundingLayer::BoundingLayer ( const BoundingLayer other_bounding_layer)

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

Parameters
other_bounding_layerBounding layer to be copied.

Definition at line 64 of file bounding_layer.cpp.

OpenNN::BoundingLayer::~BoundingLayer ( void  )
virtual

Destructor. This destructor does not delete any pointer.

Definition at line 75 of file bounding_layer.cpp.

Member Function Documentation

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

Arranges a "Hessian form" vector of matrices from a vector of derivatives. The Hessian form is composed of the second partial derivatives of the layer outputs with respect to the layer inputs.

Definition at line 722 of file bounding_layer.cpp.

Matrix< double > OpenNN::BoundingLayer::arrange_Jacobian ( const Vector< double > &  derivatives) const

Arranges a "Jacobian matrix" from a vector of derivatives. The Jacobian matrix is composed of the partial derivatives of the layer outputs with respect to the layer inputs.

Parameters
derivativesVector of outputs-inputs derivatives of each bounding neuron.

Definition at line 687 of file bounding_layer.cpp.

Vector< double > OpenNN::BoundingLayer::calculate_derivative ( const Vector< double > &  inputs) const

Returns the derivatives of the outputs with respect to the inputs.

Parameters
inputsSet of input values to the bounding layer.

Definition at line 618 of file bounding_layer.cpp.

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

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

Parameters
inputsSet of inputs to the bounding layer.

Definition at line 586 of file bounding_layer.cpp.

Vector< double > OpenNN::BoundingLayer::calculate_second_derivative ( const Vector< double > &  inputs) const

Returns the second derivatives of the outputs with respect to the inputs.

Parameters
inputsSet of input values to the bounding layer.

Definition at line 647 of file bounding_layer.cpp.

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

Deserializes a TinyXML document into this bounding layer object.

Parameters
documentTinyXML document containing the member data.

Definition at line 836 of file bounding_layer.cpp.

Vector< Vector< double > * > OpenNN::BoundingLayer::get_bounds ( void  )

Returns the lower bounds and the upper bounds of all the bounding neurons. The format is a vector of pointers to vectors of size two. The first element contains the lower bound values. The second element contains the upper bound values.

Definition at line 247 of file bounding_layer.cpp.

double OpenNN::BoundingLayer::get_lower_bound ( const size_t &  i) const

Returns the lower bound value of a single bounding neuron.

Parameters
iIndex of bounding neuron.

Definition at line 165 of file bounding_layer.cpp.

double OpenNN::BoundingLayer::get_upper_bound ( const size_t &  i) const

Returns the upper bound value of a single bounding neuron.

Parameters
iIndex of bounding neuron.

Definition at line 205 of file bounding_layer.cpp.

BoundingLayer & OpenNN::BoundingLayer::operator= ( const BoundingLayer other_bounding_layer)

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

Parameters
other_bounding_layerBounding layer object to be assigned.

Definition at line 86 of file bounding_layer.cpp.

bool OpenNN::BoundingLayer::operator== ( const BoundingLayer other_bounding_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_bounding_layer Bounding layer to be compared with.

Definition at line 108 of file bounding_layer.cpp.

void OpenNN::BoundingLayer::prune_bounding_neuron ( const size_t &  index)

Removes a given bounding neuron from the bounding layer.

Parameters
indexIndex of neuron to be pruned.

Definition at line 539 of file bounding_layer.cpp.

void OpenNN::BoundingLayer::set ( void  )

Sets the number of bounding neurons to be zero. It also sets the rest of memebers to their default values.

Definition at line 263 of file bounding_layer.cpp.

void OpenNN::BoundingLayer::set ( const size_t &  new_bounding_neurons_number)

Resizes the bounding layer. It also sets the rest of memebers to their default values.

Parameters
new_bounding_neurons_numberSize of the bounding layer.

Definition at line 278 of file bounding_layer.cpp.

void OpenNN::BoundingLayer::set ( const tinyxml2::XMLDocument &  bounding_layer_document)

Sets the bounding layer members from a XML document.

Parameters
bounding_layer_documentPointer to a TinyXML document containing the member data.

Definition at line 292 of file bounding_layer.cpp.

void OpenNN::BoundingLayer::set ( const BoundingLayer other_bounding_layer)

Sets the members of this object to be the members of another object of the same class.

Parameters
other_bounding_layerObject to be copied.

Definition at line 305 of file bounding_layer.cpp.

void OpenNN::BoundingLayer::set_bounds ( const Vector< Vector< double > > &  new_bounds)

Sets both the lower bounds and the upper bounds of all the neurons in the layer. The format is a vector of two real vectors. The first element must contain the lower bound values for the bounding neurons. The second element must contain the upper bound values for the bounding neurons. These values are used for unscaling variables so that they are neither less than the lower bounds nor greater than the upper bounds.

Parameters
new_boundsNew set of lower and upper bounds.

Definition at line 467 of file bounding_layer.cpp.

void OpenNN::BoundingLayer::set_default ( void  )

Sets the members to their default values:

  • Display: True.

Definition at line 528 of file bounding_layer.cpp.

void OpenNN::BoundingLayer::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 515 of file bounding_layer.cpp.

void OpenNN::BoundingLayer::set_lower_bound ( const size_t &  index,
const double &  new_lower_bound 
)

Sets a new lower bound for a single neuron. This value is used for unscaling that variable so that it is not less than the lower bound.

Parameters
indexIndex of bounding neuron.
new_lower_boundNew lower bound for the neuron with index i.

Definition at line 354 of file bounding_layer.cpp.

void OpenNN::BoundingLayer::set_lower_bounds ( const Vector< double > &  new_lower_bounds)

Sets new lower bounds for all the neurons in the layer.

Parameters
new_lower_boundsNew set of lower bounds for the bounding neurons.

Definition at line 320 of file bounding_layer.cpp.

void OpenNN::BoundingLayer::set_upper_bound ( const size_t &  index,
const double &  new_upper_bound 
)

Sets a new upper bound for a single neuron. This value is used for unscaling that variable so that it is not greater than the upper bound.

Parameters
indexIndex of bounding neuron.
new_upper_boundNew upper bound for the bounding neuron with that index.

Definition at line 426 of file bounding_layer.cpp.

void OpenNN::BoundingLayer::set_upper_bounds ( const Vector< double > &  new_upper_bounds)

Sets new upper bounds for all the bounding neurons. These values are used for unscaling variables so that they are not greater than the upper bounds.

Parameters
new_upper_boundsNew set of upper bounds for the layer.

Definition at line 392 of file bounding_layer.cpp.

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

Serializes the bounding layer object into a XML document of the TinyXML library. See the OpenNN manual for more information about the format of this document.

Definition at line 779 of file bounding_layer.cpp.


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