OpenNN  2.2
Open Neural Networks Library
independent_parameters_error.h
1 /****************************************************************************************************************/
2 /* */
3 /* OpenNN: Open Neural Networks Library */
4 /* www.artelnics.com/opennn */
5 /* */
6 /* I N D E P E N D E N T P A R A M E T E R S 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 __INDEPENDENTPARAMETERSERROR_H__
15 #define __INDEPENDENTPARAMETERSERROR_H__
16 
17 // System includes
18 
19 #include <iostream>
20 #include <fstream>
21 #include <cmath>
22 #include <sstream>
23 #include <string>
24 #include <limits>
25 
26 // OpenNN includes
27 
28 #include "mathematical_model.h"
29 
30 #include "performance_term.h"
31 
32 // TinyXml includes
33 
34 #include "../tinyxml2/tinyxml2.h"
35 
36 namespace OpenNN
37 {
38 
42 
44 {
45 
46 public:
47 
48  // DEFAULT CONSTRUCTOR
49 
50  explicit IndependentParametersError(void);
51 
52  // NEURAL NETWORK CONSTRUCTOR
53 
55 
56  // XML CONSTRUCTOR
57 
58  explicit IndependentParametersError(const tinyxml2::XMLDocument&);
59 
60  // DESTRUCTOR
61 
62  virtual ~IndependentParametersError(void);
63 
64  // ASSIGNMENT OPERATOR
65 
67 
68  // EQUAL TO OPERATOR
69 
70  bool operator == (const IndependentParametersError&) const;
71 
72  // METHODS
73 
74  // Get methods
75 
77  const double& get_target_independent_parameter(const size_t&) const;
78 
80  const double& get_independent_parameter_error_weight(const size_t&) const;
81 
82  // Set methods
83 
85  void set_target_independent_parameter(const size_t&, const double&);
86 
88  void set_independent_parameter_error_weight(const size_t&, const double&);
89 
90  void set_default(void);
91 
92  // Checking methods
93 
94  void check(void) const;
95 
96  // performance methods
97 
98  double calculate_performance(void) const;
99  double calculate_performance(const Vector<double>&) const;
100 
101  Vector<double> calculate_gradient(void) const;
102  Matrix<double> calculate_Hessian(void) const;
103 
104  std::string write_performance_term_type(void) const;
105 
106  std::string write_information(void) const;
107 
108  // Serialization methods
109 
110  tinyxml2::XMLDocument* to_XML(void) const;
111 
112  void from_XML(const tinyxml2::XMLDocument&);
113 
114 private:
115 
117 
119 
121 
123 
124 };
125 
126 }
127 
128 #endif
129 
130 
131 // OpenNN: Open Neural Networks Library.
132 // Copyright (c) 2005-2015 Roberto Lopez.
133 //
134 // This library is free software; you can redistribute it and/or
135 // modify it under the terms of the GNU Lesser General Public
136 // License as published by the Free Software Foundation; either
137 // version 2.1 of the License, or any later version.
138 //
139 // This library is distributed in the hope that it will be useful,
140 // but WITHOUT ANY WARRANTY; without even the implied warranty of
141 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
142 // Lesser General Public License for more details.
143 
144 // You should have received a copy of the GNU Lesser General Public
145 // License along with this library; if not, write to the Free Software
146 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
const Vector< double > & get_independent_parameters_errors_weights(void) const
Returns the weight for each error between the actual independent parameters and their target values...
Matrix< double > calculate_Hessian(void) const
Returns the performance term Hessian.
std::string write_performance_term_type(void) const
Returns a string with the name of the independent parameters error performance type, "INDEPENDENT_PARAMETERS_ERROR".
void set_target_independent_parameter(const size_t &, const double &)
const Vector< double > & get_target_independent_parameters(void) const
Returns the desired values for the independent parameter.
const double & get_independent_parameter_error_weight(const size_t &) const
void set_independent_parameter_error_weight(const size_t &, const double &)
double calculate_performance(void) const
Returns the dot product between the independent parameters vector and its targets vector...
Vector< double > independent_parameters_errors_weights
Weight for each error between the actual independent parameters and their target values.
void set_target_independent_parameters(const Vector< double > &)
void set_independent_parameters_errors_weights(const Vector< double > &)
Vector< double > target_independent_parameters
Desired independent parameter values.
Vector< double > calculate_gradient(void) const
Returns the performance term gradient.
tinyxml2::XMLDocument * to_XML(void) const
const double & get_target_independent_parameter(const size_t &) const
bool operator==(const IndependentParametersError &) const
Equal to operator.
IndependentParametersError & operator=(const IndependentParametersError &)
Assignment operator.
void from_XML(const tinyxml2::XMLDocument &)