SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
classifier
LPBoost.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) 2007-2009 Soeren Sonnenburg
8
* Copyright (C) 2007-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9
*/
10
11
#ifndef _LPBOOST_H___
12
#define _LPBOOST_H___
13
14
#include <
shogun/lib/config.h
>
15
#ifdef USE_CPLEX
16
17
#include <stdio.h>
18
#include <
shogun/lib/common.h
>
19
#include <
shogun/lib/DynamicArray.h
>
20
21
#include <
shogun/features/Features.h
>
22
#include <
shogun/features/SparseFeatures.h
>
23
#include <
shogun/machine/LinearMachine.h
>
24
25
namespace
shogun
26
{
48
class
CLPBoost
:
public
CLinearMachine
49
{
50
public
:
51
MACHINE_PROBLEM_TYPE
(
PT_BINARY
);
52
53
CLPBoost
();
54
virtual
~CLPBoost
();
55
56
virtual
EMachineType
get_classifier_type
()
57
{
58
return
CT_LPBOOST
;
59
}
60
61
bool
init(int32_t num_vec);
62
void
cleanup
();
63
68
virtual
void
set_features
(
CDotFeatures
* feat)
69
{
70
if
(feat->
get_feature_class
() !=
C_SPARSE
||
71
feat->
get_feature_type
() !=
F_DREAL
)
72
SG_ERROR
(
"LPBoost requires SPARSE REAL valued features\n"
)
73
74
CLinearMachine::set_features
(feat);
75
}
76
83
inline
void
set_C
(
float64_t
c_neg,
float64_t
c_pos) {
C1
=c_neg;
C2
=c_pos; }
84
85
inline
float64_t
get_C1
() {
return
C1
; }
86
inline
float64_t
get_C2
() {
return
C2
; }
87
88
inline
void
set_bias_enabled
(
bool
enable_bias) {
use_bias
=enable_bias; }
89
inline
bool
get_bias_enabled
() {
return
use_bias
; }
90
91
inline
void
set_epsilon
(
float64_t
eps) {
epsilon
=eps; }
92
inline
float64_t
get_epsilon
() {
return
epsilon
; }
93
94
float64_t
find_max_violator
(int32_t& max_dim);
95
97
virtual
const
char
*
get_name
()
const
{
return
"LPBoost"
; }
98
99
protected
:
108
virtual
bool
train_machine
(
CFeatures
* data=NULL);
109
110
protected
:
111
float64_t
C1
;
112
float64_t
C2
;
113
bool
use_bias
;
114
float64_t
epsilon
;
115
116
float64_t
*
u
;
117
CDynamicArray<int32_t>
*
dim
;
118
119
int32_t
num_sfeat
;
120
int32_t
num_svec
;
121
SGSparseVector<float64_t>
*
sfeat
;
122
123
};
124
}
125
#endif //USE_CPLEX
126
#endif //_LPBOOST_H___
SHOGUN
机器学习工具包 - 项目文档