Marsyas
0.6.0-alpha
|
00001 /* 00002 ** Copyright (C) 1998-2010 George Tzanetakis <gtzan@cs.uvic.ca> 00003 ** 00004 ** This program is free software; you can redistribute it and/or modify 00005 ** it under the terms of the GNU General Public License as published by 00006 ** the Free Software Foundation; either version 2 of the License, or 00007 ** (at your option) any later version. 00008 ** 00009 ** This program is distributed in the hope that it will be useful, 00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 ** GNU General Public License for more details. 00013 ** 00014 ** You should have received a copy of the GNU General Public License 00015 ** along with this program; if not, write to the Free Software 00016 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00038 #ifndef MARSYAS_CLASSIFICATIONREPORT_H 00039 #define MARSYAS_CLASSIFICATIONREPORT_H 00040 00041 #include <marsyas/system/MarSystem.h> 00042 00043 00044 namespace Marsyas 00045 { 00046 00047 //Some statistical information computed by computeSummaryStatistics 00048 typedef struct 00049 { 00050 mrs_natural instances; 00051 mrs_natural correctInstances; 00052 mrs_real kappa; 00053 mrs_real meanAbsoluteError; 00054 mrs_real rootMeanSquaredError; 00055 mrs_real relativeAbsoluteError; 00056 mrs_real rootRelativeSquaredError; 00057 } summaryStatistics; 00058 00059 typedef struct 00060 { 00061 // rewritten from weka: 00062 // https://svn.scms.waikato.ac.nz/svn/weka/trunk/weka/src/main/java/weka/classifiers/Evaluation.java 00063 mrs_real sumClass; 00064 mrs_real sumSqrClass; 00065 mrs_real sumClassPredicted; 00066 mrs_real sumPredicted; 00067 mrs_real sumSqrPredicted; 00068 mrs_real withClass; 00069 } RegressionCorrelationCalculate; 00070 00071 class ClassificationReport: public MarSystem 00072 { 00073 private: 00074 void addControls(); 00075 void myUpdate(MarControlPtr sender); 00076 00077 realvec confusionMatrix; 00078 std::string classNames; 00079 00080 summaryStatistics computeSummaryStatistics(const realvec& mat); 00081 RegressionCorrelationCalculate regCorr; 00082 00083 public: 00084 ClassificationReport(std::string name); 00085 ~ClassificationReport(); 00086 MarSystem* clone()const; 00087 00088 void myProcess(realvec& in, realvec& out); 00089 };//class ClassificationReport 00090 }//namespace Marsyas 00091 #endif