00001 /* -*- c++ -*- (for Emacs) 00002 * 00003 * linearrecogniser.h 00004 * Digest 00005 * 00006 * Created by Aidan Lane on Tue Jan 17 2006. 00007 * Copyright (c) 2005-2006 Optimisation and Constraint Solving Group, 00008 * Monash University. All rights reserved. 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 */ 00024 00025 #ifndef LINEARRECOGNISER_H 00026 #define LINEARRECOGNISER_H 00027 00028 00029 #include "stlrecogniserinterface.h" 00030 00031 #include <map> 00032 #include <vector> 00033 00034 using namespace std; 00035 00036 00037 class LinearRecogniser : public StlRecogniserInterface { 00038 00039 typedef double WeightT; 00040 00041 public: 00042 LinearRecogniser(); 00043 ~LinearRecogniser(); 00044 00045 DECLARE_STL_RECOGNISER_KEY( "linear" ); 00046 DECLARE_STL_RECOGNISER_TITLE( "Linear Recogniser" ); 00047 DECLARE_STL_RECOGNISER_DESCRIPTION( "<B>Simple Linear Recogniser</B><BR><BR>" 00048 "Although it requires 2 or more features " 00049 "to work, there are no restrictions on " 00050 "which features can or cannot be used." ); 00051 00052 const map<string, string>& defaultParams() const; 00053 00054 bool initTraining( const list<string>& featureKeys, 00055 const map<string, string>& params ); 00056 bool examineSample( const StlFeatureVec& featureVec, 00057 const set<int>& classes ); 00058 bool finaliseTraining(); 00059 00060 bool writeModelFile( const string& fileName ); 00061 bool readModelFile( const string& fileName ); 00062 00063 StlStroke flatten( const StlStrokeList& strokes ); 00064 StlClassProbabilities classify( const StlFeatureVec& featureVec ); 00065 00066 private: 00067 map< int, vector<WeightT> > m_classWeights; 00068 }; 00069 00070 00071 #endif // ! LINEARRECOGNISER_H
1.5.2