aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2019-02-03 06:04:49 -0500
committerPaul Duncan <pabs@pablotron.org>2019-02-03 06:04:49 -0500
commitf741aac2d3319900443d9f38ff4cff48b0484d7a (patch)
tree6476b734c63e8e7031933a44c985728f3894773f /main.c
parente5f97aafca24667ed6780a92d9bd451c66454b44 (diff)
downloadkmeans-f741aac2d3319900443d9f38ff4cff48b0484d7a.tar.bz2
kmeans-f741aac2d3319900443d9f38ff4cff48b0484d7a.zip
fix score
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/main.c b/main.c
index af04121..e81475d 100644
--- a/main.c
+++ b/main.c
@@ -131,18 +131,10 @@ get_score(
return 0;
}
// const size_t num_clusters = ofs + 2;
- const float mean_empty_clusters = 1.0 * find_data->rows[ofs].num_empty_clusters / NUM_TESTS;
+ const float mean_distance = find_data->rows[ofs].distance / NUM_TESTS,
+ mean_empty = 1.0 * find_data->rows[ofs].num_empty_clusters / NUM_TESTS;
- const float ds[3] = {
- find_data->rows[ofs - 1].distance / NUM_TESTS,
- find_data->rows[ofs + 0].distance / NUM_TESTS,
- find_data->rows[ofs + 1].distance / NUM_TESTS,
- };
-
- return (
- (fabsf(ds[0] - ds[1]) / fabsf(ds[1] - ds[2])) +
- -2.0 * mean_empty_clusters
- );
+ return 1.0 / (mean_distance + mean_empty);
}
static void