CMP++: Uncertainty Quantification & Bayesian Calibration
Loading...
Searching...
No Matches
cmp::cluster::DummyCluster Class Reference

Simple partitioning algorithm that assigns observations to clusters uniformly at random. More...

#include <cluster.h>

Public Member Functions

 DummyCluster (size_t nClusters, unsigned int seed=42)
 
void fit (const Eigen::Ref< const Eigen::MatrixXd > &points)
 Randomly assigns each data point to a cluster uniformly at random.
 
const Eigen::VectorXsgetLabels () const
 Gets the randomly generated cluster labels.
 

Private Attributes

size_t nClusters_
 Number of target clusters.
 
std::default_random_engine rng_
 Random number generator.
 
Eigen::VectorXs labels_
 Vector of randomly assigned labels.
 

Detailed Description

Simple partitioning algorithm that assigns observations to clusters uniformly at random.

Mathematical Formulation Each sample index \(i\) is assigned a cluster assignment variable \(z_i\) drawn from a discrete uniform distribution:

\[ P(z_i = k) = \frac{1}{K}, \quad k \in \{0, 1, \dots, K-1\} \]

where \(K\) is the number of target clusters.

Implementation Algorithm The fit() function constructs a std::uniform_int_distribution and samples an integer in the range \([0, K-1]\) for each data point sequentially.

Constructor & Destructor Documentation

◆ DummyCluster()

cmp::cluster::DummyCluster::DummyCluster ( size_t  nClusters,
unsigned int  seed = 42 
)
inline

Member Function Documentation

◆ fit()

void cmp::cluster::DummyCluster::fit ( const Eigen::Ref< const Eigen::MatrixXd > &  points)
inline

Randomly assigns each data point to a cluster uniformly at random.

Parameters
pointsMatrix of points.

◆ getLabels()

const Eigen::VectorXs & cmp::cluster::DummyCluster::getLabels ( ) const
inline

Gets the randomly generated cluster labels.

Returns
Reference to the label vector.

Member Data Documentation

◆ labels_

Eigen::VectorXs cmp::cluster::DummyCluster::labels_
private

Vector of randomly assigned labels.

◆ nClusters_

size_t cmp::cluster::DummyCluster::nClusters_
private

Number of target clusters.

◆ rng_

std::default_random_engine cmp::cluster::DummyCluster::rng_
private

Random number generator.


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