SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LPM.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 _LPM_H___
12 #define _LPM_H___
13 
14 #include <shogun/lib/config.h>
15 #ifdef USE_CPLEX
16 
17 #include <shogun/lib/common.h>
20 
21 namespace shogun
22 {
42 class CLPM : public CLinearMachine
43 {
44  public:
46 
47  CLPM();
48  virtual ~CLPM();
49 
51  {
52  return CT_LPM;
53  }
54 
59  virtual void set_features(CDotFeatures* feat)
60  {
61  if (feat->get_feature_class() != C_SPARSE ||
62  feat->get_feature_type() != F_DREAL)
63  SG_ERROR("LPM requires SPARSE REAL valued features\n")
64 
66  }
67 
74  inline void set_C(float64_t c_neg, float64_t c_pos) { C1=c_neg; C2=c_pos; }
75 
76  inline float64_t get_C1() { return C1; }
77  inline float64_t get_C2() { return C2; }
78 
79  inline void set_bias_enabled(bool enable_bias) { use_bias=enable_bias; }
80  inline bool get_bias_enabled() { return use_bias; }
81 
82  inline void set_epsilon(float64_t eps) { epsilon=eps; }
83  inline float64_t get_epsilon() { return epsilon; }
84 
86  virtual const char* get_name() const { return "LPM"; }
87 
88  protected:
97  virtual bool train_machine(CFeatures* data=NULL);
98 
99  protected:
102  bool use_bias;
104 };
105 }
106 #endif //USE_CPLEX
107 #endif //_LPM_H___
EMachineType
Definition: Machine.h:33
MACHINE_PROBLEM_TYPE(PT_BINARY)
virtual EMachineType get_classifier_type()
Definition: LPM.h:50
Class LPM trains a linear classifier called Linear Programming Machine, i.e. a SVM using a norm regu...
Definition: LPM.h:42
#define SG_ERROR(...)
Definition: SGIO.h:129
virtual void set_features(CDotFeatures *feat)
Definition: LPM.h:59
Features that support dot products among other operations.
Definition: DotFeatures.h:44
float64_t get_epsilon()
Definition: LPM.h:83
virtual const char * get_name() const
Definition: LPM.h:86
virtual ~CLPM()
Definition: LPM.cpp:29
double float64_t
Definition: common.h:50
float64_t C2
Definition: LPM.h:101
virtual void set_features(CDotFeatures *feat)
virtual bool train_machine(CFeatures *data=NULL)
Definition: LPM.cpp:33
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
float64_t get_C2()
Definition: LPM.h:77
void set_bias_enabled(bool enable_bias)
Definition: LPM.h:79
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
bool get_bias_enabled()
Definition: LPM.h:80
The class Features is the base class of all feature objects.
Definition: Features.h:68
float64_t get_C1()
Definition: LPM.h:76
float64_t epsilon
Definition: LPM.h:103
void set_epsilon(float64_t eps)
Definition: LPM.h:82
void set_C(float64_t c_neg, float64_t c_pos)
Definition: LPM.h:74
float64_t C1
Definition: LPM.h:100
virtual EFeatureType get_feature_type() const =0
bool use_bias
Definition: LPM.h:102

SHOGUN Machine Learning Toolbox - Documentation