Classifier.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 1999-2008 Soeren Sonnenburg
00008  * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society
00009  */
00010 
00011 #ifndef _CLASSIFIER_H__
00012 #define _CLASSIFIER_H__
00013 
00014 #include "lib/common.h"
00015 #include "base/SGObject.h"
00016 #include "lib/Mathematics.h"
00017 #include "features/Labels.h"
00018 
00020 class CClassifier : public CSGObject
00021 {
00022     public:
00024         CClassifier();
00025         virtual ~CClassifier();
00026 
00031         virtual bool train() { return false; }
00032 
00038         virtual CLabels* classify(CLabels* output=NULL);
00039 
00047         virtual DREAL classify_example(INT num) { return CMath::INFTY; }
00048 
00056         virtual bool load(FILE* srcfile) { ASSERT(srcfile); return false; }
00057 
00065         virtual bool save(FILE* dstfile) { ASSERT(dstfile); return false; }
00066 
00071         virtual inline void set_labels(CLabels* lab)
00072         {
00073             SG_UNREF(labels);
00074             SG_REF(lab);
00075             labels=lab;
00076         }
00077 
00082         virtual inline CLabels* get_labels() { SG_REF(labels); return labels; }
00083 
00089         virtual inline DREAL get_label(INT i) { return labels->get_label(i); }
00090 
00095         inline void set_max_train_time(DREAL t) { max_train_time=t; }
00096 
00101         inline DREAL get_max_train_time() { return max_train_time; }
00102 
00107         virtual inline EClassifierType get_classifier_type() { return CT_NONE; }
00108 
00109     protected:
00111         DREAL max_train_time;
00112 
00114         CLabels* labels;
00115 };
00116 #endif

SHOGUN Machine Learning Toolbox - Documentation