SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MulticlassOCAS.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) 2012 Sergey Lisitsyn
8  * Copyright (C) 2012 Sergey Lisitsyn
9  */
10 
11 #ifndef _MULTICLASSOCAS_H___
12 #define _MULTICLASSOCAS_H___
13 
14 #include <shogun/lib/config.h>
15 
16 #include <shogun/lib/common.h>
18 #include <shogun/lib/external/libocas.h>
20 
21 namespace shogun
22 {
23 
26 {
27  public:
29 
30 
32 
38  CMulticlassOCAS(float64_t C, CDotFeatures* features, CLabels* labs);
39 
41  virtual ~CMulticlassOCAS();
42 
44  virtual const char* get_name() const
45  {
46  return "MulticlassOCAS";
47  }
48 
52  inline void set_C(float64_t C)
53  {
54  ASSERT(C>0)
55  m_C = C;
56  }
60  inline float64_t get_C() const { return m_C; }
61 
66  {
67  ASSERT(epsilon>0)
69  }
73  inline float64_t get_epsilon() const { return m_epsilon; }
74 
78  inline void set_max_iter(int32_t max_iter)
79  {
80  ASSERT(max_iter>0)
81  m_max_iter = max_iter;
82  }
86  inline int32_t get_max_iter() const { return m_max_iter; }
87 
91  inline void set_method(int32_t method)
92  {
93  ASSERT(method==0 || method==1)
94  m_method = method;
95  }
99  inline int32_t get_method() const { return m_method; }
100 
104  inline void set_buf_size(int32_t buf_size)
105  {
106  ASSERT(buf_size>0)
107  m_buf_size = buf_size;
108  }
112  inline int32_t get_buf_size() const { return m_buf_size; }
113 
114 protected:
115 
117  virtual bool train_machine(CFeatures* data = NULL);
118 
120  static float64_t msvm_update_W(float64_t t, void* user_data);
121 
123  static void msvm_full_compute_W(float64_t *sq_norm_W, float64_t *dp_WoldW,
124  float64_t *alpha, uint32_t nSel, void* user_data);
125 
127  static int msvm_full_add_new_cut(float64_t *new_col_H, uint32_t *new_cut,
128  uint32_t nSel, void* user_data);
129 
131  static int msvm_full_compute_output(float64_t *output, void* user_data);
132 
134  static int msvm_sort_data(float64_t* vals, float64_t* data, uint32_t size);
135 
137  static void msvm_print(ocas_return_value_T value);
138 
139 private:
140 
142  void register_parameters();
143 
144 protected:
145 
148 
151 
153  int32_t m_max_iter;
154 
156  int32_t m_method;
157 
159  int32_t m_buf_size;
160 };
161 }
162 #endif

SHOGUN Machine Learning Toolbox - Documentation