Structural Bioinformatics Library
Template C++ / Python API for developping structural bioinformatics applications.
|
K-means algorithm. More...
#include <Cluster_engine_k_means.hpp>
Constructors | |
T_Cluster_engine_k_means (void) | |
T_Cluster_engine_k_means (void) | |
Internal Methods | |
template<class InputIterator > | |
FT | get_score (InputIterator begin, InputIterator end, const std::vector< Center_of_mass > ¢ers, const std::vector< std::size_t > &p2c_map) const |
template<class InputIterator > | |
K_means_scores | get_scores (InputIterator begin, InputIterator end) const |
K-means algorithm.
\sbl_add_package_main_class{Cluster_engines, T_Cluster_engine_k_means, K-means algorithm,
Centers are stored in a vector. At the end of each iteration\, each center is replaced by the center of mass of points assigned to it. Note that the com is actually computed by accumulating the coords of points during the assignment\, with proper normalization once all assignments have been done.
The assignment of points to centers is recorded indirectly using the vector m_point_to_NN1_index: its i-th entry is the index of the NN of the i-th data point Likewise, m_point_NN2_index retains the second NN of each data point.
Complexity-wise\, the assignment of points to centers is made in a linear pass. we do not use a search DS since the centers only "live" one iteration.
PointType | Representation of a point. |
VectorType | Representation of a vector. |
Distance | Compute the distance between two points. |
}
Centers are stored in a vector. At the end of each iteration, each center is replaced by the center of mass of points assigned to it. Note that the com is actually computed by accumulating the coords of points during the assignment, with proper normalization once all assignments have been done.
The assignment of points to centers is recorded indirectly. That is, we maintain a vector (point2center_index) whose i-th entry is an iterator (pointer) onto the vector of centers.
Complexity-wise, the assignment of points to centers is made in a linear pass. we do not use a search DS since the centers only "live" one iteration.
PointType | Representation of a point. |
VectorType | Representation of a vector. |
Distance | Compute the distance between two points. |