SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
machine
BaggingMachine.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 Viktor Gal
8
* Copyright (C) 2013 Viktor Gal
9
*/
10
11
#ifndef BAGGINGMACHINE_H
12
#define BAGGINGMACHINE_H
13
14
#include <
shogun/machine/Machine.h
>
15
#include <
shogun/ensemble/CombinationRule.h
>
16
#include <
shogun/evaluation/Evaluation.h
>
17
18
namespace
shogun
19
{
24
class
CBaggingMachine
:
public
CMachine
25
{
26
public
:
28
CBaggingMachine
();
29
36
CBaggingMachine
(
CFeatures
* features,
CLabels
* labels);
37
38
virtual
~CBaggingMachine
();
39
40
virtual
CBinaryLabels
*
apply_binary
(
CFeatures
* data=NULL);
41
virtual
CMulticlassLabels
*
apply_multiclass
(
CFeatures
* data=NULL);
42
virtual
CRegressionLabels
*
apply_regression
(
CFeatures
* data=NULL);
43
49
void
set_num_bags
(int32_t num_bags);
50
56
int32_t
get_num_bags
()
const
;
57
64
void
set_bag_size
(int32_t bag_size);
65
72
int32_t
get_bag_size
()
const
;
73
79
CMachine
*
get_machine
()
const
;
80
86
void
set_machine
(
CMachine
* machine);
87
94
void
set_combination_rule
(
CCombinationRule
* rule);
95
101
CCombinationRule
*
get_combination_rule
()
const
;
102
107
virtual
EMachineType
get_classifier_type
() {
return
CT_BAGGING
; }
108
115
float64_t
get_oob_error
(
CEvaluation
* eval)
const
;
116
118
virtual
const
char
*
get_name
()
const
{
return
"BaggingMachine"
; }
119
120
protected
:
121
virtual
bool
train_machine
(
CFeatures
* data=NULL);
122
129
SGVector<float64_t>
apply_get_outputs
(
CFeatures
* data);
130
131
private
:
132
void
register_parameters();
133
void
init();
134
142
CDynamicArray<index_t>
* get_oob_indices(
const
SGVector<index_t>
& in_bag);
143
144
void
clear_oob_indicies();
145
146
private
:
148
CDynamicObjectArray
* m_bags;
149
151
CFeatures
* m_features;
152
154
CMachine
* m_machine;
155
157
int32_t m_num_bags;
158
160
int32_t m_bag_size;
161
163
CCombinationRule
* m_combination_rule;
164
166
SGVector<bool>
m_all_oob_idx;
167
169
CDynamicObjectArray
* m_oob_indices;
170
};
171
}
172
173
#endif
/* BAGGINGMACHINE_H */
SHOGUN
机器学习工具包 - 项目文档