SHOGUN
v2.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
classifier
NearestCentroid.h
Go to the documentation of this file.
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/lib/CoverTree.h
>
20
#include <
shogun/machine/DistanceMachine.h
>
21
22
namespace
shogun
23
{
24
25
class
CDistanceMachine;
26
33
class
CNearestCentroid
:
public
CDistanceMachine
{
34
35
public
:
36
38
MACHINE_PROBLEM_TYPE
(
PT_MULTICLASS
);
39
43
CNearestCentroid
();
44
50
CNearestCentroid
(
CDistance
*
distance
,
CLabels
* trainlab);
51
54
virtual
~CNearestCentroid
();
55
60
void
set_shrinking
(
float64_t
shrinking) {
61
m_shrinking
= shrinking ;
62
}
63
68
float64_t
get_shrinking
()
const
{
69
return
m_shrinking
;
70
}
71
76
CDenseFeatures<float64_t>
*
get_centroids
()
const
{
77
return
m_centroids
;
78
}
79
80
protected
:
89
virtual
bool
train_machine
(
CFeatures
* data=NULL);
90
96
private
:
97
void
init();
98
99
protected
:
101
int32_t
m_num_classes
;
102
104
float64_t
m_shrinking
;
105
107
CDenseFeatures<float64_t>
*
m_centroids
;
108
110
bool
m_is_trained
;
111
};
112
113
}
114
115
#endif
SHOGUN
Machine Learning Toolbox - Documentation