SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
PrimalMosekSOSVM.h
浏览该文件的文档.
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) 2014 Shell Hu
8  * Written (W) 2012 Fernando José Iglesias García
9  * Copyright (C) 2012 Fernando José Iglesias García
10  */
11 
12 #ifndef _PRIMAL_MOSEK_SOSVM__H__
13 #define _PRIMAL_MOSEK_SOSVM__H__
14 
15 #include <shogun/lib/config.h>
16 
17 #ifdef USE_MOSEK
18 
21 
22 namespace shogun
23 {
24 
35 class CPrimalMosekSOSVM : public CLinearStructuredOutputMachine
36 {
37  public:
39  CPrimalMosekSOSVM();
40 
46  CPrimalMosekSOSVM(CStructuredModel* model, CStructuredLabels* labs);
47 
49  ~CPrimalMosekSOSVM();
50 
55  inline SGVector< float64_t > get_slacks() const { return m_slacks; }
56 
61  virtual float64_t compute_primal_objective() const;
62 
64  virtual const char* get_name() const { return "PrimalMosekSOSVM"; }
65 
70  virtual EMachineType get_classifier_type();
71 
76  void set_regularization(float64_t C);
77 
83 
87  void set_lower_bounds(SGVector< float64_t > lb);
88 
92  void set_upper_bounds(SGVector< float64_t > ub);
93 
94  protected:
100  virtual bool train_machine(CFeatures* data = NULL);
101 
102  private:
103  void init();
104 
110  float64_t compute_loss_arg(CResultSet* result) const;
111 
117  bool insert_result(CList* result_list, CResultSet* result) const;
118 
142  bool add_constraint(CMosek* mosek, CResultSet* result, index_t con_idx, index_t train_idx) const;
143 
144  private:
146  SGVector< float64_t > m_slacks;
147 
149  float64_t po_value;
150 
152  float64_t m_regularization;
153 
155  float64_t m_epsilon;
156 
159 
162 
163 }; /* class CPrimalMosekSOSVM */
164 
165 } /* namespace shogun */
166 
167 #endif /* USE_MOSEK */
168 #endif /* _PRIMAL_MOSEK_SOSVM__H__ */
EMachineType
Definition: Machine.h:33
int32_t index_t
Definition: common.h:62
static const float64_t epsilon
Definition: libbmrm.cpp:25
double float64_t
Definition: common.h:50
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
void set_epsilon(float *begin, float max)
Definition: JLCoverTree.h:512

SHOGUN 机器学习工具包 - 项目文档