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

lemur::cluster::Cluster Class Reference

Cluster representation, a vector of cluster elements. More...

#include <Cluster.hpp>

Inheritance diagram for lemur::cluster::Cluster:

lemur::cluster::AgglomCluster lemur::cluster::CentroidCluster List of all members.

Public Member Functions

 Cluster (int cid, const lemur::api::Index &ind, const SimilarityMethod &sim)
 create empty cluster with specific id.

virtual ~Cluster ()
 delete cluster

void setId (int cid)
 set cluster id.

void setName (const string &newName)
 set cluster symbolic name.

int getId () const
 get cluster id.

const string & getName () const
 get cluster symbolic name.

const vector< ClusterElt > * getIds () const
 get vector of elements in this cluster.

vector< lemur::api::DOCID_TgetDocIds () const
 get vector of doc ids in this cluster.

virtual ClusterRepgetClusterRep () const =0
 Get the ClusterRep for this Cluster for scoring. The Rep will have been weighted by the SimilarityMethod. Caller responsible for deleting.

virtual double score (const ClusterRep *rep) const =0
 score a document against this cluster, given the rep.

virtual void add (const ClusterElt &elt)
 add the element to this cluster

virtual void add (const vector< lemur::api::DOCID_T > docids)
 Add a list of documents to a cluster.

virtual void remove (const ClusterElt &elt)
 remove the element from this cluster

virtual vector< Cluster * > split (int numParts=2)
 Split this cluster into subclusters.

virtual void merge (const Cluster *c)
 merge in a cluster

virtual bool read (ifstream &in)
 read a cluster in from the cluster db file.

virtual void write (ofstream &out)
 write a cluster to the cluster db file.

void print () const
 pretty print to stdout.

int getSize () const
 How many elements.

virtual double sum2 () const
 Sum of squared values in the cluster's term vector.

virtual string getKeyWords (int numTerms=10) const
 Return the top numTerms terms in the cluster (tf.idf scores).


Protected Attributes

int id
 internal id

string name
 external symbolic name.

vector< ClusterEltids
 vector of cluster elements in this cluster.

const SimilarityMethodsimilarity
 The SimilarityMethod to use for weighting.

int size
 size of the cluster

double weight
const lemur::api::Indexind
fstream * datFile
long offset

Detailed Description

Cluster representation, a vector of cluster elements.


Constructor & Destructor Documentation

lemur::cluster::Cluster::Cluster int  cid,
const lemur::api::Index ind,
const SimilarityMethod sim
 

create empty cluster with specific id.

lemur::cluster::Cluster::~Cluster  )  [virtual]
 

delete cluster


Member Function Documentation

void lemur::cluster::Cluster::add const vector< lemur::api::DOCID_T docids  )  [virtual]
 

Add a list of documents to a cluster.

Reimplemented in lemur::cluster::CentroidCluster.

void lemur::cluster::Cluster::add const ClusterElt elt  )  [virtual]
 

add the element to this cluster

Reimplemented in lemur::cluster::CentroidCluster.

virtual ClusterRep* lemur::cluster::Cluster::getClusterRep  )  const [pure virtual]
 

Get the ClusterRep for this Cluster for scoring. The Rep will have been weighted by the SimilarityMethod. Caller responsible for deleting.

Implemented in lemur::cluster::AgglomCluster, and lemur::cluster::CentroidCluster.

vector< DOCID_T > lemur::cluster::Cluster::getDocIds  )  const
 

get vector of doc ids in this cluster.

int lemur::cluster::Cluster::getId  )  const
 

get cluster id.

const vector< lemur::cluster::ClusterElt > * lemur::cluster::Cluster::getIds  )  const
 

get vector of elements in this cluster.

string lemur::cluster::Cluster::getKeyWords int  numTerms = 10  )  const [virtual]
 

Return the top numTerms terms in the cluster (tf.idf scores).

const string & lemur::cluster::Cluster::getName  )  const
 

get cluster symbolic name.

int lemur::cluster::Cluster::getSize  )  const [inline]
 

How many elements.

void lemur::cluster::Cluster::merge const Cluster c  )  [virtual]
 

merge in a cluster

void lemur::cluster::Cluster::print  )  const
 

pretty print to stdout.

bool lemur::cluster::Cluster::read ifstream &  in  )  [virtual]
 

read a cluster in from the cluster db file.

Reimplemented in lemur::cluster::CentroidCluster.

void lemur::cluster::Cluster::remove const ClusterElt elt  )  [virtual]
 

remove the element from this cluster

Reimplemented in lemur::cluster::CentroidCluster.

virtual double lemur::cluster::Cluster::score const ClusterRep rep  )  const [pure virtual]
 

score a document against this cluster, given the rep.

Implemented in lemur::cluster::AgglomCluster, and lemur::cluster::CentroidCluster.

void lemur::cluster::Cluster::setId int  cid  ) 
 

set cluster id.

void lemur::cluster::Cluster::setName const string &  newName  ) 
 

set cluster symbolic name.

vector< lemur::cluster::Cluster * > lemur::cluster::Cluster::split int  numParts = 2  )  [virtual]
 

Split this cluster into subclusters.

virtual double lemur::cluster::Cluster::sum2  )  const [inline, virtual]
 

Sum of squared values in the cluster's term vector.

Reimplemented in lemur::cluster::AgglomCluster, and lemur::cluster::CentroidCluster.

void lemur::cluster::Cluster::write ofstream &  out  )  [virtual]
 

write a cluster to the cluster db file.


Member Data Documentation

fstream* lemur::cluster::Cluster::datFile [protected]
 

int lemur::cluster::Cluster::id [protected]
 

internal id

vector<ClusterElt> lemur::cluster::Cluster::ids [protected]
 

vector of cluster elements in this cluster.

const lemur::api::Index& lemur::cluster::Cluster::ind [protected]
 

string lemur::cluster::Cluster::name [protected]
 

external symbolic name.

long lemur::cluster::Cluster::offset [protected]
 

const SimilarityMethod& lemur::cluster::Cluster::similarity [protected]
 

The SimilarityMethod to use for weighting.

int lemur::cluster::Cluster::size [protected]
 

size of the cluster

double lemur::cluster::Cluster::weight [protected]
 


The documentation for this class was generated from the following files:
Generated on Tue Jun 15 11:03:05 2010 for Lemur by doxygen 1.3.4