diff options
author | Paul Duncan <pabs@pablotron.org> | 2019-02-03 06:04:49 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2019-02-03 06:04:49 -0500 |
commit | f741aac2d3319900443d9f38ff4cff48b0484d7a (patch) | |
tree | 6476b734c63e8e7031933a44c985728f3894773f /main.c | |
parent | e5f97aafca24667ed6780a92d9bd451c66454b44 (diff) | |
download | kmeans-f741aac2d3319900443d9f38ff4cff48b0484d7a.tar.bz2 kmeans-f741aac2d3319900443d9f38ff4cff48b0484d7a.zip |
fix score
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 14 |
1 files changed, 3 insertions, 11 deletions
@@ -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 |