SHOGUN  v2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tron.h
Go to the documentation of this file.
1 #ifndef _CTron_H
2 #define _CTron_H
3 
4 #include <shogun/lib/config.h>
5 
6 #ifdef HAVE_LAPACK
7 #include <shogun/base/SGObject.h>
8 
9 #ifndef DOXYGEN_SHOULD_SKIP_THIS
10 namespace shogun
11 {
13 class function
14 {
15 public:
23  virtual float64_t fun(float64_t *w) = 0 ;
24 
32  virtual void grad(float64_t *w, float64_t *g) = 0 ;
33 
41  virtual void Hv(float64_t *s, float64_t *Hs) = 0 ;
42 
49  virtual int32_t get_nr_variable() = 0 ;
50 
51  virtual ~function(){}
52 };
53 #endif // DOXYGEN_SHOULD_SKIP_THIS
54 
56 class CTron : public CSGObject
57 {
58 public:
59  CTron() { }
66  CTron(
67  const function *fun_obj, float64_t eps = 0.1, int32_t max_iter = 1000);
68  virtual ~CTron();
69 
75  void tron(float64_t *w, float64_t max_train_time);
76 
78  inline virtual const char* get_name() const { return "Tron"; }
79 
80 private:
81  int32_t trcg(float64_t delta, double* g, double* s, double* r);
82  float64_t norm_inf(int32_t n, float64_t *x);
83 
84  float64_t eps;
85  int32_t max_iter;
86  function *fun_obj;
87 };
88 }
89 #endif //HAVE_LAPACK
90 #endif

SHOGUN Machine Learning Toolbox - Documentation