From 33a722132491ebdd31722f0cada0f81f6b082282 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 3 Feb 2019 18:36:52 -0500 Subject: cluster init refactoring, fix best sort, add km_score() --- km.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'km.h') diff --git a/km.h b/km.h index c70e13e..6f09009 100644 --- a/km.h +++ b/km.h @@ -5,6 +5,14 @@ #include // uint8_t #include // FILE +typedef enum { + KM_INIT_TYPE_RAND, + KM_INIT_TYPE_FORGY, + KM_INIT_TYPE_LAST, +} km_init_type_t; + +km_init_type_t km_get_init_type(const char * const); + // forward typedef for callbacks typedef struct km_rand_t_ km_rand_t; @@ -77,21 +85,19 @@ _Bool km_set_normalize(km_set_t * const); // get pointer to data set row float *km_set_get_row(const km_set_t *, const size_t); -// init a set with num_clusters clusters of shape num_floats by picking -// random cluster centers -_Bool km_set_init_rand_clusters( +// init cluster set by picking random centroids +_Bool km_init_rand( km_set_t *, const size_t, const size_t, km_rand_t * ); -// init a set with num_clusters clusters of random points from the -// given set -_Bool km_set_init_rand_points( +// init cluster set by picking random rows from set +_Bool km_init_forgy( km_set_t * const, - const km_set_t * const, const size_t, + const km_set_t * const, km_rand_t * ); @@ -134,8 +140,8 @@ typedef struct { typedef _Bool (*km_find_init_cb_t)( km_set_t * const cluster_set, - const size_t num_floats, const size_t num_clusters, + const km_set_t * const data_set, void *cb_data ); -- cgit v1.2.3