Explaining Away the Scanner: Acquisition Factors as Markov-Blanket Spouses in Medical Image Classification

Medical image classifiers often look excellent at the hospital that trained them and degrade badly elsewhere. A chest X-ray model drops from 0.83 to 0.68 mean AUC when moved from ChestX-ray14 to CheXpert (Can We Trust Deep Learning Based Diagnosis?), and a histopathology model loses about fifteen accuracy points across hospitals on Camelyon17. The usual response is to make the model blind to the scanner, the stain or the hospital, either by randomizing appearance or by training features to carry no domain information. This proposal argues the opposite. An image is jointly produced by the disease and the acquisition process. The disease changes the tissue, and the scanner changes how that tissue looks. In causal-graph terms, the acquisition factor is a spouse of the diagnosis: a second cause of the same observed effect. The theory of Markov blankets says the minimal set of variables that makes a prediction complete includes the spouses. So the classifier should not throw scanner information away. It should condition on it, so that a darker stain or a noisier reconstruction is "explained away" rather than mistaken for, or masking, pathology.

The concrete method has three parts. First, it estimates an acquisition descriptor from image regions that contain no pathology by construction, such as the glass background of a slide or the air outside the patient. Second, it runs kernel Markov-blanket selection over frozen foundation-model features together with that descriptor, so it can verify which features are disease effects and confirm the descriptor acts as a spouse. Third, it predicts with a classifier built so that acquisition information can only adjust how disease features are read. It can never vote for a diagnosis on its own. The test is whether this beats both invariance-based training and the best hand-designed augmentation on held-out hospitals, without any hospital or scanner labels.

Core Claim

Most medical imaging is anticausal: the label $Y$ (tumor present, effusion present) causes the visual findings, rather than the reverse. If $Z$ denotes image features that are effects of disease and $A$ denotes acquisition physics (stain chemistry, scanner optics, exposure, reconstruction), the local graph is the collider $Y \rightarrow Z \leftarrow A$. Its Markov blanket, the minimal set that makes $Y$ independent of everything else, is $\{Z, A\}$, not $Z$ alone. Discarding $A$, which is what invariance methods aim to do, leaves the predictor reading $Z$ through an unknown, shifting acquisition lens. Feeding $A$ in naively is also wrong. In multi-site data, hospitals differ in disease prevalence, so a flexible classifier will learn $A$ as a direct shortcut for $Y$. That pathway is exactly the one the collider structure says should not exist.

The proposed predictor respects the structure:

$$p(y \mid z, a) \;\propto\; p(z \mid y, a)\,\pi(y),$$

where $z$ are the selected disease-effect features, $a$ is the acquisition descriptor, $p(z \mid y, a)$ is a class-conditional model of features whose mean and covariance vary smoothly with $a$, and $\pi(y)$ is a label prior that is deliberately not allowed to depend on $a$. Acquisition information therefore enters only as a moderator of how features are interpreted. Because $a$ is continuous physics rather than a hospital index, the model can interpolate to scanners it never saw, which is not possible with domain one-hot codes.

This framing also resolves a tension in the literature. Out-of-Distribution Robustness via Targeted Augmentations shows that full domain invariance hurts because some domain-dependent features are genuinely useful. The Markov-blanket representation learners (Causal Markov Blanket Representation Learning for Out-of-distribution Generalization; Integrating Markov Blanket Discovery Into Causal Representation Learning for Domain Generalization) insist on shielding $Y$ from the domain. Treating acquisition as a spouse says precisely which domain information belongs in the blanket and in what functional role.

Relation to Prior Work

The two CMBRL papers are the closest work. Both define a latent Markov blanket of parents, children and spouses and train a classifier on it. Both require observed environment indices to fit their latent model, an identifiable variational autoencoder in the second paper. Both were evaluated only on Colored MNIST, PACS, CelebA and VLCS. Their spouses are anonymous latent dimensions recovered by generative modelling. Ours is a physically grounded, explicitly estimated acquisition variable, obtained without domain labels. We also add a structural constraint that forbids a main effect of $A$ on $Y$, which neither paper imposes.

Feasibility of lung cancer prediction from low-dose CT scan and smoking factors using causal models shows that a three-variable Markov blanket found with a causal discovery algorithm can outperform clinical risk scores. It works on hand-engineered tabular features from 92 training patients, with no scanner analysis. It motivates the claim that blankets are useful in medicine. We move the selection onto image embeddings and make acquisition an explicit node.

The method draws on Practical Markov Boundary Learning without Strong Assumptions, whose kernel Markov-boundary criterion uses conditional covariance in a kernel feature space. That lets us detect nonlinear, collider-type dependence without assuming Gaussian or discrete variables. The plan is also constrained by Multi-Source Causal Feature Selection. It documents that constraint-based blanket learners fail at small sample sizes, high dimension and class imbalance, and that mutual-information filters such as mRMR and JMI are low-order approximations of the same objective. We therefore select over a compressed feature space of tens of dimensions, never raw pixels or full embeddings, and include a filter baseline.

Several medical debiasing methods need what we avoid. Benchmarking Dependence Measures to Prevent Shortcut Learning in Medical Imaging and SpurCon require confounder labels, seed annotations or repeated scans of the same patient. Fast Diffusion-Based Counterfactuals for Shortcut Removal and Generation handles only spatially local shortcuts such as pacemakers and rulers. Shortcut Invariance: Targeted Jacobian Regularization is label-free but flags as shortcuts the latent dimensions most correlated with the label. That heuristic is fragile when pathology is subtle. It is also conceptually opposite to ours: a true spouse has zero marginal correlation with $Y$ and becomes informative only given the disease features. Causality-inspired Single-source Domain Generalization writes down the same image-generation graph ($X \leftarrow C, A$). It intervenes on $A$ by random-network augmentation and discards it, rather than estimating and conditioning on it.

Research Program

The first component is the acquisition descriptor. For whole-slide histopathology, we compute slide-level statistics from tissue-free glass regions: background chromaticity, scanner noise spectra and optical blur. Separately, we compute stain-vector estimates restricted to non-tumor stroma flagged by a coarse tissue mask, and test whether this restricted estimate leaks label information. For chest radiographs, we compute intensity histograms, noise power and edge sharpness from collimated borders and air regions outside the body contour. Because these regions contain no disease, $a$ is independent of $Y$ within a site by construction. That independence is checkable, and Check 1 below tests it directly. When DICOM headers are available, such as kVp or reconstruction kernel, they are appended. The method must not depend on them.

The second component is blanket selection. A frozen pathology or radiology foundation encoder produces patch or image embeddings. These are compressed to roughly 32–64 components by PCA. Kernel Markov-boundary selection is then run over the components and $a$ jointly, with class-balanced reweighting to address the imbalance failures noted by Multi-Source Causal Feature Selection. Selection yields children of $Y$, which are kept. It also yields components that depend on $a$ but carry no information about $Y$ once $a$ is known; these are dropped as pure acquisition nuisance. Finally, it gives a direct test of the spouse claim. The descriptor $a$ should be marginally independent of $Y$ within site, yet enter the blanket because it becomes dependent on $Y$ given the children. This v-structure signature is the empirical evidence that the graph we posit is the right one.

The third component is the structured predictor in the display equation. We use a class-conditional Gaussian whose mean is linear in $a$ and whose covariance is shared, with a small heteroscedastic MLP variant for nonlinearity. Prediction is by Bayes' rule with a fixed or test-time-estimated prior $\pi(y)$.

Baselines

The naive reference is empirical risk minimization: a linear probe or fine-tuned network on the same frozen foundation embeddings, trained on pooled source hospitals. On Camelyon17-WILDS, Out-of-Distribution Robustness via Targeted Augmentations reports 75.3% average out-of-distribution accuracy for its standard baseline. For ChestX-ray14 trained and CheXpert tested, Can We Trust Deep Learning Based Diagnosis? reports a drop from 0.83 to 0.68 mean AUC.

The strongest existing competitor on histopathology is targeted stain-color jitter from the same paper. It reports 90.5% average out-of-distribution accuracy on Camelyon17-WILDS. It is the strongest because it encodes exactly the expert knowledge of acquisition physics that our descriptor tries to recover automatically. Beating it requires exceeding 90.5% under the official WILDS split. Matching it while needing no stain-specific design, and transferring unchanged to radiographs, would also be a meaningful result. On chest radiographs we found no reported result on Lacuna for any debiasing method on the ChestX-ray14-to-CheXpert transfer. We will therefore re-run GIN+IPA from Causality-inspired Single-source Domain Generalization and SITAR from Shortcut Invariance, the closest label-free competitors.

Two further comparisons set the Markov-blanket context. CMBRL in the form of Integrating Markov Blanket Discovery Into Causal Representation Learning for Domain Generalization is given hospital indices it needs, which our method does not get. The domain-adversarial gradient-reversal variant benchmarked in Benchmarking Dependence Measures is also given hospital labels. An mRMR filter over the same compressed features is the low-order approximation baseline.

Fairness rules apply to every method. All use the same frozen encoder, the same PCA space where applicable, the same source hospitals and the same hyperparameter budget. That budget is a fixed number of configurations, tuned on a held-out source hospital, never the target.

Four ablations isolate the key ingredient. The children-only predictor drops $a$, testing whether the spouse matters. A plain concatenation of $a$ into an unconstrained classifier tests whether the no-main-effect structure matters. Computing $a$ from random image regions instead of pathology-free ones tests whether the source of the descriptor matters. An oracle one-hot hospital index in place of $a$ tests whether continuous physics generalizes better than identity.

Why not just…?

Why not just harmonize or augment the images instead? Targeted stain jitter is the real threat on Camelyon17, and it may match us there. Its limitation is that it requires knowing the shift lives in H&E color space. GIN+IPA assumes shifts are intensity and texture non-linearities. Our experiment applies one unchanged pipeline to both histopathology and radiographs. If augmentation wins on both, the spouse idea adds nothing practical and we will report that.

Why not just add the acquisition features as extra classifier inputs? This is the most direct simplification, and it is the concatenation ablation. The causal argument predicts it fails specifically when disease prevalence differs between hospitals, because the classifier learns $a$ as a prevalence shortcut. We will create prevalence mismatch by subsampling source hospitals and measure whether concatenation degrades while the structured model does not. If concatenation does not degrade, the structural constraint is unnecessary.

Why not just enforce invariance with adversarial training or CMBRL given domain labels? Out-of-Distribution Robustness via Targeted Augmentations already shows that blanket invariance discards useful information. Adversarial heads also struggled on high-dimensional X-ray features in Benchmarking Dependence Measures. Both approaches additionally need hospital labels. We run them with labels anyway, so that a loss to us cannot be blamed on missing supervision.

Proposed Experiments and Decisive Checks

The primary benchmark is Camelyon17-WILDS. It has five hospitals and stain and scanner shift, and original whole slides are available for background statistics. The secondary benchmark is ChestX-ray14 for training, with CheXpert and MIMIC-CXR for testing. A controlled semi-synthetic version of CheXpert completes the set. In it, a known global acquisition transform, a random shallow convolution in the style of GIN, is applied with a severity variable correlated with site. We evaluate out-of-distribution accuracy, worst-hospital accuracy, AUC and calibration error, using five seeds.

Three checks decide the proposal. The first is structural. Within a site, $a$ must be statistically independent of $Y$ under a kernel independence test, yet dependent on $Y$ given the selected children. If $a$ predicts $Y$ marginally, the descriptor leaks pathology and the premise fails. The second is mechanistic. On the semi-synthetic set, the gap between the structured predictor and the children-only ablation should grow with acquisition-shift severity and vanish at zero severity. The third is extrapolative. Training on three Camelyon hospitals and testing on hospitals whose background-statistic descriptors fall outside the training range should favor continuous $a$ over the oracle hospital index.

If all three hold and the method reaches or exceeds 90.5% on Camelyon17-WILDS without stain-specific design, the claim stands: acquisition belongs inside the Markov blanket as an explained-away spouse, not outside it as noise to be erased.