SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
multiclass
ShareBoost.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) 2012 Chiyuan Zhang
8
* Copyright (C) 2012 Chiyuan Zhang
9
*/
10
11
#ifndef SHAREBOOST_H__
12
#define SHAREBOOST_H__
13
14
#include <
shogun/machine/LinearMulticlassMachine.h
>
15
#include <
shogun/multiclass/MulticlassOneVsRestStrategy.h
>
16
#include <
shogun/features/DenseFeatures.h
>
17
#include <
shogun/labels/MulticlassLabels.h
>
18
19
namespace
shogun
20
{
21
30
class
CShareBoost
:
public
CLinearMulticlassMachine
31
{
32
public
:
34
CShareBoost
();
35
37
CShareBoost
(
CDenseFeatures<float64_t>
*features,
CMulticlassLabels
*labs, int32_t num_nonzero_feas);
38
40
virtual
~CShareBoost
() {}
41
43
virtual
const
char
*
get_name
()
const
{
return
"ShareBoost"
; }
44
46
void
set_num_nonzero_feas
(int32_t n) { m_nonzero_feas = n; }
47
49
int32_t
get_num_nonzero_feas
()
const
{
return
m_nonzero_feas; }
50
52
void
set_features
(
CFeatures
*f);
53
55
SGVector<int32_t>
get_activeset
();
56
57
friend
class
ShareBoostOptimizer
;
58
protected
:
59
61
virtual
bool
train_machine
(
CFeatures
* data = NULL);
62
63
private
:
64
void
init_sb_params();
65
66
void
compute_rho();
67
int32_t choose_feature();
68
void
optimize_coefficients();
69
void
compute_pred();
70
void
compute_pred(
const
float64_t
*W);
71
72
int32_t m_nonzero_feas;
73
SGVector<int32_t>
m_activeset;
74
75
SGMatrix<float64_t>
m_fea;
76
SGMatrix<float64_t>
m_rho;
77
SGVector<float64_t>
m_rho_norm;
78
SGMatrix<float64_t>
m_pred;
79
};
80
81
}
/* shogun */
82
83
#endif
/* end of include guard: SHAREBOOST_H__ */
84
SHOGUN
机器学习工具包 - 项目文档