SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
multiclass
ecoc
ECOCRandomDenseEncoder.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 ECOCRANDOMDENSEENCODER_H__
12
#define ECOCRANDOMDENSEENCODER_H__
13
14
#include <
shogun/multiclass/ecoc/ECOCEncoder.h
>
15
16
namespace
shogun
17
{
18
22
class
CECOCRandomDenseEncoder
:
public
CECOCEncoder
23
{
24
public
:
32
CECOCRandomDenseEncoder
(int32_t maxiter=10000, int32_t codelen=0,
float64_t
pposone=0.5);
33
35
virtual
~CECOCRandomDenseEncoder
() {}
36
40
void
set_probability
(
float64_t
pposone);
41
43
virtual
const
char
*
get_name
()
const
{
return
"ECOCRandomDenseEncoder"
; }
44
48
virtual
SGMatrix<int32_t>
create_codebook
(int32_t num_classes);
49
59
int32_t
get_default_code_length
(int32_t num_classes)
const
60
{
61
return
static_cast<
int32_t
>
(
CMath::round
(10 *
CMath::log
(num_classes)));
62
}
63
64
protected
:
65
int32_t
m_maxiter
;
66
int32_t
m_codelen
;
67
float64_t
m_pposone
;
68
69
private
:
73
bool
check_probability(
float64_t
pposone)
74
{
75
if
(pposone >= 0.999 || pposone <= 0.0001)
76
return
false
;
77
return
true
;
78
}
79
81
void
init();
82
};
83
84
}
// namespace shogun
85
86
#endif
/* end of include guard: ECOCRANDOMDENSEENCODER_H__ */
87
SHOGUN
机器学习工具包 - 项目文档