00001 /****************************************************************************************************************/ 00002 /* */ 00003 /* Flood: An Open Source Neural Networks C++ Library */ 00004 /* www.cimne.com/flood */ 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 00017 #ifndef __MINKOWSKIERROR_H__ 00018 #define __MINKOWSKIERROR_H__ 00019 00020 #include "ObjectiveFunctional.h" 00021 #include "../Utilities/InputTargetDataSet.h" 00022 00023 namespace Flood 00024 { 00025 00028 00029 class MinkowskiError : public ObjectiveFunctional 00030 { 00031 00032 public: 00033 00034 // DEFAULT CONSTRUCTOR 00035 00036 explicit MinkowskiError(void); 00037 00038 // MULTILAYER PERCEPTRON CONSTRUCTOR 00039 00040 explicit MinkowskiError(MultilayerPerceptron*); 00041 00042 // INPUT-TARGET DATA SET CONSTRUCTOR 00043 00044 explicit MinkowskiError(InputTargetDataSet*); 00045 00046 // GENERAL CONSTRUCTOR 00047 00048 explicit MinkowskiError(MultilayerPerceptron*, InputTargetDataSet*); 00049 00050 // DESTRUCTOR 00051 00052 virtual ~MinkowskiError(void); 00053 00054 00055 // METHODS 00056 00057 // Get methods 00058 00060 00061 inline InputTargetDataSet* get_input_target_data_set_pointer(void) 00062 { 00063 return(input_target_data_set_pointer); 00064 } 00065 00066 double get_Minkowski_parameter(void); 00067 00068 // Set methods 00069 00070 void set(void); 00071 void set(MultilayerPerceptron*); 00072 void set(InputTargetDataSet*); 00073 void set(MultilayerPerceptron*, InputTargetDataSet*); 00074 00075 void set_input_target_data_set_pointer(InputTargetDataSet*); 00076 00077 void set_Minkowski_parameter(double); 00078 00079 // Objective functional evaluation methods 00080 00081 double calculate_objective(void); 00082 00083 // Validation error methods 00084 00085 double calculate_validation_error(void); 00086 00087 // Objective function gradient vector methods 00088 00089 Vector<double> calculate_output_errors(const Vector< Vector<double> >&, const Vector<double>&); 00090 Vector< Vector<double> > calculate_hidden_errors(const Vector< Vector<double> >&, const Vector<double>&); 00091 Vector<double> calculate_hidden_layers_error_gradient(const Vector<double>&, const Vector< Vector<double> >&, const Vector< Vector<double> >&); 00092 Vector<double> calculate_output_layer_error_gradient(const Vector< Vector<double> >&, const Vector<double>&); 00093 00094 Vector<double> calculate_objective_gradient(void); 00095 00096 // Utility methods 00097 00098 std::string to_XML(bool); 00099 void load(const char*); 00100 00101 private: 00102 00103 // MEMBERS 00104 00106 00107 InputTargetDataSet* input_target_data_set_pointer; 00108 00110 00111 double Minkowski_parameter; 00112 00113 }; 00114 00115 } 00116 00117 #endif 00118 00119 00120 // Flood: An Open Source Neural Networks C++ Library. 00121 // Copyright (C) 2005-2010 Roberto Lopez 00122 // 00123 // This library is free software; you can redistribute it and/or 00124 // modify it under the s 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