OpenNN  2.2
Open Neural Networks Library
normalized_squared_error.h
1 /****************************************************************************************************************/
2 /* */
3 /* OpenNN: Open Neural Networks Library */
4 /* www.artelnics.com/opennn */
5 /* */
6 /* N O R M A L I Z E D S Q U A R E D E R R O R C L A S S H E A D E R */
7 /* */
8 /* Roberto Lopez */
9 /* Artelnics - Making intelligent use of data */
11 /* */
12 /****************************************************************************************************************/
13 
14 #ifndef __NORMALIZEDSQUAREDERROR_H__
15 #define __NORMALIZEDSQUAREDERROR_H__
16 
17 // System includes
18 
19 #include <string>
20 #include <sstream>
21 
22 #include <iostream>
23 #include <fstream>
24 #include <limits>
25 #include <cmath>
26 
27 // OpenNN includes
28 
29 #include "performance_term.h"
30 #include "data_set.h"
31 
32 // TinyXml includes
33 
34 #include "../tinyxml2/tinyxml2.h"
35 
36 namespace OpenNN
37 {
38 
43 
45 {
46 
47 public:
48 
49  // GENERAL CONSTRUCTOR
50 
52 
53  // NEURAL NETWORK CONSTRUCTOR
54 
56 
57  // DATA SET CONSTRUCTOR
58 
60 
61  // DEFAULT CONSTRUCTOR
62 
63  explicit NormalizedSquaredError(void);
64 
65  // XML CONSTRUCTOR
66 
67  explicit NormalizedSquaredError(const tinyxml2::XMLDocument&);
68 
69  // DESTRUCTOR
70 
71  virtual ~NormalizedSquaredError(void);
72 
73  // METHODS
74 
75  // Get methods
76 
77  // Set methods
78 
79  // Normalization coefficients
80 
82 
83  // Checking methods
84 
85  void check(void) const;
86 
87  // performance methods
88 
89  double calculate_performance(void) const;
92 
93  double calculate_performance(const Vector<double>&) const;
94 
95  double calculate_generalization_performance(void) const;
96 
97  // Objective terms methods
98 
99  Vector<double> calculate_terms(void) const;
101 
103 
105 
106  // Squared errors methods
107 
109 
110  Vector<size_t> calculate_maximal_errors(const size_t& = 10) const;
111 
112  std::string write_performance_term_type(void) const;
113 
114  // Serialization methods
115 
116  tinyxml2::XMLDocument* to_XML(void) const;
117 
118  void from_XML(const tinyxml2::XMLDocument&);
119 
120  std::string write_information(void) const;
121 
122 
123 private:
124 
125  // MEMBERS
126 
128 
130 };
131 
132 }
133 
134 #endif
135 
136 
137 // OpenNN: Open Neural Networks Library.
138 // Copyright (c) 2005-2015 Roberto Lopez.
139 //
140 // This library is free software; you can redistribute it and/or
141 // modify it under the terms of the GNU Lesser General Public
142 // License as published by the Free Software Foundation; either
143 // version 2.1 of the License, or any later version.
144 //
145 // This library is distributed in the hope that it will be useful,
146 // but WITHOUT ANY WARRANTY; without even the implied warranty of
147 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
148 // Lesser General Public License for more details.
149 
150 // You should have received a copy of the GNU Lesser General Public
151 // License along with this library; if not, write to the Free Software
152 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
153 
double calculate_normalization_coefficient(const Matrix< double > &, const Vector< double > &) const
Vector< size_t > calculate_maximal_errors(const size_t &=10) const
Matrix< double > calculate_Hessian(void) const
double calculate_generalization_performance(void) const
Returns an performance of the performance term for generalization purposes.
tinyxml2::XMLDocument * to_XML(void) const
virtual ~NormalizedSquaredError(void)
Destructor.
void from_XML(const tinyxml2::XMLDocument &)
PerformanceTerm::FirstOrderTerms calculate_first_order_terms(void) const
Matrix< double > calculate_terms_Jacobian(void) const
Vector< double > training_target_mean
Mean values of all the target variables.
double calculate_performance(void) const
Returns the performance value of a neural network according to the normalized squared error on a data...
Vector< double > calculate_squared_errors(void) const
Returns the squared errors of the training instances.
std::string write_performance_term_type(void) const
Returns a string with the name of the normalized squared error performance type, "NORMALIZED_SQUARED_...
Vector< double > calculate_gradient(void) const
Vector< double > calculate_terms(void) const