clusterer.h

Go to the documentation of this file.
00001 // Copyright 2007, Massachusetts Institute of Technology.
00002 // The use of this code is permitted for research only. There is
00003 // absolutely no warranty for this software.
00004 //
00005 // Author: John Lee (jjl@mit.edu)
00006 //
00007 #ifndef CLUSTERING_CLUSTERER_H
00008 #define CLUSTERING_CLUSTERER_H
00009 
00010 #include <vector>
00011 #include <iostream>
00012 #include "point_set/point-set.h"
00013 #include "point_set/point-ref.h"
00014 
00015 using namespace std;
00016 
00017 namespace libpmk {
00019 
00029 class Clusterer {
00030  public:
00031    Clusterer();
00032    virtual ~Clusterer() { }
00033 
00035 
00040    void Cluster(const vector<PointRef>& data);
00041 
00043 
00048    PointSet GetClusterCenters() const;
00049 
00051 
00055    int GetNumCenters() const;
00056 
00058 
00063    vector<int> GetMembership() const;
00064 
00066 
00086    void WriteToStream(ostream& output_stream) const;
00087 
00089    void WriteToFile(const char* output_filename) const;
00090 
00092 
00098    void ReadFromStream(istream& input_stream);
00099 
00101    void ReadFromFile(const char* input_filename);
00102 
00103  protected:
00104    auto_ptr<PointSet> cluster_centers_;
00105    vector<int> membership_;
00106    bool done_;
00107 
00109 
00117    virtual void DoClustering(const vector<PointRef>& data) = 0;
00118 };
00119 }  // namespace libpmk
00120 
00121 #endif  // CLUSTERING_CLUSTERER_H

Generated on Wed May 2 11:17:12 2007 for libpmk by  doxygen 1.5.1