SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
regression
svr
LibLinearRegression.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
* Copyright (C) 2012 Soeren Sonnenburg
8
*/
9
10
#ifndef _REGRESSIONLIBLINEAR_H___
11
#define _REGRESSIONLIBLINEAR_H___
12
#include <
shogun/lib/config.h
>
13
#ifdef HAVE_LAPACK
14
#include <
shogun/lib/common.h
>
15
#include <
shogun/features/DotFeatures.h
>
16
#include <
shogun/machine/LinearMachine.h
>
17
#include <
shogun/optimization/liblinear/shogun_liblinear.h
>
18
19
namespace
shogun
20
{
22
enum
LIBLINEAR_REGRESSION_TYPE
23
{
25
L2R_L2LOSS_SVR
,
27
L2R_L1LOSS_SVR_DUAL
,
29
L2R_L2LOSS_SVR_DUAL
30
};
31
34
class
CLibLinearRegression
:
public
CLinearMachine
35
{
36
public
:
37
MACHINE_PROBLEM_TYPE
(
PT_REGRESSION
)
38
39
40
CLibLinearRegression
();
41
47
CLibLinearRegression
(
float64_t
C,
CDotFeatures
*
features
,
CLabels
* labs);
48
50
virtual
~CLibLinearRegression
();
51
53
inline
LIBLINEAR_REGRESSION_TYPE
get_liblinear_regression_type
()
54
{
55
return
m_liblinear_regression_type
;
56
}
57
59
inline
void
set_liblinear_regression_type
(
LIBLINEAR_REGRESSION_TYPE
st)
60
{
61
m_liblinear_regression_type
=st;
62
}
63
65
virtual
const
char
*
get_name
()
const
66
{
67
return
"LibLinearRegression"
;
68
}
69
73
inline
void
set_C
(
float64_t
C)
74
{
75
ASSERT
(C>0)
76
m_C
= C;
77
}
78
82
inline
float64_t
get_C
()
const
{
return
m_C
; }
83
88
inline
void
set_tube_epsilon
(
float64_t
eps) {
m_tube_epsilon
=eps; }
89
94
inline
float64_t
get_tube_epsilon
() {
return
m_tube_epsilon
; }
95
96
100
inline
void
set_epsilon
(
float64_t
epsilon
)
101
{
102
ASSERT
(epsilon>0)
103
m_epsilon
=
epsilon
;
104
}
105
109
inline
float64_t
get_epsilon
()
const
{
return
m_epsilon
; }
110
114
inline
void
set_use_bias
(
bool
use_bias)
115
{
116
m_use_bias
= use_bias;
117
}
121
inline
bool
get_use_bias
()
const
122
{
123
return
m_use_bias
;
124
}
125
129
inline
void
set_max_iter
(int32_t max_iter)
130
{
131
ASSERT
(max_iter>0)
132
m_max_iter
= max_iter;
133
}
137
inline
int32_t
get_max_iter
()
const
{
return
m_max_iter
; }
138
139
protected
:
140
142
virtual
bool
train_machine
(
CFeatures
* data = NULL);
143
144
private
:
146
void
solve_l2r_l1l2_svr(
const
liblinear_problem *prob);
147
149
void
init_defaults();
150
152
void
register_parameters();
153
154
protected
:
155
157
float64_t
m_C
;
158
160
float64_t
m_epsilon
;
161
163
float64_t
m_tube_epsilon
;
164
166
int32_t
m_max_iter
;
167
169
bool
m_use_bias
;
170
172
LIBLINEAR_REGRESSION_TYPE
m_liblinear_regression_type
;
173
};
174
}
175
#endif
/* HAVE_LAPACK */
176
#endif
SHOGUN
机器学习工具包 - 项目文档