SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
SOSVMHelper.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) 2013 Shell Hu
8  * Copyright (C) 2013 Shell Hu
9  */
10 
11 #ifndef __SOSVM_HELPER_H__
12 #define __SOSVM_HELPER_H__
13 
14 #include <shogun/lib/config.h>
15 
16 #include <shogun/base/SGObject.h>
17 #include <shogun/lib/SGVector.h>
19 
20 namespace shogun
21 {
22 
31 class CSOSVMHelper : public CSGObject
32 {
33 public:
35  CSOSVMHelper();
36 
41  CSOSVMHelper(int32_t bufsize);
42 
44  virtual ~CSOSVMHelper();
45 
47  virtual const char* get_name() const { return "SOSVMHelper"; }
48 
58 
72 
80  static float64_t average_loss(SGVector<float64_t> w, CStructuredModel* model, bool is_ub = false);
81 
90  virtual void add_debug_info(float64_t primal, float64_t eff_pass, float64_t train_error,
91  float64_t dual = -1, float64_t dgap = -1);
92 
98 
104 
110 
116 
122 
125  void terminate();
126 
127 private:
129  void init();
130 
131 private:
133  SGVector<float64_t> m_primal;
134 
136  SGVector<float64_t> m_dual;
137 
139  SGVector<float64_t> m_duality_gap;
140 
142  SGVector<float64_t> m_eff_pass;
143 
145  SGVector<float64_t> m_train_error;
146 
148  int32_t m_tracker;
149 
151  int32_t m_bufsize;
152 
153 }; /* CSOSVMHelper */
154 
155 } /* namespace shogun */
156 
157 #endif
virtual const char * get_name() const
Definition: SOSVMHelper.h:47
static float64_t primal_objective(SGVector< float64_t > w, CStructuredModel *model, float64_t lbda)
Definition: SOSVMHelper.cpp:57
SGVector< float64_t > get_dual_values() const
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:112
double float64_t
Definition: common.h:50
static float64_t dual_objective(SGVector< float64_t > w, float64_t aloss, float64_t lbda)
Definition: SOSVMHelper.cpp:83
class CSOSVMHelper contains helper functions to compute primal objectives, dual objectives, average training losses, duality gaps etc. These values will be recorded to check convergence. This class is inspired by the matlab implementation of the block coordinate Frank-Wolfe SOSVM solver [1].
Definition: SOSVMHelper.h:31
static float64_t average_loss(SGVector< float64_t > w, CStructuredModel *model, bool is_ub=false)
Definition: SOSVMHelper.cpp:88
Class CStructuredModel that represents the application specific model and contains most of the applic...
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
virtual void add_debug_info(float64_t primal, float64_t eff_pass, float64_t train_error, float64_t dual=-1, float64_t dgap=-1)
SGVector< float64_t > get_duality_gaps() const
SGVector< float64_t > get_primal_values() const
SGVector< float64_t > get_train_errors() const
SGVector< float64_t > get_eff_passes() const

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