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