I'm refactoring a C++ code doing kmean clustering. There are two version of the code:
- Normal kmean
- Feature aligned clustering: use slightly different distance metric and update rule.
How should I implement this effectively? Method overloading (this doesn't depend on input though)
OK so this is the pseudocode doing kmean clustering. I need to implement two versions of distance and update function.
int* kmean_clustering(vector<double[10]> data)
// each row of data hold one data point
// so we have M data points of 10 dimension
{
// Split codebook
// Assignment step
Find the closest codebook based on distance(distance here can be Euclidean, Mahalanobis, .....)
//Update step
}