Tanl Linguistic Pipeline |
00001 /* 00002 ** Tanl 00003 ** classifier/GIS.h 00004 ** ---------------------------------------------------------------------- 00005 ** Copyright (c) 2003 Giuseppe Attardi (attardi@di.unipi.it). 00006 ** ---------------------------------------------------------------------- 00007 ** 00008 ** This file is part of Tanl. 00009 ** 00010 ** Tanl is free software; you can redistribute it and/or modify it 00011 ** under the terms of the GNU General Public License, version 3, 00012 ** as published by the Free Software Foundation. 00013 ** 00014 ** Tanl is distributed in the hope that it will be useful, 00015 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 ** GNU General Public License for more details. 00018 ** 00019 ** You should have received a copy of the GNU General Public License 00020 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00021 ** ---------------------------------------------------------------------- 00022 */ 00023 00024 #ifndef Tanl_classifier_GIS_H 00025 #define Tanl_classifier_GIS_H 00026 00027 #include "MaxEnt.h" 00028 00029 namespace Tanl { 00030 namespace Classifier { 00031 00032 typedef std::vector<std::vector<std::pair<ClassID, double> > > Expected; 00033 00070 class GIS : public MaxEnt 00071 { 00072 public: 00081 GIS(EventStream& es, int iterations, int cutoff = 0, double alpha = 0.0); 00082 00094 GIS(int iterations = 50, int cutoff = 0, double alpha = 0.0); 00095 00099 void train(); 00100 00104 void train(EventStream& es); 00105 00106 private: 00107 double update(Expected& expected, double prob[], int& correct); 00108 00109 double alpha; 00110 double cfObservedExpect; 00111 00113 static const double LLThreshold; 00114 00115 static const double NEAR_ZERO; // = 0.01; 00116 00117 }; 00118 00119 } // namespace Classifier 00120 } // namespace Tanl 00121 00122 #endif // Tanl_classifier_GIS_H