From 05b35386982e4441305dbab567bb377efbe93c10 Mon Sep 17 00:00:00 2001 From: Davis King Date: Sun, 15 Jun 2008 15:16:26 +0000 Subject: [PATCH] updated the kkmeans example --HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402321 --- examples/kkmeans_ex.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/kkmeans_ex.cpp b/examples/kkmeans_ex.cpp index 984411495..230b18815 100644 --- a/examples/kkmeans_ex.cpp +++ b/examples/kkmeans_ex.cpp @@ -101,10 +101,9 @@ int main() test.set_number_of_centers(3); // You need to pick some initial centers for the k-means algorithm. So here - // we will pick a point from each of the classes. - initial_centers.push_back(samples[0]); - initial_centers.push_back(samples[num]); - initial_centers.push_back(samples[num*2]); + // we will use the dlib::pick_initial_centers() function which tries to find + // n points that are far apart (basically). + pick_initial_centers(3, initial_centers, samples, test.get_kernel()); // now run the k-means algorithm on our set of samples. Note that the train function expects // its arguments to be dlib::matrix objects so since we have our samples in std::vector objects