Inferensys

Glossary

Cluster Centroids

An under-sampling method that replaces clusters of majority class samples with their centroid, using K-means clustering to generate a reduced, representative set of majority class data points.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
UNDER-SAMPLING TECHNIQUE

What is Cluster Centroids?

Cluster Centroids is an under-sampling method that replaces clusters of majority class samples with their representative centroid, using K-means clustering to generate a reduced set of majority class data points.

Cluster Centroids is a prototype-based under-sampling technique that uses K-means clustering to group the majority class into k clusters and then replaces each cluster with its geometric center, or centroid. This method retains the underlying structure of the majority class while drastically reducing its size to match the minority class count, preventing the model from being overwhelmed by non-fraudulent transactions.

Unlike random under-sampling, which can discard critical information near the decision boundary, Cluster Centroids preserves the data distribution by representing dense regions with a single synthetic point. The number of clusters k is typically set to the number of minority class samples, creating a perfectly balanced dataset. However, the generated centroids are artificial points that may not represent actual, observable transaction features, which can be a limitation for highly interpretable models.

UNDER-SAMPLING MECHANICS

Key Features of Cluster Centroids

Cluster Centroids is a prototype-based under-sampling method that uses K-means clustering to replace the majority class with a compact set of representative centroids, preserving data topology while balancing class distribution.

01

K-Means Prototype Generation

The algorithm applies K-means clustering to the majority class, setting K equal to the number of minority class samples. Each cluster is then replaced by its centroid—the arithmetic mean of all points in that cluster. This transforms the majority class from raw, potentially redundant instances into a set of synthetic prototypes that capture the underlying data distribution. Unlike random under-sampling, which discards information, this method retains the topological structure of the majority class by preserving its natural groupings.

02

Distance Metric Sensitivity

The quality of the generated centroids depends heavily on the chosen distance metric. Euclidean distance is the default but may perform poorly on high-dimensional or categorical financial data. Alternatives include:

  • Manhattan distance for grid-like feature spaces
  • Cosine similarity for directional transaction vectors
  • Mahalanobis distance when features are correlated Poor metric selection can produce centroids that misrepresent the true cluster structure, degrading downstream classifier performance.
03

Handling High-Dimensional Transaction Data

In fraud detection, transaction features often span hundreds of dimensions. K-means suffers from the curse of dimensionality, where distance measures become less meaningful. To mitigate this:

  • Apply PCA or t-SNE for dimensionality reduction before clustering
  • Use feature selection to retain only high-information attributes
  • Consider bisecting K-means for more stable cluster assignments Without preprocessing, centroids may converge to poor local optima, failing to represent the majority class distribution accurately.
04

Computational Complexity and Scalability

The standard K-means implementation has a time complexity of O(n * K * d * i), where n is the number of majority samples, K is the number of clusters, d is dimensionality, and i is iterations. For large-scale payment networks with millions of legitimate transactions, this becomes computationally expensive. Optimizations include:

  • Mini-batch K-means for stochastic gradient descent updates
  • K-means++ initialization for faster convergence
  • Parallelized implementations on distributed computing frameworks These techniques make Cluster Centroids viable for production fraud pipelines.
05

Impact on Decision Boundaries

By replacing dense clusters of majority samples with single centroids, the method effectively shrinks the majority class region in feature space. This can:

  • Clarify the decision boundary by removing overlapping majority instances
  • Increase minority class recall as the classifier is less overwhelmed
  • Risk information loss if clusters are heterogeneous or contain critical boundary examples Pairing Cluster Centroids with Tomek Links cleaning can further refine the boundary by removing centroids that sit too close to minority class instances.
06

Integration with Ensemble Methods

Cluster Centroids can be embedded within ensemble frameworks to recover information lost during under-sampling. EasyEnsemble and BalanceCascade are two architectures that train multiple classifiers on different centroid-based under-sampled subsets. Each iteration can use a different random seed for K-means initialization, producing diverse views of the majority class. The ensemble aggregates predictions, often outperforming a single centroid-based model while maintaining the computational benefits of reduced training data.

CLUSTER CENTROIDS EXPLAINED

Frequently Asked Questions

Clear, technical answers to the most common questions about using Cluster Centroids for under-sampling imbalanced financial fraud datasets.

Cluster Centroids is a prototype-based under-sampling technique that replaces groups of majority class samples with their representative centroid, using K-means clustering to generate a reduced, representative set of majority class data points. The algorithm first partitions the majority class into k clusters, where k is typically set to the number of minority class samples. It then computes the geometric center (centroid) of each cluster by averaging the feature values of all members. These centroids become the new synthetic majority class representatives, replacing the original dense clusters. This approach preserves the underlying data distribution and central tendencies of the majority class while drastically reducing its volume, unlike random under-sampling which may discard critical boundary information. The method is particularly effective in financial fraud anomaly detection where legitimate transaction patterns form natural clusters that can be summarized without losing their defining characteristics.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.