ADIHQ Template: High-Quality Imputation
- ADIHQ Template is an integrated pipeline that chains univariate and multivariate imputers with robust statistical vetting to ensure reliable data imputation.
- It sequentially applies simple methods and complex models while using tests like KS, t-test, Chi-square, and Hotelling’s T2 to validate imputed distributions.
- The template produces detailed diagnostic plots and quantitative metrics that facilitate both manual inspection and automated feature filtering for downstream analysis.
The ADIHQ (Automatic Data Imputation & High-quality) Template provides an integrated, scikit-learn–style pipeline for the robust assessment and management of missing data imputation quality in heterogeneous datasets. Developed as the core architectural framework within the ITI-IQA toolbox, the ADIHQ template offers systematic, statistically-guarded processes for chaining univariate and multivariate imputers, vetting their outputs via rigorous statistical tests, quantitatively scoring the reliability of each (feature,imputer) pair, and filtering out features that fail specific quality, completeness, and stability criteria. Its design explicitly accommodates mixed data types—including continuous, discrete, binary, and categorical variables—and produces both per-feature diagnostics and global graphical summaries to facilitate both manual inspection and automated flagging of imputation artifacts (Pons-Suñer et al., 2024).
1. Pipeline Structure and Conceptual Framework
The ADIHQ template is instantiated as a single pipeline with three sequential phases:
1. Univariate Imputation Stage:
Each feature undergoes parallel imputation using simple methods such as mean, median, mode, and APPRandom. This is implemented using a ColumnTransformer, which fits each imputer independently to the feature in question.
- Multivariate Imputation Stage: Features are then imputed using complex models—KNN, Iterative-BayesianRidge, Iterative-Random Forest, and XGBoost—each receiving as covariates only those variables connected in the dependency graph. Again, a ColumnTransformer structures the parallel evaluation.
- Post-processing and Filtering Stage: Outputs are subjected to post-imputation statistical tests to reject methods introducing distributional bias; accuracy and reliability metrics are computed; per-feature optimal imputers are selected; features not meeting predefined quality thresholds are dropped.
Meta-estimator wrappers record all per-feature outputs, enabling cross-validation and reproducibility in selection and filtering steps.
2. Statistical Vetting of Imputed Data
For every feature–imputer pair, the pipeline tests the null hypothesis that the imputed and observed data share the same distribution. The type of statistical test is determined by the data class:
- Continuous Variables:
- Kolmogorov-Smirnov test:
Reject if , with scaling for sample sizes and significance. - Optionally, two-sample Student's t-test:
with the pooled variance.
Categorical/Discrete/Binary Variables:
- Chi-square test of independence:
Degrees of freedom , thresholded by significance.
Multivariate Continuous:
- Hotelling’s test for distributional equivalence of -dim vectors.
- Mahalanobis distance–based outlier rejection on individual imputed vectors.
Any imputer failing these tests is excluded from further consideration for the feature.
3. Quantitative Imputation Quality Metrics
Once a candidate imputer passes distributional testing, its predictive accuracy on held-out (i.e., actually observed but temporarily withheld) entries is evaluated using metrics tailored to the feature type:
- Normalized RMSE (continuous/discrete):
The imputation “score” is .
- Balanced Accuracy (binary):
- Kullback-Leibler Divergence (categorical/nominal):
- Earth Mover’s Distance/p-Wasserstein (continuous histograms).
4. Selection Logic and Feature Filtering
The best imputer for each feature is chosen by maximizing its accuracy score over all imputers passing the statistical test. If no imputer passes, APPRandom is used as fallback. The final per-feature quality score combines completeness and accuracy:
where is the proportion of observed (non-missing) data. Features with (user-defined threshold) are dropped.
Cross-validation is performed at the feature level, recording per-fold . Stability filters require (stddev of across folds) below some maximum, and only features with are retained.
Pseudocode for the selection:
1 2 3 4 5 6 7 8 9 10 11 |
for each feature x in X: for each candidate imputer I: apply fit+transform on hold-out perform distribution test → pass_I? if pass_I: compute δ_I(x) if any pass_I: I* = argmax_I δ_I(x) else: I* = APPRandom assign δ_x = δ_{I*}(x) |
5. Graphical Diagnostics and User Inspection
ADIHQ generates multiple diagnostic plots to aid in quality assurance:
- Bar charts of across features, with color-coded composition (blue: , orange: , line: ).
- QQ-plots of observed versus imputed quantiles per feature.
- Overlaid histograms and density plots: vs , critical for visually detecting distributional mismatch.
- Correlation-matrix heatmaps pre- and post-imputation.
- Mahalanobis distance scatter plots highlighting outlier status of imputed samples.
These allow both investigative and automatic detection of problematic features (e.g., if KS p-value 0.05).
6. Implementation, Algorithmic Workflow, and Recipe
The standard ADIHQ workflow comprises:
- Injecting missingness (e.g., MCAR) into a dataframe with mixed-type columns.
- Initializing ADIHQ with specified univariate/multivariate imputers, statistical tests, quality scorer, , and cross-validation folds.
- Fitting the pipeline, which triggers the imputation selection, filtering, and testing procedure.
- Transforming the data to produce a clean, high-quality matrix with problematic features removed.
- Visualizing results to inspect per-feature quality and imputation distributions.
Table: Core Steps and Objects in the ADIHQ Pipeline
| Phase | Implementation (scikit-learn style) | Key Outputs per Feature |
|---|---|---|
| Univariate | ColumnTransformer (mean, median, mode, APPRandom) | Per-imputer scores |
| Multivariate | ColumnTransformer (KNN, Iterative-BR/RF/XGB) | Imputer acceptance flags |
| Postprocessing | Meta-estimator + filters | , , decisions |
After fitting, selected_imputers_ holds the best imputer per column, and feature_scores_ gives all , , and values.
7. Applications, Limitations, and Interoperability
The ADIHQ template is suitable for any heterogeneous dataset subject to missingness, enables rigorous, automated minimization of imputation-induced bias, and supports downstream integrity in ML pipelines. Its compositional approach—chaining both simple and complex imputers, early-rejecting those that fail statistical tests, and automatically filtering inadequate features—raises confidence in the ultimate data reliability. It is particularly distinguished by its capacity to integrate cross-validation stability, statistical vetting by data type, and direct graphical feedback in a scikit-learn–compliant interface (Pons-Suñer et al., 2024).
Limitations include the potential for over-rejection in ultra-high-dimensional, highly correlated datasets (danger of correlated feature loss), dependence on threshold tuning for and , and computational overhead for very large-scale application, especially with intensive multivariate estimation. The design is extensible—enabling customized importers, tests, or scorers—but always prioritizes abstaining from imputation where empirical evidence of distributional fidelity and predictive value is insufficient.