OpenANN
1.1.0
An open source library for artificial neural networks.
Main Page
Classes
Files
List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
OpenANN
KMeans.h
Go to the documentation of this file.
1
#ifndef OPENANN_KMEANS_H_
2
#define OPENANN_KMEANS_H_
3
4
#include <
OpenANN/util/Random.h
>
5
#include <
OpenANN/Transformer.h
>
6
#include <Eigen/Core>
7
#include <vector>
8
9
namespace
OpenANN
10
{
11
25
class
KMeans
:
public
Transformer
26
{
27
const
int
D;
28
const
int
K;
29
Eigen::MatrixXd C;
30
Eigen::VectorXi v;
31
bool
initialized;
32
RandomNumberGenerator
rng;
33
std::vector<int> clusterIndices;
34
public
:
40
KMeans
(
int
D,
int
K);
41
42
virtual
Transformer
&
fit
(
const
Eigen::MatrixXd&
X
);
43
virtual
Eigen::MatrixXd
transform
(
const
Eigen::MatrixXd& X)
44
{
45
return
(*
this
)(
X
);
46
}
47
54
Eigen::MatrixXd
operator()
(
const
Eigen::MatrixXd& X);
55
60
Eigen::MatrixXd
getCenters
();
61
62
private
:
63
void
initialize(
const
Eigen::MatrixXd& X);
64
void
findClusters(
const
Eigen::MatrixXd& X);
65
void
updateCenters(
const
Eigen::MatrixXd& X);
66
};
67
68
}
// namespace OpenANN
69
70
#endif // OPENANN_KMEANS_H_
Generated on Wed Jul 9 2014 08:57:52 for OpenANN by
1.8.4