Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

CentroidCluster.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2002 University of Massachusetts.  All Rights Reserved.
00003  *
00004  * Use of the Lemur Toolkit for Language Modeling and Information Retrieval
00005  * is subject to the terms of the software license set forth in the LICENSE
00006  * file included with this software, and also available at
00007  * http://www.lemurproject.org/license.html
00008  *
00009  *==========================================================================
00010  */
00011 
00012 // David Fisher
00013 // init: 11/20/2002
00014 // Centroid clustering algorithms.
00015 #ifndef _CENTROIDCLUSTER_HPP
00016 #define _CENTROIDCLUSTER_HPP
00017 #include "Cluster.hpp"
00018 namespace lemur
00019 {
00020   namespace cluster 
00021   {    
00023     class CentroidCluster: public Cluster
00024     {
00025     public:
00027       CentroidCluster(int cid, const lemur::api::Index &ind, 
00028                       const SimilarityMethod &sim);
00030       virtual ~CentroidCluster() {
00031         delete(centroid);
00032         delete(weightedCentroid);
00033       };
00035       virtual double score(const ClusterRep *rep) const;
00037       virtual void add(const ClusterElt &elt);
00039       virtual void add(const vector<lemur::api::DOCID_T> docids);
00041       virtual void remove(const ClusterElt &elt);
00043       virtual bool read(ifstream &in);
00044 
00048       virtual ClusterRep *getClusterRep() const;
00049 
00051       virtual double sum2() const {return weightedCentroid->sum2(); }
00052   
00053     private:
00055       lemur::utility::FloatFreqVector *centroid;
00057       ClusterRep *weightedCentroid;
00059       lemur::utility::FloatFreqVector* readCentroid();
00064       void updateCentroid(lemur::utility::FloatFreqVector *v, bool first);
00065     };
00066   }
00067 }
00068 
00069 #endif

Generated on Tue Jun 15 11:02:53 2010 for Lemur by doxygen 1.3.4