OpenNN
2.2
Open Neural Networks Library
|
#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) |
BoundingLayer & | operator= (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 |
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.
|
explicit |
Default constructor. It creates a bounding layer object with zero bounding neurons.
Definition at line 26 of file bounding_layer.cpp.
|
explicit |
Bounding neurons number constructor. It creates a bounding layer with a given size.
bounding_neurons_number | Number of bounding neurons in the layer. |
Definition at line 38 of file bounding_layer.cpp.
|
explicit |
XML constructor. It creates a bounding layer and loads its members from a XML document.
bounding_layer_document | TinyXML 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.
other_bounding_layer | Bounding layer to be copied. |
Definition at line 64 of file bounding_layer.cpp.
|
virtual |
Destructor. This destructor does not delete any pointer.
Definition at line 75 of file bounding_layer.cpp.
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.
derivatives | Vector 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.
inputs | Set of input values to the bounding layer. |
Definition at line 618 of file bounding_layer.cpp.
Calculates the outputs from the bounding layer for a set of inputs to that layer.
inputs | Set 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.
inputs | Set 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.
document | TinyXML document containing the member data. |
Definition at line 836 of file bounding_layer.cpp.
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.
i | Index 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.
i | Index 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.
other_bounding_layer | Bounding 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.
index | Index 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.
new_bounding_neurons_number | Size 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.
bounding_layer_document | Pointer 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.
other_bounding_layer | Object to be copied. |
Definition at line 305 of file bounding_layer.cpp.
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.
new_bounds | New 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:
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.
new_display | Display 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.
index | Index of bounding neuron. |
new_lower_bound | New 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.
new_lower_bounds | New 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.
index | Index of bounding neuron. |
new_upper_bound | New 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.
new_upper_bounds | New 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.