00001 /****************************************************************************************************************/ 00002 /* */ 00003 /* OpenNN: Open Neural Networks Library */ 00004 /* www.opennn.cimne.com */ 00005 /* */ 00006 /* P A T T E R N R E C O G N I T 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 __PATTERNRECOGNITIONTESTING_H__ 00017 #define __PATTERNRECOGNITIONTESTING_H__ 00018 00019 // System includes 00020 00021 #include "../utilities/vector.h" 00022 #include "../utilities/matrix.h" 00023 #include "../data_set/data_set.h" 00024 00025 #include "../neural_network/neural_network.h" 00026 00027 namespace OpenNN 00028 { 00029 00032 00033 class PatternRecognitionTesting 00034 { 00035 00036 public: 00037 00038 // DEFAULT CONSTRUCTOR 00039 00040 explicit PatternRecognitionTesting(void); 00041 00042 // NEURAL NETWORK CONSTRUCTOR 00043 00044 explicit PatternRecognitionTesting(NeuralNetwork*); 00045 00046 // DATA SET CONSTRUCTOR 00047 00048 explicit PatternRecognitionTesting(DataSet*); 00049 00050 // GENERAL CONSTRUCTOR 00051 00052 explicit PatternRecognitionTesting(NeuralNetwork*, DataSet*); 00053 00054 // XML CONSTRUCTOR 00055 00056 explicit PatternRecognitionTesting(TiXmlElement*); 00057 00058 // DESTRUCTOR 00059 00060 virtual ~PatternRecognitionTesting(void); 00061 00063 00064 // METHODS 00065 00066 // Get methods 00067 00068 NeuralNetwork* get_neural_network_pointer(void) const; 00069 DataSet* get_data_set_pointer(void) const; 00070 00071 const bool& get_display(void) const; 00072 00073 // Set methods 00074 00075 void set_neural_network_pointer(NeuralNetwork*); 00076 void set_data_set_pointer(DataSet*); 00077 00078 void set_display(const bool&); 00079 00080 void set_default(void); 00081 00082 // Output data methods 00083 00084 Matrix<bool> calculate_binary_output_data(void) const; 00085 00086 Matrix<bool> calculate_binary_training_output_data(void) const; 00087 Matrix<bool> calculate_binary_generalization_output_data(void) const; 00088 Matrix<bool> calculate_binary_testing_output_data(void) const; 00089 00090 // Target data methods 00091 00092 Matrix<bool> calculate_binary_target_data(void) const; 00093 00094 Matrix<bool> calculate_binary_training_target_data(void) const; 00095 Matrix<bool> calculate_binary_generalization_target_data(void) const; 00096 Matrix<bool> calculate_binary_testing_target_data(void) const; 00097 00098 // Test methods 00099 00100 Vector<double> calculate_binary_classification_test(void) const; 00101 00102 Matrix<unsigned int> calculate_confusion(void) const; 00103 00104 void save_binary_classification_test(const std::string&) const; 00105 void save_confusion(const std::string&) const; 00106 00107 // Serialization methods 00108 00109 std::string to_string(void) const; 00110 00111 virtual TiXmlElement* to_XML(void) const; 00112 virtual void from_XML(TiXmlElement*); 00113 00114 00115 private: 00116 00118 00119 NeuralNetwork* neural_network_pointer; 00120 00122 00123 DataSet* data_set_pointer; 00124 00126 00127 bool display; 00128 }; 00129 00130 } 00131 00132 #endif 00133 00134 // OpenNN: Open Neural Networks Library. 00135 // Copyright (C) 2005-2012 Roberto Lopez 00136 // 00137 // This library is free software; you can redistribute it and/or 00138 // modify it under the terms of the GNU Lesser General Public 00139 // License as published by the Free Software Foundation; either 00140 // version 2.1 of the License, or any later version. 00141 // 00142 // This library is distributed in the hope that it will be useful, 00143 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00144 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00145 // Lesser General Public License for more details. 00146 00147 // You should have received a copy of the GNU Lesser General Public 00148 // License along with this library; if not, write to the Free Software 00149 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00150