00001 /****************************************************************************************************************/ 00002 /* */ 00003 /* Flood: An Open Source Neural Networks C++ Library */ 00004 /* www.cimne.com/flood */ 00005 /* */ 00006 /* P A T T E R N R E C O G N I T I O N U T I L I T I E S 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 __PATTERNRECOGNITIONUTILITIES_H__ 00017 #define __PATTERNRECOGNITIONUTILITIES_H__ 00018 00019 // System includes 00020 00021 #include "../Utilities/Vector.h" 00022 #include "../Utilities/Matrix.h" 00023 #include "../Utilities/InputTargetDataSet.h" 00024 #include "../MultilayerPerceptron/MultilayerPerceptron.h" 00025 00026 namespace Flood 00027 { 00028 00031 00032 class PatternRecognitionUtilities 00033 { 00034 00035 public: 00036 00037 // DEFAULT CONSTRUCTOR 00038 00039 explicit PatternRecognitionUtilities(void); 00040 00041 // MULTILAYER PERCEPTRON CONSTRUCTOR 00042 00043 explicit PatternRecognitionUtilities(MultilayerPerceptron*); 00044 00045 // INPUT-TARGET DATA SET CONSTRUCTOR 00046 00047 explicit PatternRecognitionUtilities(InputTargetDataSet*); 00048 00049 // GENERAL CONSTRUCTOR 00050 00051 explicit PatternRecognitionUtilities(MultilayerPerceptron*, InputTargetDataSet*); 00052 00053 // DESTRUCTOR 00054 00055 virtual ~PatternRecognitionUtilities(void); 00056 00057 00058 // METHODS 00059 00060 // Get methods 00061 00062 MultilayerPerceptron* get_multilayer_perceptron_pointer(void); 00063 InputTargetDataSet* get_input_target_data_set_pointer(void); 00064 00065 bool get_display(void); 00066 00067 // Set methods 00068 00069 void set_multilayer_perceptron_pointer(MultilayerPerceptron*); 00070 void set_input_target_data_set_pointer(InputTargetDataSet*); 00071 00072 void set_display(bool); 00073 00074 // Arfificial data generators 00075 00076 void generate_artificial_data(const Vector< Vector<double> >&, const Vector< Vector<double> >&, const Vector<double>&); 00077 00078 // Output data methods 00079 00080 Matrix<bool> calculate_binary_output_data(void); 00081 00082 Matrix<bool> calculate_binary_training_output_data(void); 00083 Matrix<bool> calculate_binary_validation_output_data(void); 00084 Matrix<bool> calculate_binary_testing_output_data(void); 00085 00086 // Target data methods 00087 00088 Matrix<bool> get_binary_target_data(void); 00089 00090 Matrix<bool> get_binary_training_target_data(void); 00091 Matrix<bool> get_binary_validation_target_data(void); 00092 Matrix<bool> get_binary_testing_target_data(void); 00093 00094 // Class distribution methods 00095 00096 Vector<int> calculate_class_distribution(void); 00097 std::string get_class_distribution_XML(bool); 00098 void print_class_distribution(void); 00099 void save_class_distribution(const char*); 00100 00101 // Binary classification test methods 00102 00103 Vector<double> calculate_binary_classification_test(void); 00104 std::string get_binary_classification_test_XML(bool); 00105 void print_binary_classification_test(void); 00106 void save_binary_classification_test(const char*); 00107 00108 // Confusion matrix methods 00109 00110 Matrix<int> calculate_confusion(void); 00111 std::string get_confusion_XML(bool); 00112 void print_confusion(void); 00113 void save_confusion(const char*); 00114 00115 00116 private: 00117 00118 // FIELDS 00119 00121 00122 MultilayerPerceptron* multilayer_perceptron_pointer; 00123 00125 00126 InputTargetDataSet* input_target_data_set_pointer; 00127 00129 00130 bool display; 00131 }; 00132 00133 } 00134 00135 #endif 00136 00137 // Flood: An Open Source Neural Networks C++ Library. 00138 // Copyright (C) 2005-2010 Roberto Lopez 00139 // 00140 // This library is free software; you can redistribute it and/or 00141 // modify it under the s of the GNU Lesser General Public 00142 // License as published by the Free Software Foundation; either 00143 // version 2.1 of the License, or any later version. 00144 // 00145 // This library is distributed in the hope that it will be useful, 00146 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00147 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00148 // Lesser General Public License for more details. 00149 00150 // You should have received a copy of the GNU Lesser General Public 00151 // License along with this library; if not, write to the Free Software 00152 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA