00001
00002
00003
00004
00005
00006
00007
00008 #ifndef CLUSTERING_K_MEANS_CLUSTERER_H
00009 #define CLUSTERING_K_MEANS_CLUSTERER_H
00010
00011 #include <vector>
00012 #include "clustering/clusterer.h"
00013 #include "point_set/point-ref.h"
00014 #include "util/distance-computer.h"
00015
00016 using namespace std;
00017
00018 namespace libpmk {
00020
00037 class KMeansClusterer : public Clusterer {
00038 public:
00039 KMeansClusterer(int num_clusters, int max_iters,
00040 const DistanceComputer& distance_computer);
00041
00042 protected:
00044
00052 virtual void DoClustering(const vector<PointRef>& data);
00053
00054 private:
00055 int num_clusters_;
00056 int max_iterations_;
00057 const DistanceComputer& distance_computer_;
00058
00059 void ComputeMembership(const vector<PointRef>& data);
00060
00061
00062
00063 bool ComputeMeans(const vector<PointRef>& data);
00064 };
00065 }
00066
00067 #endif // CLUSTERING_K_MEANS_CLUSTERER_H
00068