SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LPBoost.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2007-2009 Soeren Sonnenburg
8  * Copyright (C) 2007-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 
11 #ifndef _LPBOOST_H___
12 #define _LPBOOST_H___
13 
14 #include <shogun/lib/config.h>
15 #ifdef USE_CPLEX
16 
17 #include <stdio.h>
18 #include <shogun/lib/common.h>
20 
24 
25 namespace shogun
26 {
48 class CLPBoost : public CLinearClassifier
49 {
50  public:
51  CLPBoost();
52  virtual ~CLPBoost();
53 
55  {
56  return CT_LPBOOST;
57  }
58 
59  bool init(int32_t num_vec);
60  void cleanup();
61 
66  virtual inline void set_features(CDotFeatures* feat)
67  {
68  if (feat->get_feature_class() != C_SPARSE ||
69  feat->get_feature_type() != F_DREAL)
70  SG_ERROR("LPBoost requires SPARSE REAL valued features\n");
71 
73  }
74 
81  inline void set_C(float64_t c_neg, float64_t c_pos) { C1=c_neg; C2=c_pos; }
82 
83  inline float64_t get_C1() { return C1; }
84  inline float64_t get_C2() { return C2; }
85 
86  inline void set_bias_enabled(bool enable_bias) { use_bias=enable_bias; }
87  inline bool get_bias_enabled() { return use_bias; }
88 
89  inline void set_epsilon(float64_t eps) { epsilon=eps; }
90  inline float64_t get_epsilon() { return epsilon; }
91 
92  float64_t find_max_violator(int32_t& max_dim);
93 
95  inline virtual const char* get_name() const { return "LPBoost"; }
96 
97  protected:
106  virtual bool train_machine(CFeatures* data=NULL);
107 
108  protected:
111  bool use_bias;
113 
116 
117  int32_t num_sfeat;
118  int32_t num_svec;
120 
121 };
122 }
123 #endif //USE_CPLEX
124 #endif //_LPBOOST_H___

SHOGUN Machine Learning Toolbox - Documentation