Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Cluster Class Reference

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

#include <Cluster.hpp>

Inheritance diagram for Cluster:

AgglomCluster CentroidCluster List of all members.

Public Methods

 Cluster (int cid, const 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< 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< 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
int size
double weight
const Indexind
fstream * datFile
long offset

Detailed Description

Cluster representation, a vector of cluster elements.


Constructor & Destructor Documentation

Cluster::Cluster int    cid,
const Index   ind,
const SimilarityMethod   sim
 

create empty cluster with specific id.

Cluster::~Cluster   [virtual]
 

delete cluster


Member Function Documentation

void Cluster::add const vector< DOCID_T   docids [virtual]
 

Add a list of documents to a cluster.

Reimplemented in CentroidCluster.

void Cluster::add const ClusterElt   elt [virtual]
 

add the element to this cluster

Reimplemented in CentroidCluster.

virtual ClusterRep* Cluster::getClusterRep   [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 AgglomCluster, and CentroidCluster.

vector< DOCID_T > Cluster::getDocIds  
 

get vector of doc ids in this cluster.

int Cluster::getId  
 

get cluster id.

const vector< ClusterElt > * Cluster::getIds  
 

get vector of elements in this cluster.

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

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

const string & Cluster::getName  
 

get cluster symbolic name.

int Cluster::getSize   const [inline]
 

How many elements.

void Cluster::merge const Cluster *    c [virtual]
 

merge in a cluster

void Cluster::print  
 

pretty print to stdout.

bool Cluster::read ifstream &    in [virtual]
 

read a cluster in from the cluster db file.

Reimplemented in CentroidCluster.

void Cluster::remove const ClusterElt   elt [virtual]
 

remove the element from this cluster

Reimplemented in CentroidCluster.

virtual double Cluster::score const ClusterRep   rep const [pure virtual]
 

score a document against this cluster, given the rep.

Implemented in AgglomCluster, and CentroidCluster.

void Cluster::setId int    cid
 

set cluster id.

void Cluster::setName const string &    newName
 

set cluster symbolic name.

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

Split this cluster into subclusters.

virtual double Cluster::sum2   const [inline, virtual]
 

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

Reimplemented in AgglomCluster, and CentroidCluster.

void Cluster::write ofstream &    out [virtual]
 

write a cluster to the cluster db file.


Member Data Documentation

fstream* Cluster::datFile [protected]
 

int Cluster::id [protected]
 

internal id

vector<ClusterElt> Cluster::ids [protected]
 

vector of cluster elements in this cluster.

const Index& Cluster::ind [protected]
 

string Cluster::name [protected]
 

external symbolic name.

long Cluster::offset [protected]
 

const SimilarityMethod& Cluster::similarity [protected]
 

int Cluster::size [protected]
 

double Cluster::weight [protected]
 


The documentation for this class was generated from the following files:
Generated on Wed Nov 3 12:59:26 2004 for Lemur Toolkit by doxygen1.2.18