mean_squared_error.h
1// OpenNN: Open Neural Networks Library
2// www.opennn.net
3//
4// M E A N S Q U A R E D E R R O R C L A S S H E A D E R
5//
6// Artificial Intelligence Techniques SL
7// artelnics@artelnics.com
8
9#ifndef MEANSQUAREDERROR_H
10#define MEANSQUAREDERROR_H
11
12// System includes
13
14#include <string>
15#include <sstream>
16#include <iostream>
17#include <fstream>
18#include <limits>
19#include <math.h>
20
21// OpenNN includes
22
23#include "config.h"
24#include "loss_index.h"
25#include "data_set.h"
26
27namespace OpenNN
28{
29
31
36
38{
39
40public:
41
42 // DEFAULT CONSTRUCTOR
43
44 explicit MeanSquaredError();
45
47
48 // Destructor
49
50 virtual ~MeanSquaredError();
51
52 // Back propagation
53
54 void calculate_error(const DataSetBatch&,
57
58 void calculate_output_delta(const DataSetBatch&,
61
62 // Back propagation LM
63
64 void calculate_error_lm(const DataSetBatch&,
67
68 void calculate_output_delta_lm(const DataSetBatch&,
71
72 void calculate_error_gradient_lm(const DataSetBatch&,
74
75 void calculate_error_hessian_lm(const DataSetBatch&,
77
78 // Serialization methods
79
80 void write_XML(tinyxml2::XMLPrinter &) const;
81
82 string get_error_type() const;
83 string get_error_type_text() const;
84
85#ifdef OPENNN_CUDA
86 #include "../../opennn-cuda/opennn-cuda/mean_squared_error_cuda.h"
87#endif
88
89};
90
91}
92
93#endif
94
95
96// OpenNN: Open Neural Networks Library.
97// Copyright(C) 2005-2021 Artificial Intelligence Techniques, SL.
98//
99// This library is free software; you can redistribute it and/or
100// modify it under the terms of the GNU Lesser General Public
101// License as published by the Free Software Foundation; either
102// version 2.1 of the License, or any later version.
103//
104// This library is distributed in the hope that it will be useful,
105// but WITHOUT ANY WARRANTY; without even the implied warranty of
106// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
107// Lesser General Public License for more details.
108
109// You should have received a copy of the GNU Lesser General Public
110// License along with this library; if not, write to the Free Software
111// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
This class represents the concept of data set for data modelling problems, such as approximation,...
Definition: data_set.h:57
This abstract class represents the concept of loss index composed of an error term and a regularizati...
Definition: loss_index.h:48
This class represents the mean squared error term.
virtual ~MeanSquaredError()
Destructor.
void calculate_error(const DataSetBatch &, const NeuralNetworkForwardPropagation &, LossIndexBackPropagation &) const
MeanSquaredError::calculate_error.
string get_error_type() const
Returns a string with the name of the mean squared error loss type, "MEAN_SQUARED_ERROR".
void write_XML(tinyxml2::XMLPrinter &) const
string get_error_type_text() const
Returns a string with the name of the mean squared error loss type in text format.
A loss index composed of several terms, this structure represent the First Order for this function.
Definition: loss_index.h:383