64 using Point = std::vector<float>;
74 Kmeans(
unsigned int num_points,
unsigned int num_dimensions);
106 if (num_points_ != data.size())
107 std::cout <<
"Data vector not the same" << std::endl;
115 if (num_dimensions_ != data_point.size())
116 std::cout <<
"Dimensions not the same" << std::endl;
118 data_.push_back(data_point);
135 auto cpy = y.cbegin();
136 for (
auto cpx = x.cbegin(), cpx_end = x.cend(); cpx != cpx_end; ++cpx, ++cpy) {
138 total += (diff * diff);
ClustersToPoints clusters_to_points_
unsigned int num_clusters_
The number of clusters.
void setInputData(std::vector< Point > &data)
unsigned int num_dimensions_
Centroids get_centroids()
std::vector< float > Point
void initialClusterPoints()
void addDataPoint(Point &data_point)
void setClusterSize(unsigned int k)
This method sets the k-means cluster size.
std::vector< ClusterId > PointsToClusters
std::vector< Point > Centroids
PointsToClusters points_to_clusters_
std::vector< SetPoints > ClustersToPoints
float distance(const Point &x, const Point &y)
std::set< PointId > SetPoints
std::vector< Point > data_
The cluster centroids.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Defines functions, macros and traits for allocating and using memory.
Defines all the PCL and non-PCL macros used.