aboutsummaryrefslogtreecommitdiff
path: root/km-find.c
diff options
context:
space:
mode:
Diffstat (limited to 'km-find.c')
-rw-r--r--km-find.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/km-find.c b/km-find.c
index 7ed9a6a..8e7f9ac 100644
--- a/km-find.c
+++ b/km-find.c
@@ -5,14 +5,6 @@
#define MIN_CLUSTER_DISTANCE 0.0001
-static float
-get_score(
- const float mean_distance,
- const size_t num_empty
-) {
- return 1.0 / (mean_distance + num_empty);
-}
-
typedef struct {
float distance_sum,
variance_sum;
@@ -108,7 +100,7 @@ km_find(
for (size_t j = 0; j < cbs->num_tests; j++) {
// init cluster set
km_set_t cs;
- if (!cbs->on_init(&cs, set->shape.num_floats, i, cb_data)) {
+ if (!cbs->on_init(&cs, i, set, cb_data)) {
// return failure
return false;
}
@@ -140,7 +132,7 @@ km_find(
cbs->on_data(&result, cb_data);
// score result
- float score = get_score(result.mean_distance, result.num_empty_clusters);
+ float score = km_score(result.mean_distance, result.num_empty_clusters);
if (score > best_score) {
// emit new best result