SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
classifier
NearestCentroid.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 Philippe Tillet
8
*/
9
10
#ifndef _NEAREST_CENTROID_H__
11
#define _NEAREST_CENTROID_H__
12
13
#include <stdio.h>
14
#include <
shogun/lib/common.h
>
15
#include <
shogun/io/SGIO.h
>
16
#include <
shogun/features/Features.h
>
17
#include <
shogun/features/DenseFeatures.h
>
18
#include <
shogun/distance/Distance.h
>
19
#include <
shogun/machine/DistanceMachine.h
>
20
21
namespace
shogun
22
{
23
24
class
CDistanceMachine;
25
32
class
CNearestCentroid
:
public
CDistanceMachine
{
33
34
public
:
35
37
MACHINE_PROBLEM_TYPE
(
PT_MULTICLASS
);
38
42
CNearestCentroid
();
43
49
CNearestCentroid
(
CDistance
*
distance
,
CLabels
* trainlab);
50
53
virtual
~CNearestCentroid
();
54
59
void
set_shrinking
(
float64_t
shrinking) {
60
m_shrinking
= shrinking ;
61
}
62
67
float64_t
get_shrinking
()
const
{
68
return
m_shrinking
;
69
}
70
75
CDenseFeatures<float64_t>
*
get_centroids
()
const
{
76
return
m_centroids
;
77
}
78
83
virtual
const
char
*
get_name
()
const
{
return
"NearestCentroid"
; }
84
85
protected
:
94
virtual
bool
train_machine
(
CFeatures
* data=NULL);
95
101
private
:
102
void
init();
103
104
protected
:
106
int32_t
m_num_classes
;
107
109
float64_t
m_shrinking
;
110
112
CDenseFeatures<float64_t>
*
m_centroids
;
113
115
bool
m_is_trained
;
116
};
117
118
}
119
120
#endif
SHOGUN
机器学习工具包 - 项目文档