SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 <shogun/lib/common.h>
19 
23 
24 namespace shogun
25 {
47 class CLPBoost : public CLinearMachine
48 {
49  public:
51 
52  CLPBoost();
53  virtual ~CLPBoost();
54 
56  {
57  return CT_LPBOOST;
58  }
59 
60  bool init(int32_t num_vec);
61  void cleanup();
62 
67  virtual void set_features(CDotFeatures* feat)
68  {
69  if (feat->get_feature_class() != C_SPARSE ||
70  feat->get_feature_type() != F_DREAL)
71  SG_ERROR("LPBoost requires SPARSE REAL valued features\n")
72 
74  }
75 
82  inline void set_C(float64_t c_neg, float64_t c_pos) { C1=c_neg; C2=c_pos; }
83 
84  inline float64_t get_C1() { return C1; }
85  inline float64_t get_C2() { return C2; }
86 
87  inline void set_bias_enabled(bool enable_bias) { use_bias=enable_bias; }
88  inline bool get_bias_enabled() { return use_bias; }
89 
90  inline void set_epsilon(float64_t eps) { epsilon=eps; }
91  inline float64_t get_epsilon() { return epsilon; }
92 
93  float64_t find_max_violator(int32_t& max_dim);
94 
96  virtual const char* get_name() const { return "LPBoost"; }
97 
98  protected:
107  virtual bool train_machine(CFeatures* data=NULL);
108 
109  protected:
112  bool use_bias;
114 
117 
118  int32_t num_sfeat;
119  int32_t num_svec;
121 
122 };
123 }
124 #endif //USE_CPLEX
125 #endif //_LPBOOST_H___
EMachineType
Definition: Machine.h:33
float64_t get_C1()
Definition: LPBoost.h:84
void set_C(float64_t c_neg, float64_t c_pos)
Definition: LPBoost.h:82
#define SG_ERROR(...)
Definition: SGIO.h:129
float64_t get_epsilon()
Definition: LPBoost.h:91
float64_t get_C2()
Definition: LPBoost.h:85
virtual EMachineType get_classifier_type()
Definition: LPBoost.h:55
Features that support dot products among other operations.
Definition: DotFeatures.h:44
void set_epsilon(float64_t eps)
Definition: LPBoost.h:90
int32_t num_sfeat
Definition: LPBoost.h:118
float64_t epsilon
Definition: LPBoost.h:113
void set_bias_enabled(bool enable_bias)
Definition: LPBoost.h:87
virtual void set_features(CDotFeatures *feat)
Definition: LPBoost.h:67
virtual ~CLPBoost()
Definition: LPBoost.cpp:36
virtual const char * get_name() const
Definition: LPBoost.h:96
bool get_bias_enabled()
Definition: LPBoost.h:88
int32_t num_svec
Definition: LPBoost.h:119
SGSparseVector< float64_t > * sfeat
Definition: LPBoost.h:120
double float64_t
Definition: common.h:50
virtual void set_features(CDotFeatures *feat)
virtual EFeatureClass get_feature_class() const =0
Class LinearMachine is a generic interface for all kinds of linear machines like classifiers.
Definition: LinearMachine.h:63
CDynamicArray< int32_t > * dim
Definition: LPBoost.h:116
Class LPBoost trains a linear classifier called Linear Programming Machine, i.e. a SVM using a norm ...
Definition: LPBoost.h:47
float64_t C2
Definition: LPBoost.h:111
float64_t find_max_violator(int32_t &max_dim)
Definition: LPBoost.cpp:69
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
The class Features is the base class of all feature objects.
Definition: Features.h:68
MACHINE_PROBLEM_TYPE(PT_BINARY)
void cleanup()
Definition: LPBoost.cpp:57
virtual EFeatureType get_feature_type() const =0
float64_t * u
Definition: LPBoost.h:115
virtual bool train_machine(CFeatures *data=NULL)
Definition: LPBoost.cpp:104
float64_t C1
Definition: LPBoost.h:110

SHOGUN Machine Learning Toolbox - Documentation