SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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
static int msvm_sort_data(float64_t *vals, float64_t *data, uint32_t size)
static void msvm_print(ocas_return_value_T value)
void set_C(float64_t C)
The class Labels models labels, i.e. class assignments of objects.
Definition: Labels.h:43
int32_t get_method() const
static int msvm_full_add_new_cut(float64_t *new_col_H, uint32_t *new_cut, uint32_t nSel, void *user_data)
virtual bool train_machine(CFeatures *data=NULL)
void set_max_iter(int32_t max_iter)
Features that support dot products among other operations.
Definition: DotFeatures.h:44
float64_t get_C() const
static const float64_t epsilon
Definition: libbmrm.cpp:25
generic linear multiclass machine
#define ASSERT(x)
Definition: SGIO.h:201
#define MACHINE_PROBLEM_TYPE(PT)
Definition: Machine.h:120
int32_t get_max_iter() const
double float64_t
Definition: common.h:50
static int msvm_full_compute_output(float64_t *output, void *user_data)
float64_t get_epsilon() const
int32_t get_buf_size() const
void set_method(int32_t method)
static void msvm_full_compute_W(float64_t *sq_norm_W, float64_t *dp_WoldW, float64_t *alpha, uint32_t nSel, void *user_data)
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
multiclass OCAS wrapper
The class Features is the base class of all feature objects.
Definition: Features.h:68
void set_buf_size(int32_t buf_size)
virtual const char * get_name() const
void set_epsilon(float64_t epsilon)
static float64_t msvm_update_W(float64_t t, void *user_data)

SHOGUN Machine Learning Toolbox - Documentation