|
CMP++: Uncertainty Quantification & Bayesian Calibration
|
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::VectorXs & | getLabels () 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. | |
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.
|
inline |
|
inline |
Randomly assigns each data point to a cluster uniformly at random.
| points | Matrix of points. |
|
inline |
Gets the randomly generated cluster labels.
|
private |
Vector of randomly assigned labels.
|
private |
Number of target clusters.
|
private |
Random number generator.