xapian-core  2.0.0
Public Member Functions | Private Attributes | List of all members
Xapian::Cluster Class Reference

Class to represents a Cluster which contains Points and Centroid of the Cluster. More...

#include <cluster.h>

+ Collaboration diagram for Xapian::Cluster:

Public Member Functions

 Cluster (const Cluster &other)
 Copying is allowed. More...
 
Clusteroperator= (const Cluster &other)
 Assignment is allowed. More...
 
 Cluster (Cluster &&other)
 Move constructor. More...
 
Clusteroperator= (Cluster &&other)
 Move assignment operator. More...
 
 Cluster (const Centroid &centroid)
 Constructor. More...
 
 Cluster ()
 Default constructor. More...
 
 ~Cluster ()
 Destructor. More...
 
Xapian::doccount size () const
 Return size of the cluster. More...
 
void add_point (const Point &point)
 Add a document to the Cluster. More...
 
void clear ()
 Clear the cluster weights. More...
 
const Pointoperator[] (Xapian::doccount i) const
 Return the point at the given index in the cluster. More...
 
DocumentSet get_documents () const
 Return the documents that are contained within the cluster. More...
 
const Centroidget_centroid () const
 Return the current centroid of the cluster. More...
 
void set_centroid (const Centroid &centroid)
 Set the centroid of the Cluster to 'centroid'. More...
 
void recalculate ()
 Recalculate the centroid of the Cluster after each iteration of the KMeans algorithm by taking the mean of all document vectors (Points) that belong to the Cluster. More...
 

Private Attributes

Xapian::Internal::intrusive_ptr_nonnull< Internal > internal
 

Detailed Description

Class to represents a Cluster which contains Points and Centroid of the Cluster.

Definition at line 370 of file cluster.h.

Constructor & Destructor Documentation

◆ Cluster() [1/4]

Xapian::Cluster::Cluster ( const Cluster other)

Copying is allowed.

The internals are reference counted, so copying is cheap.

Parameters
otherThe object to copy.

◆ Cluster() [2/4]

Xapian::Cluster::Cluster ( Cluster &&  other)

Move constructor.

Parameters
otherThe object to move.

◆ Cluster() [3/4]

Xapian::Cluster::Cluster ( const Centroid centroid)
explicit

Constructor.

Parameters
centroidThe centroid of the cluster object is assigned to 'centroid'

◆ Cluster() [4/4]

Xapian::Cluster::Cluster ( )

Default constructor.

◆ ~Cluster()

Xapian::Cluster::~Cluster ( )

Destructor.

Member Function Documentation

◆ add_point()

void Xapian::Cluster::add_point ( const Point point)

Add a document to the Cluster.

Parameters
pointThe Point object representing the document which needs to be added to the cluster

◆ clear()

void Xapian::Cluster::clear ( )

Clear the cluster weights.

◆ get_centroid()

const Centroid& Xapian::Cluster::get_centroid ( ) const

Return the current centroid of the cluster.

◆ get_documents()

DocumentSet Xapian::Cluster::get_documents ( ) const

Return the documents that are contained within the cluster.

◆ operator=() [1/2]

Cluster& Xapian::Cluster::operator= ( Cluster &&  other)

Move assignment operator.

Parameters
otherThe object to move.

◆ operator=() [2/2]

Cluster& Xapian::Cluster::operator= ( const Cluster other)

Assignment is allowed.

The internals are reference counted, so assignment is cheap.

Parameters
otherThe object to copy.

◆ operator[]()

const Point& Xapian::Cluster::operator[] ( Xapian::doccount  i) const

Return the point at the given index in the cluster.

◆ recalculate()

void Xapian::Cluster::recalculate ( )

Recalculate the centroid of the Cluster after each iteration of the KMeans algorithm by taking the mean of all document vectors (Points) that belong to the Cluster.

◆ set_centroid()

void Xapian::Cluster::set_centroid ( const Centroid centroid)

Set the centroid of the Cluster to 'centroid'.

Parameters
centroidCentroid object for the Cluster

◆ size()

Xapian::doccount Xapian::Cluster::size ( ) const

Return size of the cluster.

Member Data Documentation

◆ internal

Xapian::Internal::intrusive_ptr_nonnull<Internal> Xapian::Cluster::internal
private

Reference counted internals.

Definition at line 374 of file cluster.h.


The documentation for this class was generated from the following file: