This class represents a layer of unscaling neurons. More...
#include <unscaling_layer.h>
Public Member Functions | |
UnscalingLayer () | |
Default constructor. More... | |
UnscalingLayer (const Index &) | |
Outputs number constructor. More... | |
UnscalingLayer (const Tensor< Descriptives, 1 > &) | |
Outputs descriptives constructor. More... | |
virtual | ~UnscalingLayer () |
Destructor. More... | |
Index | get_inputs_number () const |
Returns the number of inputs. More... | |
Index | get_neurons_number () const |
Returns the number of unscaling neurons in this layer. More... | |
Tensor< Descriptives, 1 > | get_descriptives () const |
Tensor< type, 1 > | get_minimums () const |
Tensor< type, 1 > | get_maximums () const |
const Tensor< Scaler, 1 > | get_unscaling_method () const |
Tensor< string, 1 > | write_unscaling_methods () const |
Returns a vector of strings with the name of the method used for each unscaling neuron. More... | |
Tensor< string, 1 > | write_unscaling_method_text () const |
const bool & | get_display () const |
void | set () |
Sets the unscaling layer to be empty. More... | |
void | set (const Index &) |
void | set (const Tensor< Descriptives, 1 > &) |
void | set (const Tensor< Descriptives, 1 > &, const Tensor< Scaler, 1 > &) |
void | set (const tinyxml2::XMLDocument &) |
void | set (const UnscalingLayer &) |
Sets the members of this object to be the members of another object of the same class. More... | |
void | set_inputs_number (const Index &) |
void | set_neurons_number (const Index &) |
virtual void | set_default () |
void | set_descriptives (const Tensor< Descriptives, 1 > &) |
void | set_item_descriptives (const Index &, const Descriptives &) |
void | set_minimum (const Index &, const type &) |
void | set_maximum (const Index &, const type &) |
void | set_mean (const Index &, const type &) |
void | set_standard_deviation (const Index &, const type &) |
void | set_min_max_range (const type min, const type max) |
void | set_scalers (const Tensor< Scaler, 1 > &) |
void | set_scalers (const string &) |
void | set_scalers (const Tensor< string, 1 > &) |
void | set_scalers (const Scaler &) |
void | set_display (const bool &) |
bool | is_empty () const |
Returns true if the number of unscaling neurons is zero, and false otherwise. More... | |
Tensor< type, 2 > | calculate_outputs (const Tensor< type, 2 > &) |
void | check_range (const Tensor< type, 1 > &) const |
void | from_XML (const tinyxml2::XMLDocument &) |
void | write_XML (tinyxml2::XMLPrinter &) const |
string | write_expression (const Tensor< string, 1 > &, const Tensor< string, 1 > &) const |
Returns a string with the expression of the inputs scaling process. More... | |
string | write_expression_c () const |
string | write_expression_python () 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 *, 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 | |
Tensor< Descriptives, 1 > | descriptives |
Descriptives of output variables. More... | |
Tensor< Scaler, 1 > | scalers |
Unscaling method for the output variables. More... | |
type | min_range |
min and max range for unscaling More... | |
type | max_range |
bool | display = true |
Display warning messages to screen. More... | |
Protected Attributes inherited from Layer | |
NonBlockingThreadPool * | non_blocking_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 | |
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... | |
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 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 39 of file unscaling_layer.h.
|
explicit |
Default constructor.
Definition at line 16 of file unscaling_layer.cpp.
|
explicit |
Outputs number constructor.
Definition at line 24 of file unscaling_layer.cpp.
|
explicit |
Outputs descriptives constructor.
Definition at line 32 of file unscaling_layer.cpp.
|
virtual |
Destructor.
Definition at line 40 of file unscaling_layer.cpp.
|
virtual |
Calculates the outputs from the unscaling layer for a given set of inputs to that layer.
inputs | Set of inputs to the unscaling layer. |
Reimplemented from Layer.
Definition at line 692 of file unscaling_layer.cpp.
void check_range | ( | const Tensor< type, 1 > & | 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.
outputs | Set of outptus from the unscaling layer. |
Definition at line 627 of file unscaling_layer.cpp.
|
virtual |
Deserializes a TinyXML document into this unscaling layer object.
document | XML document containing the member data. |
Reimplemented from Layer.
Definition at line 891 of file unscaling_layer.cpp.
Tensor< Descriptives, 1 > get_descriptives | ( | ) | const |
Returns all the available descriptives of the inputs and output variables. The format is a vector of pointers to vectors of size ten:
Definition at line 70 of file unscaling_layer.cpp.
const bool & get_display | ( | ) | 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 265 of file unscaling_layer.cpp.
|
virtual |
Returns the number of inputs.
Reimplemented from Layer.
Definition at line 47 of file unscaling_layer.cpp.
Tensor< type, 1 > get_maximums | ( | ) | 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 97 of file unscaling_layer.cpp.
Tensor< type, 1 > get_minimums | ( | ) | 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 79 of file unscaling_layer.cpp.
|
virtual |
Returns the number of unscaling neurons in this layer.
Reimplemented from Layer.
Definition at line 55 of file unscaling_layer.cpp.
const Tensor< Scaler, 1 > get_unscaling_method | ( | ) | const |
Returns the method used for unscaling (no unscaling, minimum and maximum or mean and standard deviation).
Definition at line 115 of file unscaling_layer.cpp.
bool is_empty | ( | ) | const |
Returns true if the number of unscaling neurons is zero, and false otherwise.
Definition at line 674 of file unscaling_layer.cpp.
void set | ( | ) |
Sets the unscaling layer to be empty.
Definition at line 273 of file unscaling_layer.cpp.
void set | ( | const Index & | new_neurons_number | ) |
Sets a new size in the unscaling layer. It also sets the members to their default values.
Definition at line 298 of file unscaling_layer.cpp.
void set | ( | const Tensor< Descriptives, 1 > & | new_descriptives | ) |
Sets the size of the unscaling layer and the descriptives values.
new_descriptives | Vector 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 315 of file unscaling_layer.cpp.
void set | ( | const Tensor< Descriptives, 1 > & | new_descriptives, |
const Tensor< Scaler, 1 > & | new_scalers | ||
) |
Definition at line 327 of file unscaling_layer.cpp.
void set | ( | const tinyxml2::XMLDocument & | new_unscaling_layer_document | ) |
Sets the unscaling layer members from a XML document.
new_unscaling_layer_document | Pointer to a TinyXML document containing the member data. |
Definition at line 338 of file unscaling_layer.cpp.
void set | ( | const UnscalingLayer & | new_unscaling_layer | ) |
Sets the members of this object to be the members of another object of the same class.
Definition at line 348 of file unscaling_layer.cpp.
|
virtual |
This member sets the default values for the unscaling layer:
Definition at line 368 of file unscaling_layer.cpp.
void set_descriptives | ( | const Tensor< Descriptives, 1 > & | new_descriptives | ) |
Sets the descriptives 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.
new_descriptives | Unscaling neurons descriptives. |
Definition at line 395 of file unscaling_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 617 of file unscaling_layer.cpp.
|
virtual |
Reimplemented from Layer.
Definition at line 283 of file unscaling_layer.cpp.
void set_item_descriptives | ( | const Index & | i, |
const Descriptives & | item_descriptives | ||
) |
Sets the minimum, maximum, mean and standard deviation values of a single unscaling neuron.
i | Index of unscaling neuron. |
item_descriptives | Descriptives values for that neuron. |
Definition at line 426 of file unscaling_layer.cpp.
void set_maximum | ( | const Index & | i, |
const type & | new_maximum | ||
) |
Sets the maximum value of a given unscaling neuron.
i | Index of unscaling neuron. |
new_maximum | Maximum value. |
Definition at line 446 of file unscaling_layer.cpp.
void set_mean | ( | const Index & | i, |
const type & | new_mean | ||
) |
Sets the mean value of a given unscaling neuron.
i | Index of unscaling neuron. |
new_mean | Mean value. |
Definition at line 456 of file unscaling_layer.cpp.
void set_min_max_range | ( | const type | min, |
const type | max | ||
) |
Sets max and min scaling range for minmaxscaling.
min | and max for scaling range. |
Definition at line 384 of file unscaling_layer.cpp.
void set_minimum | ( | const Index & | i, |
const type & | new_minimum | ||
) |
Sets the minimum value of a given unscaling neuron.
i | Index of unscaling neuron. |
new_minimum | Minimum value. |
Definition at line 436 of file unscaling_layer.cpp.
|
virtual |
Reimplemented from Layer.
Definition at line 289 of file unscaling_layer.cpp.
void set_scalers | ( | const Scaler & | new_unscaling_method | ) |
Sets the method to be used for unscaling the variables.
new_unscaling_method | New unscaling method for the variables. |
Definition at line 602 of file unscaling_layer.cpp.
void set_scalers | ( | const string & | new_scaling_methods_string | ) |
Sets the method to be used for unscaling the outputs from the neural network The argument is a string containing the name of the method("NoScaling", "MeanStandardDeviation", "MinimumMaximum" or "Logarithm").
new_unscaling_method | New unscaling method for the output variables. |
Definition at line 485 of file unscaling_layer.cpp.
void set_scalers | ( | const Tensor< Scaler, 1 > & | new_unscaling_method | ) |
Sets the method to be used for unscaling the outputs from the neural network
new_unscaling_method | New unscaling method for the output variables. |
Definition at line 475 of file unscaling_layer.cpp.
void set_scalers | ( | const Tensor< string, 1 > & | new_unscaling_methods_string | ) |
Sets the methods to be used for unscaling each variable. The argument is a vector string containing the name of the methods("NoScaling", "MeanStandardDeviation" or "Logarithm").
new_unscaling_methods_string | New unscaling methods for the variables. |
Definition at line 540 of file unscaling_layer.cpp.
void set_standard_deviation | ( | const Index & | i, |
const type & | new_standard_deviation | ||
) |
Sets the standard deviation value of a given unscaling neuron.
i | Index of unscaling neuron. |
new_standard_deviation | Standard deviation value. |
Definition at line 466 of file unscaling_layer.cpp.
|
virtual |
Returns a string with the expression of the inputs scaling process.
Reimplemented from Layer.
Definition at line 123 of file unscaling_layer.cpp.
|
virtual |
Returns a string with the expression of the unscaling process in this layer.
inputs_names | Name of inputs to the unscaling layer. The size of this vector must be equal to the number of unscaling neurons. |
outputs_names | Name of outputs from the unscaling layer. The size of this vector must be equal to the number of unscaling neurons. |
Reimplemented from Layer.
Definition at line 1085 of file unscaling_layer.cpp.
|
virtual |
Returns a string with the expression of the unscaling process in this layer.
inputs_names | Name of inputs to the unscaling layer. The size of this vector must be equal to the number of unscaling neurons. |
outputs_names | Name of outputs from the unscaling layer. The size of this vector must be equal to the number of unscaling neurons. |
Reimplemented from Layer.
Definition at line 1158 of file unscaling_layer.cpp.
Tensor< string, 1 > write_unscaling_method_text | ( | ) | const |
Returns a string with the name of the method used for unscaling, as paragraph text.
Definition at line 218 of file unscaling_layer.cpp.
Tensor< string, 1 > write_unscaling_methods | ( | ) | const |
Returns a vector of strings with the name of the method used for each unscaling neuron.
Definition at line 171 of file unscaling_layer.cpp.
|
virtual |
Serializes the unscaling 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 789 of file unscaling_layer.cpp.
|
protected |
Descriptives of output variables.
Definition at line 140 of file unscaling_layer.h.
|
protected |
Display warning messages to screen.
Definition at line 153 of file unscaling_layer.h.
|
protected |
Definition at line 149 of file unscaling_layer.h.
|
protected |
min and max range for unscaling
Definition at line 148 of file unscaling_layer.h.
|
protected |
Unscaling method for the output variables.
Definition at line 144 of file unscaling_layer.h.