LibLinear.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 _LIBLINEAR_H___
00012 #define _LIBLINEAR_H___
00013 
00014 #include "lib/config.h"
00015 
00016 #ifdef HAVE_LAPACK
00017 #include "lib/common.h"
00018 #include "classifier/SparseLinearClassifier.h"
00019 
00020 enum LIBLINEAR_LOSS
00021 {
00022     LR = 0,
00023     L2 = 1
00024 };
00025 
00027 class CLibLinear : public CSparseLinearClassifier
00028 {
00029     public:
00034         CLibLinear(LIBLINEAR_LOSS loss);
00035 
00042         CLibLinear(
00043             float64_t C, CSparseFeatures<float64_t>* traindat,
00044             CLabels* trainlab);
00045 
00046         virtual ~CLibLinear();
00047 
00049         virtual bool train();
00050 
00055         virtual inline EClassifierType get_classifier_type() { return CT_LIBLINEAR; }
00056 
00062         inline void set_C(float64_t c1, float64_t c2) { C1=c1; C2=c2; }
00063 
00068         inline float64_t get_C1() { return C1; }
00069 
00074         inline float64_t get_C2() { return C2; }
00075 
00080         inline void set_epsilon(float64_t eps) { epsilon=eps; }
00081 
00086         inline float64_t get_epsilon() { return epsilon; }
00087 
00092         inline void set_bias_enabled(bool enable_bias) { use_bias=enable_bias; }
00093 
00098         inline bool get_bias_enabled() { return use_bias; }
00099 
00100     protected:
00102         float64_t C1;
00104         float64_t C2;
00106         bool use_bias;
00108         float64_t epsilon;
00109 
00111         LIBLINEAR_LOSS loss;
00112 };
00113 #endif //HAVE_LAPACK
00114 #endif //_LIBLINEAR_H___

SHOGUN Machine Learning Toolbox - Documentation