Tutorials › Multi-Omics Data Integration › Masking-Based Diagnostics for Block Imputation

Missing Modalities and Partially Observed Subjects · Tutorial 88 of 597

Masking-Based Diagnostics for Block Imputation

Use masked observed blocks to measure imputation error, and interpret that error in light of the missing subjects and availability patterns the diagnostic is meant to represent.

Advanced 13 min read

What You'll Learn

  • Define a block-level masking validation target for a modality.
  • Calculate and interpret block prediction errors using MAE and RMSE.
  • Design masking and model-fitting steps that prevent information leakage.
  • Compare error across availability patterns and subject characteristics.
  • Decide when masked validation may not represent naturally missing blocks.

Why Masking Can Diagnose Block Imputation

When an omics modality is observed for a subject, its measurements can be temporarily hidden and then predicted using the other information available for that subject. Comparing those predictions with the hidden measurements gives an empirical check on how well an imputation procedure predicts a whole missing modality block. This is useful because ordinary imputation output alone does not reveal how far predictions tend to be from values that could, in principle, have been observed.

The comparison is informative only if the validation design resembles the problem the imputation will face. Masking individual cells at random, for example, tests a different task from predicting an entire modality that is absent for a subject. And even a correctly masked block may not represent naturally missing blocks: the subjects whose modality was observed can differ systematically from those for whom it is missing.

Definition: A masking-based block-imputation diagnostic temporarily hides a modality block that was observed, applies the intended imputation procedure using the information that would be available for an incomplete subject, and compares the resulting prediction with the hidden measurements. A validation block is the held-out set of measurements used for this comparison.

Let \(Y_{im}\) denote the observed vector of measurements for subject \(i\) in target modality \(m\). A block may contain many features; masking the block means hiding all of \(Y_{im}\) together, not selecting a few entries while leaving the rest visible. Let \(\hat{Y}_{im}\) denote the predicted block produced without using \(Y_{im}\). For a feature \(j\) in modality \(m\), define the prediction error as \(e_{imj}=\hat{Y}_{imj}-Y_{imj}\). Positive errors indicate overprediction under this convention.

Two common summaries are the mean absolute error (MAE) and root mean squared error (RMSE). For \(N\) masked subject-feature measurements, MAE is the mean of the absolute errors; RMSE is the square root of the mean squared errors. Both are nonnegative and have the units of the feature being scored. Squaring gives RMSE more sensitivity to large errors than MAE. Neither metric by itself describes the full error distribution or establishes that an imputation model is appropriate for every scientific use.

$$ \mathrm{MAE}=\frac{1}{N}\sum_{(i,j)\in\mathcal{V}}|e_{imj}|, \qquad \mathrm{RMSE}=\sqrt{\frac{1}{N}\sum_{(i,j)\in\mathcal{V}}e_{imj}^{\,2}}, $$

Here \(\mathcal{V}\) is the set of subject-feature pairs in the validation blocks. When features have substantially different scales or units, pooling raw errors can cause large-scale features to dominate. Report feature-specific errors, or define a scaled score using scales estimated from training data and state clearly what that score means. Do not estimate scaling constants using held-out validation values.

Conditions for a Trustworthy Diagnostic

The calculation of an error metric is straightforward; interpreting it requires stronger conditions. First, the masked measurements must not influence the imputation procedure, directly or indirectly. This includes feature selection, normalization, tuning, dimension reduction, and any preprocessing used to construct the prediction. Such steps must be fitted using the training information available for the validation run. If a value is hidden only after a transformation that used it, the diagnostic is contaminated by leakage.

Second, the validation task should match the intended deployment task. If deployment requires predicting an entire modality for subjects with a particular pattern of other observed modalities, the validation should hide that entire modality and retain only the other modalities and covariates available for those subjects. The imputation model must be refitted or otherwise applied in a way that does not use the hidden values. A random split of individual entries generally does not satisfy this condition for block-missing data.

Third, masked observed blocks must be sufficiently informative about the blocks that are naturally missing. This is not guaranteed by random masking among observed subjects. It is more plausible when, within the groups used for evaluation, the prediction errors for observed blocks represent the errors that would occur for the naturally missing blocks. If missingness depends on unobserved block values even after conditioning on available information, masked validation among observed subjects cannot directly reveal the error for those missing blocks. This limitation is related to the issues addressed in the earlier material on Pattern-Mixture Sensitivity Analysis for Missing Blocks and Selection Models for Nonignorable Modality Missingness.

In practice, record each subject’s modality-availability pattern: which modalities are available and which are absent. For a target modality, stratify masked-block errors by the other-modality pattern and by relevant subject characteristics, such as a clinical subgroup or a measured covariate. The grouping variables should be chosen for a reason and specified without using validation errors. Very small strata yield unstable summaries, so report their sizes and avoid treating a noisy subgroup estimate as a precise comparison.

1
Define the target prediction task.
Name the modality to be hidden, the block of features it contains, and the information that will remain available for prediction.
2
Construct validation masks.
Select subjects with observed target blocks, then hide complete blocks. Use repeated or held-out splits when feasible, keeping each subject’s validation block out of model fitting and preprocessing.
3
Predict and score.
Apply the planned imputation procedure to each masked block. Compare predictions with the held-out measurements using stated metrics and units.
4
Check representativeness.
Summarize validation errors by availability pattern and relevant subject characteristics. Compare those groups with the population of naturally incomplete subjects before generalizing the results.

Worked Examples of Block-Level Error

Worked Example: Scoring One Masked Metabolomics Block

Hypothetical data. A subject’s three observed metabolite measurements are temporarily hidden. Their values are \(10\), \(12\), and \(8\) micromoles per litre. The model, fitted without these three values, predicts \(9\), \(14\), and \(7\) micromoles per litre. The entire three-feature block was withheld, and no preprocessing used its hidden values.

The signed errors, prediction minus observed value, are \(-1\), \(2\), and \(-1\) micromoles per litre. Thus

$$ \mathrm{MAE}=\frac{|{-1}|+|2|+|{-1}|}{3} =\frac{4}{3}=1.333\ \text{micromoles per litre}, $$

and

$$ \mathrm{RMSE}=\sqrt{\frac{(-1)^2+2^2+(-1)^2}{3}} =\sqrt{2}=1.414\ \text{micromoles per litre}. $$

For this masked block, predictions differ from the held-out values by an average absolute amount of \(1.333\) micromoles per litre. RMSE is larger because it gives extra weight to the error of \(2\). This is one block, not a precise estimate of performance across all subjects; the same procedure must be evaluated over a suitable collection of validation blocks.

Worked Example: Comparing Availability Patterns

Hypothetical data. The target is a two-feature protein block, measured in normalized abundance units. The diagnostic masks that block for four subjects. Pattern A means RNA is available but methylation is not; Pattern B means both RNA and methylation are available. The squared errors for the two protein features are as follows.

Availability patternSubjectSquared errors for the two features
A11, 9
A24, 0
B316, 0
B44, 4

For Pattern A, there are \(4\) feature errors and their squared errors sum to \(1+9+4+0=14\). Its RMSE is \(\sqrt{14/4}=\sqrt{3.5}=1.871\) normalized abundance units. For Pattern B, the sum is \(16+0+4+4=24\), so its RMSE is \(\sqrt{24/4}=\sqrt{6}=2.449\) normalized abundance units. These summaries suggest larger prediction error in Pattern B in this small validation set.

The pattern-specific result is more informative than a single pooled score if naturally incomplete subjects commonly have one of these patterns. It is not, by itself, evidence that the availability pattern caused the difference: there are only two subjects per group here, and other subject characteristics may differ. The table also makes clear that the calculation uses feature-level errors within each masked block; the denominator is the number of held-out feature measurements in that pattern.

Worked Example: Weighting Errors to Match the Missing-Subject Patterns

Hypothetical data. Suppose naturally incomplete subjects have Pattern A with proportion \(0.75\) and Pattern B with proportion \(0.25\). A masking validation sample instead contains equal numbers of each pattern. Suppose the estimated pattern-specific mean squared errors are \(4\) for A and \(36\) for B, in squared normalized abundance units. The corresponding pattern RMSEs are \(2\) and \(6\) normalized abundance units.

If the goal is to summarize expected squared prediction error for the naturally incomplete population, weight the pattern-specific mean squared errors by the target pattern proportions, then take the square root:

$$ \widehat{\mathrm{RMSE}}_{\mathrm{target}} =\sqrt{0.75(4)+0.25(36)} =\sqrt{12} =3.464\ \text{normalized abundance units}. $$

Simply pooling an equal-sized validation sample gives \(\sqrt{(4+36)/2}=\sqrt{20}=4.472\) normalized abundance units, which targets the validation sample’s equal pattern mix, not the stated missing-subject mix. The weighted calculation is justified only if the pattern-specific validation errors represent the errors for naturally incomplete subjects within those patterns. If subjects within a pattern differ in ways that affect prediction error, pattern weighting alone does not solve that problem.

Why Stratification and Weighting Matter

The logic behind pattern-specific validation can be stated precisely. Let \(S\) denote a subject’s availability pattern and let \(L\) be a loss, such as the squared error for a target feature or a block-level average squared error. The expected loss among naturally incomplete subjects can be decomposed by pattern:

$$ E(L\mid \text{target block missing}) =\sum_s P(S=s\mid \text{target block missing}) E(L\mid S=s,\text{target block missing}). $$

Masked observed blocks estimate the second conditional expectation using observed subjects with pattern \(s\). Replacing that missing-subject expectation with the masked validation expectation is valid only when those errors are comparable within pattern, and when each relevant pattern has validation data. Multiplying each pattern’s estimate by the target proportion gives the weighted mean squared error; taking its square root gives the corresponding RMSE. This decomposition explains both the benefit and the limitation of stratification: it aligns the mix of patterns, but cannot repair differences in error within a pattern.

When some patterns are rare or absent among observed target blocks, their prediction error cannot be assessed directly by this design. Extrapolating from a different pattern should be identified as an assumption, not reported as a measured diagnostic result. If validation subjects were sampled with known unequal probabilities, appropriate design weights may be used to estimate a target average, but the weights and target population must be stated. This is distinct from changing the imputation model.

Diagnostics, Alternatives, and Limitations

A masking diagnostic should be treated as a procedure to scrutinize, not just a number to report. Check that each masked subject’s target block is entirely withheld; that preprocessing and tuning do not use the hidden values; and that the remaining modalities match what the intended imputation would actually receive. Report the number of masked subjects and blocks in each stratum, along with the metric and its units. Large differences across repeated splits or sparse strata indicate that the estimate is unstable. A few extreme errors can also make RMSE much larger than MAE, so reporting both can reveal whether the summary is especially sensitive to large misses.

Repeated masking can show how much a score varies with the selected validation subjects, but it does not create new independent subjects. If the same person appears in several splits, do not treat each appearance as an independent observation when describing uncertainty. Split or resample at the subject level when the subject is the independent sampling unit. For multiple-imputation procedures that produce several completed values, define whether the diagnostic scores each imputed draw or an aggregate prediction; those answer different questions about point prediction and imputation variability.

The main alternative is to compare imputation approaches using the same masked blocks and scoring rules. This supports a fair predictive comparison if the splits, available inputs, and tuning opportunities are comparable. Complete-case analyses do not measure prediction error for hidden blocks, and random entry-wise masking may be suitable for a different missingness task but is not a substitute for whole-block masking. No validation metric proves that an imputation is unbiased for a downstream association or that its uncertainty estimates are calibrated. Those questions require their own analysis.

Most importantly, masked observed blocks cannot directly validate predictions for values that are never observed under a nonignorable missingness process. If block availability depends on the hidden measurements, the observed blocks can be an unrepresentative subset even after stratifying on recorded characteristics. In that setting, report the validation result as performance among the masked observed subjects, examine how plausible that population is as a proxy for naturally missing subjects, and use sensitivity analysis where appropriate. Do not describe an observed-subject masking score as verified accuracy for unobserved blocks.

Common Mistake

Pitfall: “The random masking RMSE is low, so the imputation will be accurate for every naturally missing subject.” This conclusion does not follow. Random masking estimates error for the observed subjects and masking scheme used; it may miss whole-block structure, availability-pattern differences, and selection into observation. Mask complete blocks, match or stratify by relevant patterns, and qualify conclusions when the naturally missing population is not represented.
Key takeaway: A useful block-imputation diagnostic hides complete observed modality blocks, prevents all leakage from the held-out measurements, scores predictions with clearly stated metrics, and checks whether validation subjects represent the naturally incomplete subjects across availability patterns and relevant characteristics.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. Why is masking an entire target modality block more appropriate than randomly hiding a few entries when the intended task is block imputation?
  2. For errors of \(-2\), \(0\), and \(1\) expression units, calculate MAE and RMSE.
  3. A validation set has equal numbers from two patterns, but the target incomplete population has proportions \(0.8\) and \(0.2\). What information is needed to calculate a target-weighted RMSE?
  4. Why can a low masking error among observed blocks fail to establish accuracy for naturally missing blocks?
  5. Name one form of leakage that can make masked-validation error look too small.

Solutions. (1) The intended prediction removes the modality as a block; leaving some target entries visible gives the model information it would not have at deployment. (2) \(\mathrm{MAE}=(2+0+1)/3=1\) expression unit. \(\mathrm{RMSE}=\sqrt{(4+0+1)/3}=\sqrt{5/3}=1.291\) expression units. (3) The mean squared error for each pattern and the target proportions are needed; calculate \(\sqrt{0.8\,\mathrm{MSE}_1+0.2\,\mathrm{MSE}_2}\). The pattern-specific RMSEs alone must first be squared. (4) Observed subjects may differ from naturally incomplete subjects, including within availability patterns, especially if missingness depends on unobserved values. (5) Examples include using the masked values to fit normalization, select features, tune the model, or estimate a transformation before validation.

Clinical Biostats