A data analysis pipeline is a structured sequence of steps that transforms raw data into meaningful insights by integrating multiple analysis algorithms. In many practical applications, analytical findings are obtained only after data pass through several data-dependent procedures within such pipelines. In this study, we address the problem of quantifying the statistical reliability of results produced by data analysis pipelines. As a proof of concept, we focus on clustering pipelines that identify cluster structures from complex and heterogeneous data through procedures such as outlier detection, feature selection, and clustering. We propose a novel statistical testing framework to assess the significance of clustering results obtained through these pipelines. Our framework, based on selective inference, enables the systematic construction of valid statistical tests for clustering pipelines composed of predefined components. We prove that the proposed test controls the type I error rate at any nominal level and demonstrate its validity and effectiveness through experiments on synthetic and real datasets.
Figures & tables
Figure 1: Two examples of clustering pipelines composed of outlier detection (OD), feature selection (FS), and clustering components, for which the proposed framework provides statistically valid p -values without additional implementation effort.
Figure 2: Schematic diagram of the proposed line search method to identify the truncated region Z . The top part shows the DAG representation of the pipeline and its topological sorting (i). The lower left part shows the operations executed sequentially according to the update rules (ii). The lower right part shows how the truncated region Z is identified by taking the union of several intervals based on parametric-programming (iii).
(a) Type I Error Rate of option1 pipeline
Table 1: Results for clustered and non-clustered data using option1 (PBMC 3k).
Table 2: Results for clustered and non-clustered data using option2 (Marketing Campaign).
Appendix figures & tables14 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 4: Algorithm components of the clustering pipeline.
(a) Type I Error Rate of option1 pipeline
Table 3: Results of option2 for clustered and non-clustered data (PBMC 3k).
Figure 6: Data distributions before and after clustering for feature #6 (JUNB) in the clustered data. Cluster 1: 138 samples, Cluster 2: 55 samples. Although the cluster sizes are somewhat imbalanced, a clear difference in means is observed between the two clusters.
#
feature (gene name)
naive
w/o-pp
proposed (SI)
6
JUNB
0.000
0.478
0.000
Appendix
Table 4: p -values for feature #6 (JUNB) in the clustered data
Figure 7: Data distributions before and after clustering for feature #5 (JUN) in the non-clustered data. Cluster 1: 123 samples, Cluster 2: 70 samples. Although the cluster sizes are somewhat imbalanced, no meaningful difference in means is observed between the two clusters.
#
feature (gene name)
naive
w/o-pp
proposed (SI)
5
JUN
0.000
0.977
0.981
Appendix
Table 5: p -values for feature #5 (JUN) in the non-clustered data
Table 6: Results of option1 for clustered and non-clustered data (Marketing Campaign).
Figure 8: Data distributions before and after clustering for feature #4 (MntWines) in the clustered data. Cluster 1: 102 samples, Cluster 2: 90 samples. Two clusters of nearly equal size are formed, and a clear difference in means is observed between them.
#
feature (spending target)
naive
w/o-pp
proposed (SI)
4
MntWines
0.000
0.250
0.003
Appendix
Table 7: p -values for feature #4 (MntWines) in the clustered data
Figure 9: Data distributions before and after clustering for feature #8 (MntSweetProducts) in the non-clustered data. Cluster 1: 144 samples, Cluster 2: 7 samples. Although the cluster sizes are heavily imbalanced, no meaningful difference in means is observed between the two clusters.
#
feature (spending target)
naive
w/o-pp
proposed (SI)
8
MntSweetProducts
0.000
0.162
0.299
Appendix
Table 8: p -values for feature #8 (MntSweetProducts) in the non-clustered data
Figure 10: Robustness of Type I error rate control under estimated variance. The proposed method successfully controls the Type I error rate below the significance level α even when the variance is estimated from the same data.
Figure 11: Robustness of Type I error rate control under non-Gaussian noise. The proposed method successfully controls the Type I error rate at the significance level α regardless of the Wasserstein distance from the Gaussian distribution.
Statistical hypothesis testing develops methods for assessing evidence against a stated null while controlling false-positive and false-negative rates.
Deep clustering is a powerful approach for discovering meaningful structures in high-dimensional data by learning a low-dimensional latent representation prior to clustering. Despite its empirical success, assessing the statistical reliability of the resulting clusters remains challenging. Testing discovered clusters on the same data induces selection bias and invalidates classical p-values. Selective inference (SI) provides a principled framework for correcting this bias, but existing methods focus on clustering performed directly on the observed features. In this work, we develop an SI framework for deep clustering with a fixed pretrained encoder. The key challenge is that cluster assignments are determined through a nonlinear transformation from the original data space to the latent space, resulting in a substantially more complex selection process than in conventional clustering. Our method provides a computationally tractable way to account for this process and enables valid statistical testing of differences between clusters identified in the latent space. Synthetic experiments demonstrate that the proposed method controls the Type I error rate while achieving higher power than valid but conservative baselines, and genomic applications show that it can identify significant cluster differences while appropriately accounting for selection bias. Our framework provides a principled approach to quantifying the statistical reliability of structures discovered by deep clustering.
Eina Mizui, Tomohiro Shiraishi, Shunichi Nishino +1
Selecting the number of clusters remains a fundamental challenge in unsupervised learning. Existing approaches typically focus on identifying a single "optimal" partition, often overlooking statistically meaningful structure present across multiple resolutions. We introduce ElbowSig, a general inferential framework for assessing clustering structure over a range of resolutions. The method formalizes the elbow heuristic by defining a normalized discrete curvature statistic based on the sequence of within-cluster heterogeneity values, and evaluates its significance relative to a null distribution of unstructured data. This yields hypothesis tests across resolutions, enabling simultaneous inference at multiple clustering scales. We derive the asymptotic behavior of the null statistic in both large-sample and high-dimensional regimes, characterizing its limiting form and variability. Because it depends only on the heterogeneity sequence, ElbowSig is compatible with a wide range of clustering algorithms, including hard, fuzzy, and model-based methods. Experiments on synthetic and real datasets show that the procedure controls Type-I error under unstructured data while providing power to detect multiscale organization, revealing structure that is often missed by single-resolution selection criteria.
Francisco J. Perez-Reche
School of Natural and Computing Sciences, University of Aberdeen, Fraser Noble Building, AB24 3UE, United Kingdom
Unsupervised clustering is widely used to discover underlying group structure, after which researchers often seek to validate these groups via post-hoc hypothesis testing on the population means. However, using the same data both to form clusters and to test for a difference in means inflates the Type I error rate. Recent work in selective inference has proposed solutions when the underlying data are drawn from a multivariate Gaussian distribution with a known covariance matrix or an unknown isotropic covariance matrix. We propose a new selective test for the difference in means between two clusters that provably controls the Type I error rate under an arbitrary unknown covariance matrix. Our test statistic does not require estimating the feature covariance matrix; instead, it leverages a Monte Carlo sampling procedure over the set of orthogonal matrices. We show that this new selective test can be computed efficiently, and we derive closed-form solutions when clusters are formed using k-means or hierarchical clustering. In simulations, we demonstrate that our proposed p-value controls the selective Type I error rate and achieves substantial power, and we illustrate its application on gene expression and drug review data sets.
Yiqun T. Chen, Lucy L. Gao
Departments of Biostatistics and Computer Science, Johns Hopkins University · Department of Statistics and Actuarial Science, University of Waterloo