00001 /****************************************************************************************************************/ 00002 /* */ 00003 /* OpenNN: Open Neural Networks Library */ 00004 /* www.opennn.cimne.com */ 00005 /* */ 00006 /* F U N C T I O N R E G R E S S I O N T E S T I N G 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 __FUNCTIONREGRESSIONTESTING_H__ 00017 #define __FUNCTIONREGRESSIONTESTING_H__ 00018 00019 // OpenNN includes 00020 00021 #include "../utilities/vector.h" 00022 #include "../utilities/matrix.h" 00023 00024 #include "../data_set/data_set.h" 00025 00026 #include "../neural_network/neural_network.h" 00027 00028 namespace OpenNN 00029 { 00030 00033 00034 class FunctionRegressionTesting 00035 { 00036 00037 public: 00038 00039 // DEFAULT CONSTRUCTOR 00040 00041 explicit FunctionRegressionTesting(void); 00042 00043 // NEURAL NETWORK CONSTRUCTOR 00044 00045 explicit FunctionRegressionTesting(NeuralNetwork*); 00046 00047 // DATA SET CONSTRUCTOR 00048 00049 explicit FunctionRegressionTesting(DataSet*); 00050 00051 // GENERAL CONSTRUCTOR 00052 00053 explicit FunctionRegressionTesting(NeuralNetwork*, DataSet*); 00054 00055 // XML CONSTRUCTOR 00056 00057 explicit FunctionRegressionTesting(TiXmlElement*); 00058 00059 // DESTRUCTOR 00060 00061 virtual ~FunctionRegressionTesting(void); 00062 00063 // STRUCTURES 00064 00068 00069 struct LinearRegressionAnalysisResults 00070 { 00072 00073 Vector< Vector<double> > linear_regression_parameters; 00074 00076 00077 Vector< Matrix<double> > scaled_target_output_data; 00078 00079 void save(const std::string&) const; 00080 }; 00081 00082 // METHODS 00083 00084 // Get methods 00085 00086 NeuralNetwork* get_neural_network_pointer(void) const; 00087 DataSet* get_data_set_pointer(void) const; 00088 00089 const bool& get_display(void) const; 00090 00091 // Set methods 00092 00093 void set_neural_network_pointer(NeuralNetwork*); 00094 void set_data_set_pointer(DataSet*); 00095 00096 void set_display(const bool&); 00097 00098 void set_default(void); 00099 00100 void check(void) const; 00101 00102 // Testing targets outputs data methods 00103 00104 Vector< Matrix<double> > calculate_scaled_target_output_data(void) const; 00105 00106 // Linear regression parameters methods 00107 00108 Vector< Vector<double> > calculate_linear_regression_parameters(void) const; 00109 00110 // Linear regression analysis methods 00111 00112 LinearRegressionAnalysisResults perform_linear_regression_analysis(void) const; 00113 00114 // Error data methods 00115 00116 Vector< Matrix<double> > calculate_error_data(void) const; 00117 00118 Vector< Vector< Vector<double> > > calculate_error_data_statistics(void) const; 00119 00120 Vector< Vector< Vector<double> > > calculate_error_data_histogram(const unsigned int&) const; 00121 Vector< Vector< Vector<double> > > calculate_error_data_histogram(void) const; 00122 00123 // Serialization methods 00124 00125 std::string to_string(void) const; 00126 00127 virtual TiXmlElement* to_XML(void) const; 00128 virtual void from_XML(TiXmlElement*); 00129 00130 // HTML methods 00131 00132 // TiXmlElement* perform_linear_regression_analysis_XML(void) const; 00133 00134 // TiXmlElement* calculate_error_data_XML(void) const; 00135 // TiXmlElement* calculate_error_data_statistics_XML(void) const; 00136 // TiXmlElement* calculate_error_data_histogram_XML(void) const; 00137 00138 private: 00139 00141 00142 NeuralNetwork* neural_network_pointer; 00143 00145 00146 DataSet* data_set_pointer; 00147 00149 00150 bool display; 00151 }; 00152 00153 } 00154 00155 #endif 00156 00157 // OpenNN: Open Neural Networks Library. 00158 // Copyright (C) 2005-2012 Roberto Lopez 00159 // 00160 // This library is free software; you can redistribute it and/or 00161 // modify it under the terms of the GNU Lesser General Public 00162 // License as published by the Free Software Foundation; either 00163 // version 2.1 of the License, or any later version. 00164 // 00165 // This library is distributed in the hope that it will be useful, 00166 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00167 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00168 // Lesser General Public License for more details. 00169 00170 // You should have received a copy of the GNU Lesser General Public 00171 // License along with this library; if not, write to the Free Software 00172 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA