Main MRPT website > C++ reference for MRPT 1.5.9
src/math/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-2017, 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 data sets.
13 //
14 // Author: David Arthur (darthur@gmail.com), 2009
15 
16 #ifndef KMEANS_H__
17 #define KMEANS_H__
18 
19 // Includes
20 #include "KmUtils.h"
21 #include <iostream>
22 
23 // Sets preferences for how much logging is done and where it is outputted, when k-means is run.
24 void ClearKMeansLogging();
25 void AddKMeansLogging(std::ostream *out, bool verbose);
26 
27 // Runs k-means on the given set of points.
28 // - n: The number of points in the data set
29 // - k: The number of clusters to look for
30 // - d: The number of dimensions that the data set lives in
31 // - points: An array of size n*d where points[d*i + j] gives coordinate j of point i
32 // - attempts: The number of times to independently run k-means with different starting centers.
33 // The best result is always returned (as measured by the cost function).
34 // - centers: This can either be null or an array of size k*d. In the latter case, it will be
35 // filled with the locations of all final cluster centers. Specifically
36 // centers[d*i + j] will give coordinate j of center i. If the cluster is unused, it
37 // will contain NaN instead.
38 // - assignments: This can either be null or an array of size n. In the latter case, it will be
39 // filled with the cluster that each point is assigned to (an integer between 0
40 // and k-1 inclusive).
41 // The final cost of the clustering is also returned.
42 Scalar RunKMeans(int n, int k, int d, Scalar *points, int attempts,
43  Scalar *centers, int *assignments);
44 
45 // Runs k-means++ on the given set of points. Set RunKMeans for info on the parameters.
46 Scalar RunKMeansPlusPlus(int n, int k, int d, Scalar *points, int attempts,
47  Scalar *centers, int *assignments);
48 
49 #endif
void AddKMeansLogging(std::ostream *out, bool verbose)
GLenum GLsizei n
Definition: glext.h:4618
GLsizei const GLfloat * points
Definition: glext.h:4797
Scalar RunKMeansPlusPlus(int n, int k, int d, Scalar *points, int attempts, Scalar *centers, int *assignments)
void ClearKMeansLogging()
double Scalar
Definition: KmUtils.h:41
Scalar RunKMeans(int n, int k, int d, Scalar *points, int attempts, Scalar *centers, int *assignments)



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020