This class represents the weighted squared error term. More...
#include <weighted_squared_error.h>
Private Attributes | |
type | positives_weight = type(NAN) |
Weight for the positives for the calculation of the error. More... | |
type | negatives_weight = type(NAN) |
Weight for the negatives for the calculation of the error. More... | |
type | normalization_coefficient |
Coefficient of normalization. More... | |
Additional Inherited Members | |
![]() | |
enum class | RegularizationMethod { L1 , L2 , NoRegularization } |
Enumeration of available regularization methods. More... | |
![]() | |
NonBlockingThreadPool * | non_blocking_thread_pool = nullptr |
ThreadPoolDevice * | thread_pool_device = nullptr |
NeuralNetwork * | neural_network_pointer = nullptr |
Pointer to a neural network object. More... | |
DataSet * | data_set_pointer = nullptr |
Pointer to a data set object. More... | |
RegularizationMethod | regularization_method = RegularizationMethod::L2 |
Pointer to a regularization method object. More... | |
type | regularization_weight = static_cast<type>(0.01) |
Regularization weight value. More... | |
bool | display = true |
Display messages to screen. More... | |
const Eigen::array< IndexPair< Index >, 1 > | AT_B = {IndexPair<Index>(0, 0)} |
const Eigen::array< IndexPair< Index >, 1 > | A_B = {IndexPair<Index>(1, 0)} |
const Eigen::array< IndexPair< Index >, 2 > | SSE = {IndexPair<Index>(0, 0), IndexPair<Index>(1, 1)} |
const Eigen::array< int, 1 > | rows_sum = {Eigen::array<int, 1>({1})} |
This class represents the weighted squared error term.
The weighted squared error measures the difference between the outputs from a neural network and the targets in a data set. This functional is used in data modeling problems, such as function regression, classification and time series prediction.
Definition at line 37 of file weighted_squared_error.h.
|
explicit |
Default constructor. It creates a weighted squared error term not associated to any neural network and not measured on any data set. It also initializes all the rest of class members to their default values.
Definition at line 19 of file weighted_squared_error.cpp.
|
explicit |
Neural network and data set constructor. It creates a weighted squared error term object associated to a neural network and measured on a data set. It also initializes all the rest of class members to their default values.
new_neural_network_pointer | Pointer to a neural network object. |
new_data_set_pointer | Pointer to a data set object. |
Definition at line 32 of file weighted_squared_error.cpp.
|
virtual |
Destructor.
Definition at line 41 of file weighted_squared_error.cpp.
|
virtual |
Implements LossIndex.
Definition at line 205 of file weighted_squared_error.cpp.
|
virtual |
Reimplemented from LossIndex.
Definition at line 300 of file weighted_squared_error.cpp.
|
virtual |
Reimplemented from LossIndex.
Definition at line 321 of file weighted_squared_error.cpp.
|
virtual |
Reimplemented from LossIndex.
Definition at line 242 of file weighted_squared_error.cpp.
|
virtual |
Implements LossIndex.
Definition at line 258 of file weighted_squared_error.cpp.
|
virtual |
Reimplemented from LossIndex.
Definition at line 510 of file weighted_squared_error.cpp.
void from_XML | ( | const tinyxml2::XMLDocument & | document | ) |
Loads a weighted squared error object from a XML document.
document | Pointer to a TinyXML document with the object data. |
Definition at line 401 of file weighted_squared_error.cpp.
|
virtual |
Returns a string with the name of the weighted squared error loss type, "WEIGHTED_SQUARED_ERROR".
Reimplemented from LossIndex.
Definition at line 344 of file weighted_squared_error.cpp.
|
virtual |
Returns a string with the name of the weighted squared error loss type in text format.
Reimplemented from LossIndex.
Definition at line 352 of file weighted_squared_error.cpp.
type get_negatives_weight | ( | ) | const |
Returns the weight of the negatives.
Definition at line 56 of file weighted_squared_error.cpp.
type get_normalizaton_coefficient | ( | ) | const |
Definition at line 62 of file weighted_squared_error.cpp.
type get_positives_weight | ( | ) | const |
Returns the weight of the positives.
Definition at line 48 of file weighted_squared_error.cpp.
|
virtual |
set_data_set_pointer
new_data_set_pointer |
Reimplemented from LossIndex.
Definition at line 195 of file weighted_squared_error.cpp.
void set_default | ( | ) |
Set the default values for the object.
Definition at line 70 of file weighted_squared_error.cpp.
void set_negatives_weight | ( | const type & | new_negatives_weight | ) |
Set a new weight for the negatives values.
new_negatives_weight | New weight for the negatives. |
Definition at line 100 of file weighted_squared_error.cpp.
|
virtual |
Calculates of the normalization coefficient with the data of the data set.
Reimplemented from LossIndex.
Definition at line 162 of file weighted_squared_error.cpp.
void set_positives_weight | ( | const type & | new_positives_weight | ) |
Set a new weight for the positives values.
new_positives_weight | New weight for the positives. |
Definition at line 91 of file weighted_squared_error.cpp.
void set_weights | ( | ) |
Calculates of the weights for the positives and negatives values with the data of the data set.
Definition at line 119 of file weighted_squared_error.cpp.
void set_weights | ( | const type & | new_positives_weight, |
const type & | new_negatives_weight | ||
) |
Set new weights for the positives and negatives values.
new_positives_weight | New weight for the positives. |
new_negatives_weight | New weight for the negatives. |
Definition at line 110 of file weighted_squared_error.cpp.
type weighted_sum_squared_error | ( | const Tensor< type, 2 > & | x, |
const Tensor< type, 2 > & | y | ||
) | const |
Definition at line 454 of file weighted_squared_error.cpp.
|
virtual |
Serializes the cross entropy error 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.
file_stream |
Reimplemented from LossIndex.
Definition at line 362 of file weighted_squared_error.cpp.
|
private |
Weight for the negatives for the calculation of the error.
Definition at line 120 of file weighted_squared_error.h.
|
private |
Coefficient of normalization.
Definition at line 124 of file weighted_squared_error.h.
|
private |
Weight for the positives for the calculation of the error.
Definition at line 116 of file weighted_squared_error.h.