Thrill
0.1
|
Model returned by KMeans algorithm containing results.
Definition at line 73 of file k-means.hpp.
#include <k-means.hpp>
Public Member Functions | |
KMeansModel (size_t dimensions, size_t num_clusters, size_t iterations, const std::vector< Point > ¢roids) | |
Accessors | |
size_t | dimensions () const |
Returns dimensions_. More... | |
size_t | num_clusters () const |
Returns number of clusters. More... | |
size_t | iterations () const |
Returns iterations_. More... | |
const std::vector< Point > & | centroids () const |
Returns centroids_. More... | |
Classification | |
size_t | Classify (const Point &p) const |
Calculate closest cluster to point. More... | |
template<typename PointDIA > | |
auto | Classify (const PointDIA &points) const |
template<typename PointDIA > | |
auto | ClassifyPairs (const PointDIA &points) const |
double | ComputeCost (const Point &p) const |
Calculate the k-means cost: the squared distance to the nearest center. More... | |
template<typename PointDIA > | |
double | ComputeCost (const PointDIA &points) const |
Private Attributes | |
std::vector< Point > | centroids_ |
computed centroids in cluster id order More... | |
size_t | dimensions_ |
dimensions of space More... | |
size_t | iterations_ |
number of iterations More... | |
size_t | num_clusters_ |
number of clusters More... | |
|
inline |
Definition at line 76 of file k-means.hpp.
|
inline |
Returns centroids_.
Definition at line 95 of file k-means.hpp.
|
inline |
Calculate closest cluster to point.
Definition at line 103 of file k-means.hpp.
References Vector< D, Type >::DistanceSquare().
|
inline |
Calculate closest cluster to all points, returns DIA containing only the cluster ids.
Definition at line 119 of file k-means.hpp.
References CentroidAccumulated< Point >::p.
|
inline |
Calculate closest cluster to all points, returns DIA contains pairs of points and their cluster id.
Definition at line 127 of file k-means.hpp.
References CentroidAccumulated< Point >::p.
|
inline |
Calculate the k-means cost: the squared distance to the nearest center.
Definition at line 135 of file k-means.hpp.
References Vector< D, Type >::DistanceSquare().
|
inline |
Calculate the overall k-means cost: the sum of squared distances to their nearest center.
Definition at line 149 of file k-means.hpp.
References CentroidAccumulated< Point >::p.
|
inline |
Returns dimensions_.
Definition at line 86 of file k-means.hpp.
|
inline |
Returns iterations_.
Definition at line 92 of file k-means.hpp.
|
inline |
Returns number of clusters.
Definition at line 89 of file k-means.hpp.
|
private |
computed centroids in cluster id order
Definition at line 168 of file k-means.hpp.
|
private |
dimensions of space
Definition at line 159 of file k-means.hpp.
|
private |
number of iterations
Definition at line 165 of file k-means.hpp.
|
private |
number of clusters
Definition at line 162 of file k-means.hpp.