SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
classifier
svm
QPBSVMLib.h
浏览该文件的文档.
1
/*-----------------------------------------------------------------------
2
*
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License as published by
5
* the Free Software Foundation; either version 3 of the License, or
6
* (at your option) any later version.
7
*
8
* Library for solving QP task required for learning SVM without bias term.
9
*
10
* Written (W) 1999-2008 Vojtech Franc, xfrancv@cmp.felk.cvut.cz
11
* Copyright (C) 1999-2008 Center for Machine Perception, CTU FEL Prague
12
*
13
-------------------------------------------------------------------- */
14
15
#ifndef QPBSVMLIB_H__
16
#define QPBSVMLIB_H__
17
18
#include <math.h>
19
#include <limits.h>
20
21
#include <
shogun/base/SGObject.h
>
22
#include <
shogun/io/SGIO.h
>
23
#include <
shogun/lib/config.h
>
24
#include <
shogun/lib/common.h
>
25
#include <
shogun/kernel/Kernel.h
>
26
27
namespace
shogun
28
{
29
30
#ifndef DOXYGEN_SHOULD_SKIP_THIS
31
enum
E_QPB_SOLVER
32
{
33
QPB_SOLVER_SCA,
// sequential coordinate wise (gaussian seidel based)
34
QPB_SOLVER_SCAS,
// sequential coordinate wise selecting the variable
35
// gaining 'best' improved
36
QPB_SOLVER_SCAMV,
// sequential coordinate wise selecting variable most violating kkt's
37
QPB_SOLVER_PRLOQO,
// via pr_loqo
38
QPB_SOLVER_CPLEX,
// via cplex
39
QPB_SOLVER_GS,
// gaussian seidel
40
QPB_SOLVER_GRADDESC
// gaussian seidel
41
};
42
#endif
43
45
class
CQPBSVMLib
:
public
CSGObject
46
{
47
public
:
49
CQPBSVMLib
();
50
59
CQPBSVMLib
(
60
float64_t
*
H
, int32_t n,
float64_t
* f, int32_t m,
float64_t
UB=1.0);
61
63
int32_t
solve_qp
(
float64_t
* result, int32_t len);
64
69
inline
void
set_solver
(E_QPB_SOLVER solver)
70
{
71
m_solver
=solver;
72
}
73
74
virtual
~CQPBSVMLib
();
75
76
protected
:
82
inline
float64_t
*
get_col
(int32_t col)
83
{
84
return
&
m_H
[
m_dim
*col];
85
}
86
89
int32_t
qpbsvm_sca
(
90
float64_t
*x,
float64_t
*Nabla, int32_t *ptr_t,
91
float64_t
**ptr_History, int32_t verb);
94
int32_t
qpbsvm_scas
(
95
float64_t
*x,
float64_t
*Nabla, int32_t *ptr_t,
96
float64_t
**ptr_History, int32_t verb);
99
int32_t
qpbsvm_scamv
(
100
float64_t
*x,
float64_t
*Nabla, int32_t *ptr_t,
101
float64_t
**ptr_History, int32_t verb);
104
int32_t
qpbsvm_prloqo
(
105
float64_t
*x,
float64_t
*Nabla, int32_t *ptr_t,
106
float64_t
**ptr_History, int32_t verb);
109
int32_t
qpbsvm_gauss_seidel
(
110
float64_t
*x,
float64_t
*Nabla, int32_t *ptr_t,
111
float64_t
**ptr_History, int32_t verb);
114
int32_t
qpbsvm_gradient_descent
(
115
float64_t
*x,
float64_t
*Nabla, int32_t *ptr_t,
116
float64_t
**ptr_History, int32_t verb);
117
#ifdef USE_CPLEX
118
120
int32_t
qpbsvm_cplex
(
121
float64_t
*x,
float64_t
*Nabla, int32_t *ptr_t,
122
float64_t
**ptr_History, int32_t verb);
123
#endif
124
126
inline
const
char
*
get_name
()
const
{
return
"QPBSVMLib"
; }
127
128
protected
:
130
float64_t
*
m_H
;
132
float64_t
*
m_diag_H
;
134
int32_t
m_dim
;
135
137
float64_t
*
m_f
;
138
140
float64_t
m_UB
;
141
143
int32_t
m_tmax
;
145
float64_t
m_tolabs
;
147
float64_t
m_tolrel
;
149
float64_t
m_tolKKT
;
151
E_QPB_SOLVER
m_solver
;
152
};
153
}
154
#endif //QPBSVMLIB_H__
SHOGUN
机器学习工具包 - 项目文档