This class represents a layer of bounding neurons. More...
#include <bounding_layer.h>
Public Types | |
enum class | BoundingMethod { NoBounding , Bounding } |
Enumeration of available methods for bounding the output variables. More... | |
Public Types inherited from Layer | |
enum class | Type { Scaling , Convolutional , Perceptron , Pooling , Probabilistic , LongShortTermMemory , Recurrent , Unscaling , Bounding } |
This enumeration represents the possible types of layers. More... | |
Public Member Functions | |
BoundingLayer () | |
BoundingLayer (const Index &) | |
virtual | ~BoundingLayer () |
bool | is_empty () const |
Returns true if the size of the layer is zero, and false otherwise. More... | |
Index | get_inputs_number () const |
Get number of inputs. More... | |
Index | get_neurons_number () const |
Return the neurons number in the bounding layer. More... | |
const BoundingMethod & | get_bounding_method () const |
Returns the method used for bounding layer. More... | |
string | write_bounding_method () const |
Returns a string writing if use bounding layer or not. More... | |
const Tensor< type, 1 > & | get_lower_bounds () const |
Returns the lower bounds values of all the bounding neurons in the layer. More... | |
type | get_lower_bound (const Index &) const |
const Tensor< type, 1 > & | get_upper_bounds () const |
Returns the upper bounds values of all the bounding neurons in the layer. More... | |
type | get_upper_bound (const Index &) const |
void | set () |
void | set (const Index &) |
void | set (const tinyxml2::XMLDocument &) |
void | set (const BoundingLayer &) |
void | set_inputs_number (const Index &) |
void | set_neurons_number (const Index &) |
void | set_bounding_method (const BoundingMethod &) |
void | set_bounding_method (const string &) |
void | set_lower_bounds (const Tensor< type, 1 > &) |
void | set_lower_bound (const Index &, const type &) |
void | set_upper_bounds (const Tensor< type, 1 > &) |
void | set_upper_bound (const Index &, const type &) |
void | set_display (const bool &) |
void | set_default () |
Tensor< type, 2 > | calculate_outputs (const Tensor< type, 2 > &) |
string | write_expression (const Tensor< string, 1 > &, const Tensor< string, 1 > &) const |
Returns a string with the expression of the lower and upper bounds functions. More... | |
string | write_expression_c () const |
BoundingLayer::write_expression_c. More... | |
string | write_expression_python () const |
BoundingLayer::write_expression_python. More... | |
void | from_XML (const tinyxml2::XMLDocument &) |
void | write_XML (tinyxml2::XMLPrinter &) const |
Public Member Functions inherited from Layer | |
string | get_name () const |
virtual void | set_parameters_constant (const type &) |
virtual void | set_parameters_random () |
virtual Tensor< type, 1 > | get_parameters () const |
virtual Index | get_parameters_number () const |
virtual void | set_parameters (const Tensor< type, 1 > &, const Index &) |
void | set_threads_number (const int &) |
virtual void | insert_gradient (LayerBackPropagation *, const Index &, Tensor< type, 1 > &) const |
virtual Tensor< type, 2 > | calculate_outputs_from4D (const Tensor< type, 4 > &) |
virtual Tensor< type, 4 > | calculate_outputs_4d (const Tensor< type, 4 > &) |
virtual void | forward_propagate (const Tensor< type, 2 > &, LayerForwardPropagation *) |
virtual void | forward_propagate (const Tensor< type, 4 > &, LayerForwardPropagation *) |
virtual void | forward_propagate (const Tensor< type, 4 > &, Tensor< type, 1 >, LayerForwardPropagation *) |
virtual void | forward_propagate (const Tensor< type, 2 > &, Tensor< type, 1 >, LayerForwardPropagation *) |
virtual void | calculate_hidden_delta (LayerForwardPropagation *, LayerBackPropagation *, LayerForwardPropagation *, LayerBackPropagation *) const |
virtual void | calculate_hidden_delta_lm (LayerForwardPropagation *, LayerBackPropagationLM *, LayerBackPropagationLM *) const |
virtual void | calculate_error_gradient (const Tensor< type, 2 > &, LayerForwardPropagation *, LayerBackPropagation *) const |
virtual void | calculate_error_gradient (const Tensor< type, 4 > &, LayerForwardPropagation *, LayerBackPropagation *) const |
virtual void | calculate_squared_errors_Jacobian_lm (const Tensor< type, 2 > &, LayerForwardPropagation *, LayerBackPropagationLM *) |
virtual void | insert_squared_errors_Jacobian_lm (LayerBackPropagationLM *, const Index &, Tensor< type, 2 > &) const |
virtual Index | get_synaptic_weights_number () const |
Returns the number of layer's synaptic weights. More... | |
Type | get_type () const |
string | get_type_string () const |
Takes the type of layer used by the model. More... | |
Protected Attributes | |
BoundingMethod | bounding_method = BoundingMethod::Bounding |
Method used to bound the values. More... | |
Tensor< type, 1 > | lower_bounds |
Lower bounds of output variables. More... | |
Tensor< type, 1 > | upper_bounds |
Upper bounds of output variables. More... | |
bool | display = true |
Display messages to screen. More... | |
Protected Attributes inherited from Layer | |
ThreadPool * | thread_pool = nullptr |
ThreadPoolDevice * | thread_pool_device = nullptr |
string | layer_name = "layer" |
Layer name. More... | |
Type | layer_type = Type::Perceptron |
Layer type. More... | |
const Eigen::array< IndexPair< Index >, 1 > | A_BT = {IndexPair<Index>(1, 1)} |
const Eigen::array< IndexPair< Index >, 1 > | AT_B = {IndexPair<Index>(0, 0)} |
const Eigen::array< IndexPair< Index >, 1 > | A_B = {IndexPair<Index>(1, 0)} |
Additional Inherited Members | |
Protected Member Functions inherited from Layer | |
void | hard_sigmoid (const Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | hyperbolic_tangent (const Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | logistic (const Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | linear (const Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | threshold (const Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | symmetric_threshold (const Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | rectified_linear (const Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | scaled_exponential_linear (const Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | soft_plus (const Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | soft_sign (const Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | exponential_linear (const Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | softmax (const Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | binary (const Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | competitive (const Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | hard_sigmoid_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | hyperbolic_tangent_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | linear_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | logistic_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | threshold_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | symmetric_threshold_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | rectified_linear_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | scaled_exponential_linear_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | soft_plus_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | soft_sign_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | exponential_linear_derivatives (const Tensor< type, 1 > &, Tensor< type, 1 > &, Tensor< type, 1 > &) const |
void | hard_sigmoid (const Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | hyperbolic_tangent (const Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | logistic (const Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | linear (const Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | threshold (const Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | symmetric_threshold (const Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | rectified_linear (const Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | scaled_exponential_linear (const Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | soft_plus (const Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | soft_sign (const Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | exponential_linear (const Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | softmax (const Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | binary (const Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | competitive (const Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | hard_sigmoid_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | hyperbolic_tangent_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | linear_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | logistic_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | threshold_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | symmetric_threshold_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | rectified_linear_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | scaled_exponential_linear_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | soft_plus_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | soft_sign_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | exponential_linear_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 2 > &) const |
void | logistic_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 3 > &) const |
void | softmax_derivatives (const Tensor< type, 2 > &, Tensor< type, 2 > &, Tensor< type, 3 > &) const |
void | linear (const Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | logistic (const Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | hyperbolic_tangent (const Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | threshold (const Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | symmetric_threshold (const Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | rectified_linear (const Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | scaled_exponential_linear (const Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | soft_plus (const Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | soft_sign (const Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | hard_sigmoid (const Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | exponential_linear (const Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | linear_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | logistic_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | hyperbolic_tangent_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | threshold_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | symmetric_threshold_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | rectified_linear_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | scaled_exponential_linear_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | soft_plus_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | soft_sign_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | hard_sigmoid_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const |
void | exponential_linear_derivatives (const Tensor< type, 4 > &, Tensor< type, 4 > &, Tensor< type, 4 > &) const |
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 34 of file bounding_layer.h.
|
strong |
Enumeration of available methods for bounding the output variables.
Definition at line 53 of file bounding_layer.h.
|
explicit |
Default constructor. It creates a bounding layer object with zero bounding neurons.
Definition at line 17 of file bounding_layer.cpp.
|
explicit |
Bounding neurons number constructor. It creates a bounding layer with a given size.
neurons_number | Number of bounding neurons in the layer. |
Definition at line 29 of file bounding_layer.cpp.
|
virtual |
Destructor. This destructor does not delete any pointer.
Definition at line 40 of file bounding_layer.cpp.
|
virtual |
Calculates the outputs from the bounding layer for a set of inputs to that layer.
inputs | Set of inputs to the bounding layer. |
Reimplemented from Layer.
Definition at line 438 of file bounding_layer.cpp.
|
virtual |
Deserializes a TinyXML document into this bounding layer object.
document | TinyXML document containing the member data. |
Reimplemented from Layer.
Definition at line 690 of file bounding_layer.cpp.
const BoundingLayer::BoundingMethod & get_bounding_method | ( | ) | const |
Returns the method used for bounding layer.
Definition at line 62 of file bounding_layer.cpp.
|
virtual |
type get_lower_bound | ( | const Index & | i | ) | const |
Returns the lower bound value of a single bounding neuron.
i | Index of bounding neuron. |
Definition at line 119 of file bounding_layer.cpp.
const Tensor< type, 1 > & get_lower_bounds | ( | ) | const |
Returns the lower bounds values of all the bounding neurons in the layer.
Definition at line 110 of file bounding_layer.cpp.
|
virtual |
Return the neurons number in the bounding layer.
Reimplemented from Layer.
Definition at line 102 of file bounding_layer.cpp.
type get_upper_bound | ( | const Index & | i | ) | const |
Returns the upper bound value of a single bounding neuron.
i | Index of bounding neuron. |
Definition at line 153 of file bounding_layer.cpp.
const Tensor< type, 1 > & get_upper_bounds | ( | ) | const |
Returns the upper bounds values of all the bounding neurons in the layer.
Definition at line 144 of file bounding_layer.cpp.
bool is_empty | ( | ) | const |
Returns true if the size of the layer is zero, and false otherwise.
Definition at line 47 of file bounding_layer.cpp.
void set | ( | ) |
Sets the number of bounding neurons to be zero. It also sets the rest of memebers to their default values.
Definition at line 189 of file bounding_layer.cpp.
void 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 249 of file bounding_layer.cpp.
void set | ( | const Index & | new_neurons_number | ) |
Resizes the bounding layer. It also sets the rest of memebers to their default values.
new_neurons_number | Size of the bounding layer. |
Definition at line 204 of file bounding_layer.cpp.
void 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 238 of file bounding_layer.cpp.
void set_bounding_method | ( | const BoundingMethod & | new_method | ) |
Sets a new bounding method.
new_method | New bounding method. |
Definition at line 262 of file bounding_layer.cpp.
void set_bounding_method | ( | const string & | new_method_string | ) |
Sets a new bounding method.
new_method_string | New bounding method string. |
Definition at line 271 of file bounding_layer.cpp.
void set_default | ( | ) |
Sets the members to their default values:
Definition at line 425 of file bounding_layer.cpp.
void 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 414 of file bounding_layer.cpp.
|
virtual |
Resize the number of inputs.
new_inputs_number | Size of the inputs array. |
Reimplemented from Layer.
Definition at line 215 of file bounding_layer.cpp.
void set_lower_bound | ( | const Index & | index, |
const type & | 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 327 of file bounding_layer.cpp.
void set_lower_bounds | ( | const Tensor< type, 1 > & | 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 297 of file bounding_layer.cpp.
|
virtual |
Resize the number of bound neurons from the bounding layer.
new_neurons_number | Number of the neurons from the bounding layer. |
Reimplemented from Layer.
Definition at line 225 of file bounding_layer.cpp.
void set_upper_bound | ( | const Index & | index, |
const type & | 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 379 of file bounding_layer.cpp.
void set_upper_bounds | ( | const Tensor< type, 1 > & | 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 362 of file bounding_layer.cpp.
string write_bounding_method | ( | ) | const |
Returns a string writing if use bounding layer or not.
Definition at line 69 of file bounding_layer.cpp.
|
virtual |
Returns a string with the expression of the lower and upper bounds functions.
Reimplemented from Layer.
Definition at line 475 of file bounding_layer.cpp.
|
virtual |
BoundingLayer::write_expression_c.
Reimplemented from Layer.
Definition at line 504 of file bounding_layer.cpp.
|
virtual |
BoundingLayer::write_expression_python.
Reimplemented from Layer.
Definition at line 551 of file bounding_layer.cpp.
|
virtual |
Serializes the bounding layer object into a XML document of the TinyXML library without keep the DOM tree in memory. See the OpenNN manual for more information about the format of this document.
Reimplemented from Layer.
Definition at line 590 of file bounding_layer.cpp.
|
protected |
Method used to bound the values.
Definition at line 121 of file bounding_layer.h.
|
protected |
Display messages to screen.
Definition at line 133 of file bounding_layer.h.
|
protected |
Lower bounds of output variables.
Definition at line 125 of file bounding_layer.h.
|
protected |
Upper bounds of output variables.
Definition at line 129 of file bounding_layer.h.