MRPT  2.0.1
src/kmeans++/kmeans.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://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 #pragma once
18 
19 // Includes
20 #include <iostream>
21 #include "KmUtils.h"
22 
23 // Sets preferences for how much logging is done and where it is outputted, when
24 // k-means is run.
25 void ClearKMeansLogging();
26 void AddKMeansLogging(std::ostream* out, bool verbose);
27 
28 // Runs k-means on the given set of points.
29 // - n: The number of points in the data set
30 // - k: The number of clusters to look for
31 // - d: The number of dimensions that the data set lives in
32 // - points: An array of size n*d where points[d*i + j] gives coordinate j of
33 // point i
34 // - attempts: The number of times to independently run k-means with different
35 // starting centers.
36 // The best result is always returned (as measured by the cost
37 // function).
38 // - centers: This can either be null or an array of size k*d. In the latter
39 // case, it will be
40 // filled with the locations of all final cluster centers.
41 // Specifically
42 // centers[d*i + j] will give coordinate j of center i. If the
43 // cluster is unused, it
44 // will contain NaN instead.
45 // - assignments: This can either be null or an array of size n. In the latter
46 // case, it will be
47 // filled with the cluster that each point is assigned to (an
48 // integer between 0
49 // and k-1 inclusive).
50 // The final cost of the clustering is also returned.
52  int n, int k, int d, Scalar* points, int attempts, Scalar* centers,
53  int* assignments);
54 
55 // Runs k-means++ on the given set of points. Set RunKMeans for info on the
56 // parameters.
58  int n, int k, int d, Scalar* points, int attempts, Scalar* centers,
59  int* assignments);
double Scalar
Definition: KmUtils.h:43
Scalar RunKMeans(int n, int k, int d, Scalar *points, int attempts, Scalar *centers, int *assignments)
Scalar RunKMeansPlusPlus(int n, int k, int d, Scalar *points, int attempts, Scalar *centers, int *assignments)
void ClearKMeansLogging()
void AddKMeansLogging(std::ostream *out, bool verbose)
mrpt::vision::TStereoCalibResults out



Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020