Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COUNT_DISTANCES is increased when verifying #24

Open
albertiniufu opened this issue Apr 9, 2019 · 1 comment
Open

COUNT_DISTANCES is increased when verifying #24

albertiniufu opened this issue Apr 9, 2019 · 1 comment

Comments

@albertiniufu
Copy link

COUNT_DISTANCES is increased whenever pointCenterDist2() is called.
I had expected COUNT_DISTANCES would represent count only during normal kmeans execution.

However, COUNT_DISTANCES is incremented inside verifyAssignment().

I suggest to fast-kmeans to not count distances when VERIFY_ASSIGNMENTS is defined.

Something like the following seems to work:

void Kmeans::verifyAssignment(int iteration, int startNdx, int endNdx) const {
    #ifdef VERIFY_ASSIGNMENTS
    #ifdef COUNT_DISTANCES 
     long long tmp = numDistances;
    #endif
 //  ...
 // code continues...
 //...
    #ifdef COUNT_DISTANCES 
    numDistances = tmp;
    #endif
    #endif                                                                                                                      
}
@albertiniufu albertiniufu changed the title COUNT_DISTANCES is increased even when only verifying COUNT_DISTANCES is increased when verifying Apr 9, 2019
@ghamerly
Copy link
Owner

ghamerly commented Jun 4, 2019

Thanks @albertiniufu, can you create a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants