00001 /****************************************************************************************************************/ 00002 /* */ 00003 /* OpenNN: Open Neural Networks Library */ 00004 /* www.opennn.cimne.com */ 00005 /* */ 00006 /* R O O T 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 */ 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 __ROOTMEANSQUAREDERROR_H__ 00017 #define __ROOTMEANSQUAREDERROR_H__ 00018 00019 #include "performance_functional.h" 00020 #include "../data_set/data_set.h" 00021 00022 namespace OpenNN 00023 { 00024 00028 00029 class RootMeanSquaredError : public PerformanceTerm 00030 { 00031 00032 public: 00033 00034 // DEFAULT CONSTRUCTOR 00035 00036 explicit RootMeanSquaredError(void); 00037 00038 // NEURAL NETWORK CONSTRUCTOR 00039 00040 explicit RootMeanSquaredError(NeuralNetwork*); 00041 00042 // DATA SET CONSTRUCTOR 00043 00044 explicit RootMeanSquaredError(DataSet*); 00045 00046 // GENERAL CONSTRUCTOR 00047 00048 explicit RootMeanSquaredError(NeuralNetwork*, DataSet*); 00049 00050 // XML CONSTRUCTOR 00051 00052 explicit RootMeanSquaredError(TiXmlElement*); 00053 00054 // DESTRUCTOR 00055 00056 virtual ~RootMeanSquaredError(void); 00057 00058 // METHODS 00059 00060 // Get methods 00061 00062 // Set methods 00063 00064 // Checking methods 00065 00066 void check(void) const; 00067 00068 // Performance term evaluation methods 00069 00070 double calculate_evaluation(void) const; 00071 double calculate_evaluation(const Vector<double>&) const; 00072 double calculate_generalization_evaluation(void) const; 00073 00074 Vector<double> calculate_gradient(void) const; 00075 00076 Matrix<double> calculate_Hessian(void) const; 00077 00078 std::string write_performance_term_type(void) const; 00079 00080 // Serialization methods 00081 00082 TiXmlElement* to_XML(void) const; 00083 void from_XML(TiXmlElement*); 00084 00085 }; 00086 00087 } 00088 00089 #endif 00090 00091 00092 // OpenNN: Open Neural Networks Library. 00093 // Copyright (C) 2005-2012 Roberto Lopez 00094 // 00095 // This library is free software; you can redistribute it and/or 00096 // modify it under the terms of the GNU Lesser General Public 00097 // License as published by the Free Software Foundation; either 00098 // version 2.1 of the License, or any later version. 00099 // 00100 // This library is distributed in the hope that it will be useful, 00101 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00102 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00103 // Lesser General Public License for more details. 00104 // 00105 // You should have received a copy of the GNU Lesser General Public 00106 // License along with this library; if not, write to the Free Software 00107 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA