LPBoost.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) 2007-2008 Soeren Sonnenburg
00008  * Copyright (C) 2007-2008 Fraunhofer Institute FIRST and Max-Planck-Society
00009  */
00010 
00011 #ifndef _LPBOOST_H___
00012 #define _LPBOOST_H___
00013 
00014 #include "lib/config.h"
00015 #ifdef USE_CPLEX
00016 
00017 #include <stdio.h>
00018 #include "lib/common.h"
00019 #include "lib/DynamicArray.h"
00020 
00021 #include "features/Features.h"
00022 #include "classifier/SparseLinearClassifier.h"
00023 
00024 class CLPBoost : public CSparseLinearClassifier
00025 {
00026     public:
00027         CLPBoost();
00028         virtual ~CLPBoost();
00029 
00030         virtual bool train();
00031 
00032         inline virtual EClassifierType get_classifier_type()
00033         {
00034             return CT_LPBOOST;
00035         }
00036 
00037         bool init(int32_t num_vec);
00038         void cleanup();
00039 
00040         inline void set_C(float64_t c1, float64_t c2) { C1=c1; C2=c2; }
00041 
00042         inline float64_t get_C1() { return C1; }
00043         inline float64_t get_C2() { return C2; }
00044 
00045         inline void set_bias_enabled(bool enable_bias) { use_bias=enable_bias; }
00046         inline bool get_bias_enabled() { return use_bias; }
00047 
00048         inline void set_epsilon(float64_t eps) { epsilon=eps; }
00049         inline float64_t get_epsilon() { return epsilon; }
00050 
00051         float64_t find_max_violator(int32_t& max_dim);
00052 
00053     protected:
00054         float64_t C1;
00055         float64_t C2;
00056         bool use_bias;
00057         float64_t epsilon;
00058 
00059         float64_t* u;
00060         CDynamicArray<int32_t>* dim;
00061 
00062         int32_t num_sfeat;
00063         int32_t num_svec;
00064         TSparse<float64_t>* sfeat;
00065 
00066 };
00067 #endif //USE_CPLEX
00068 #endif //_LPBOOST_H___

SHOGUN Machine Learning Toolbox - Documentation