Main MRPT website
>
C++ reference for MRPT 1.9.9
kmeans++
src/kmeans++/kmeans.h
Go to the documentation of this file.
1
/* +------------------------------------------------------------------------+
2
| Mobile Robot Programming Toolkit (MRPT) |
3
| http://www.mrpt.org/ |
4
| |
5
| Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6
| See: http://www.mrpt.org/Authors - All rights reserved. |
7
| Released under BSD License. See details in http://www.mrpt.org/License |
8
+------------------------------------------------------------------------+ */
9
// BEWARE: BETA VERSION
10
// --------------------
11
//
12
// The main set of utilities for runnning k-means and k-means++ on arbitrary
13
// data sets.
14
//
15
// Author: David Arthur (darthur@gmail.com), 2009
16
17
#ifndef KMEANS_H__
18
#define KMEANS_H__
19
20
// Includes
21
#include "
KmUtils.h
"
22
#include <iostream>
23
24
// Sets preferences for how much logging is done and where it is outputted, when
25
// k-means is run.
26
void
ClearKMeansLogging
();
27
void
AddKMeansLogging
(std::ostream* out,
bool
verbose);
28
29
// Runs k-means on the given set of points.
30
// - n: The number of points in the data set
31
// - k: The number of clusters to look for
32
// - d: The number of dimensions that the data set lives in
33
// - points: An array of size n*d where points[d*i + j] gives coordinate j of
34
// point i
35
// - attempts: The number of times to independently run k-means with different
36
// starting centers.
37
// The best result is always returned (as measured by the cost
38
// function).
39
// - centers: This can either be null or an array of size k*d. In the latter
40
// case, it will be
41
// filled with the locations of all final cluster centers.
42
// Specifically
43
// centers[d*i + j] will give coordinate j of center i. If the
44
// cluster is unused, it
45
// will contain NaN instead.
46
// - assignments: This can either be null or an array of size n. In the latter
47
// case, it will be
48
// filled with the cluster that each point is assigned to (an
49
// integer between 0
50
// and k-1 inclusive).
51
// The final cost of the clustering is also returned.
52
Scalar
RunKMeans
(
53
int
n
,
int
k,
int
d,
Scalar
*
points
,
int
attempts,
Scalar
* centers,
54
int
* assignments);
55
56
// Runs k-means++ on the given set of points. Set RunKMeans for info on the
57
// parameters.
58
Scalar
RunKMeansPlusPlus
(
59
int
n
,
int
k,
int
d,
Scalar
*
points
,
int
attempts,
Scalar
* centers,
60
int
* assignments);
61
62
#endif
n
GLenum GLsizei n
Definition:
glext.h:5074
KmUtils.h
points
GLsizei const GLfloat * points
Definition:
glext.h:5339
Scalar
double Scalar
Definition:
KmUtils.h:44
RunKMeansPlusPlus
Scalar RunKMeansPlusPlus(int n, int k, int d, Scalar *points, int attempts, Scalar *centers, int *assignments)
Definition:
kmeans++/KMeans.cpp:177
AddKMeansLogging
void AddKMeansLogging(std::ostream *out, bool verbose)
Definition:
kmeans++/KMeans.cpp:36
ClearKMeansLogging
void ClearKMeansLogging()
Definition:
kmeans++/KMeans.cpp:41
RunKMeans
Scalar RunKMeans(int n, int k, int d, Scalar *points, int attempts, Scalar *centers, int *assignments)
Definition:
kmeans++/KMeans.cpp:118
Page generated by
Doxygen 1.8.17
for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST