00001 /****************************************************************************************************************/ 00002 /* */ 00003 /* OpenNN: Open Neural Networks Library */ 00004 /* www.opennn.cimne.com */ 00005 /* */ 00006 /* 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 */ 00007 /* */ 00008 /* Roberto Lopez */ 00009 /* International Center for Numerical Methods in Engineering (CIMNE) */ 00010 /* Technical University of Catalonia (UPC) */ 00011 /* Barcelona, Spain */ 00012 /* E-mail: rlopez@cimne.upc.edu */ 00013 /* */ 00014 /****************************************************************************************************************/ 00015 00016 #ifndef __INDEPENDENTPARAMETERSERROR_H__ 00017 #define __INDEPENDENTPARAMETERSERROR_H__ 00018 00019 // OpenNN includes 00020 00021 #include "../mathematical_model/mathematical_model.h" 00022 00023 #include "performance_functional.h" 00024 00025 namespace OpenNN 00026 { 00027 00031 00032 class IndependentParametersError : public PerformanceTerm 00033 { 00034 00035 public: 00036 00037 // DEFAULT CONSTRUCTOR 00038 00039 explicit IndependentParametersError(void); 00040 00041 // NEURAL NETWORK CONSTRUCTOR 00042 00043 explicit IndependentParametersError(NeuralNetwork*); 00044 00045 // XML CONSTRUCTOR 00046 00047 explicit IndependentParametersError(TiXmlElement*); 00048 00049 // DESTRUCTOR 00050 00051 virtual ~IndependentParametersError(void); 00052 00053 // ASSIGNMENT OPERATOR 00054 00055 IndependentParametersError& operator = (const IndependentParametersError&); 00056 00057 // EQUAL TO OPERATOR 00058 00059 bool operator == (const IndependentParametersError&) const; 00060 00061 // METHODS 00062 00063 // Get methods 00064 00065 const Vector<double>& get_target_independent_parameters(void) const; 00066 const double& get_target_independent_parameter(const unsigned int&) const; 00067 00068 const Vector<double>& get_independent_parameters_errors_weights(void) const; 00069 const double& get_independent_parameter_error_weight(const unsigned int&) const; 00070 00071 // Set methods 00072 00073 void set_target_independent_parameters(const Vector<double>&); 00074 void set_target_independent_parameter(const unsigned int&, const double&); 00075 00076 void set_independent_parameters_errors_weights(const Vector<double>&); 00077 void set_independent_parameter_error_weight(const unsigned int&, const double&); 00078 00079 void set_default(void); 00080 00081 // Checking methods 00082 00083 void check(void) const; 00084 00085 // Evaluation methods 00086 00087 double calculate_evaluation(void) const; 00088 double calculate_evaluation(const Vector<double>&) const; 00089 00090 Vector<double> calculate_gradient(void) const; 00091 Matrix<double> calculate_Hessian(void) const; 00092 00093 std::string write_performance_term_type(void) const; 00094 00095 std::string write_information(void) const; 00096 00097 // Serialization methods 00098 00099 TiXmlElement* to_XML(void) const; 00100 00101 void from_XML(TiXmlElement*); 00102 00103 private: 00104 00106 00107 Vector<double> target_independent_parameters; 00108 00110 00111 Vector<double> independent_parameters_errors_weights; 00112 00113 }; 00114 00115 } 00116 00117 #endif 00118 00119 00120 // OpenNN: Open Neural Networks Library. 00121 // Copyright (C) 2005-2012 Roberto Lopez 00122 // 00123 // This library is free software; you can redistribute it and/or 00124 // modify it under the terms of the GNU Lesser General Public 00125 // License as published by the Free Software Foundation; either 00126 // version 2.1 of the License, or any later version. 00127 // 00128 // This library is distributed in the hope that it will be useful, 00129 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00130 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00131 // Lesser General Public License for more details. 00132 00133 // You should have received a copy of the GNU Lesser General Public 00134 // License along with this library; if not, write to the Free Software 00135 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA