SHOGUN
v3.2.0
|
00001 #ifndef _CTron_H 00002 #define _CTron_H 00003 00004 #include <shogun/lib/config.h> 00005 00006 #include <shogun/base/SGObject.h> 00007 00008 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00009 namespace shogun 00010 { 00012 class function 00013 { 00014 public: 00022 virtual float64_t fun(float64_t *w) = 0 ; 00023 00031 virtual void grad(float64_t *w, float64_t *g) = 0 ; 00032 00040 virtual void Hv(float64_t *s, float64_t *Hs) = 0 ; 00041 00048 virtual int32_t get_nr_variable() = 0 ; 00049 00050 virtual ~function(){} 00051 }; 00052 #endif // DOXYGEN_SHOULD_SKIP_THIS 00053 00055 class CTron : public CSGObject 00056 { 00057 public: 00058 CTron() { } 00065 CTron( 00066 const function *fun_obj, float64_t eps = 0.1, int32_t max_iter = 1000); 00067 virtual ~CTron(); 00068 00074 void tron(float64_t *w, float64_t max_train_time); 00075 00077 virtual const char* get_name() const { return "Tron"; } 00078 00079 private: 00080 int32_t trcg(float64_t delta, double* g, double* s, double* r); 00081 float64_t norm_inf(int32_t n, float64_t *x); 00082 00083 float64_t eps; 00084 int32_t max_iter; 00085 function *fun_obj; 00086 }; 00087 } 00088 #endif