00001 /* 00002 * This file is part of MultiBoost, a multi-class 00003 * AdaBoost learner/classifier 00004 * 00005 * Copyright (C) 2005 Norman Casagrande 00006 * For informations write to nova77@gmail.com 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 * 00022 */ 00023 00028 #ifndef __OUTPUT_INFO_H 00029 #define __OUTPUT_INFO_H 00030 00031 #include <fstream> 00032 #include <string> 00033 #include <vector> 00034 #include <map> 00035 00036 #include "IO/InputData.h" 00037 #include "WeakLearners/BaseLearner.h" 00038 00039 using namespace std; 00040 00041 namespace MultiBoost { 00042 00045 00058 class OutputInfo 00059 { 00060 public: 00061 00068 OutputInfo(const string& outputInfoFile); 00069 00075 void outputIteration(const int t); 00076 00097 void outputError(InputData* pData, BaseLearner* pWeakHypothesis); 00098 00123 void outputMargins(InputData* pData, BaseLearner* pWeakHypothesis); 00124 00135 void outputEdge(InputData* pData, BaseLearner* pWeakHypothesis); 00136 00142 void endLine() { _outStream << endl; } 00143 00144 protected: 00145 00156 typedef vector< vector<double> > table; 00157 00158 ofstream _outStream; 00159 00168 map<InputData*, table> _gTableMap; 00169 00178 map<InputData*, table> _margins; 00179 00187 map<InputData*, double> _alphaSums; 00188 00189 }; 00190 00191 } // end of namespace MultiBoost 00192 00193 #endif // __OUTPUT_INFO_H