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

Fix ckmeans #125

Merged
merged 2 commits into from
Aug 17, 2015
Merged

Fix ckmeans #125

merged 2 commits into from
Aug 17, 2015

Conversation

llimllib
Copy link
Contributor

  • the withinss was being calculated incorrectly; ((data_idx - 1) / data_idx) * squared_difference ignores the first data point (0/1) instead of multiplying it by 1/2
  • the mean was being calculated incorrectly. On the second data point, where data_idx is 1, first_cluster_mean was being set to the sum of the first two numbers instead of half that sum, and so on for each index. subtracting one from data_idx does the trick.

Related to, but does not complete, #124 .

@tmcw
Copy link
Member

tmcw commented Aug 17, 2015

🙌 awesome!

tmcw added a commit that referenced this pull request Aug 17, 2015
@tmcw tmcw merged commit b938e56 into simple-statistics:master Aug 17, 2015
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

Successfully merging this pull request may close these issues.

None yet

2 participants