SHOGUN v0.9.0
|
00001 #ifndef _CTron_H 00002 #define _CTron_H 00003 00004 #include "lib/config.h" 00005 00006 #ifdef HAVE_LAPACK 00007 #include "base/SGObject.h" 00008 00009 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00010 namespace shogun 00011 { 00013 class function 00014 { 00015 public: 00023 virtual float64_t fun(float64_t *w) = 0 ; 00024 00032 virtual void grad(float64_t *w, float64_t *g) = 0 ; 00033 00041 virtual void Hv(float64_t *s, float64_t *Hs) = 0 ; 00042 00049 virtual int32_t get_nr_variable(void) = 0 ; 00050 00051 virtual ~function(void){} 00052 }; 00053 #endif // DOXYGEN_SHOULD_SKIP_THIS 00054 00056 #define IGNORE_IN_CLASSLIST 00057 IGNORE_IN_CLASSLIST class CTron : public CSGObject 00058 { 00059 public: 00066 CTron( 00067 const function *fun_obj, float64_t eps = 0.1, int32_t max_iter = 1000); 00068 virtual ~CTron(); 00069 00075 void tron(float64_t *w, float64_t max_train_time); 00076 00078 inline virtual const char* get_name() const { return "LibLinear"; } 00079 00080 private: 00081 int32_t trcg(float64_t delta, double* g, double* s, double* r); 00082 float64_t norm_inf(int32_t n, float64_t *x); 00083 00084 float64_t eps; 00085 int32_t max_iter; 00086 function *fun_obj; 00087 }; 00088 } 00089 #endif //HAVE_LAPACK 00090 #endif