SlowGuess/NeurIPS_2023_OCR huggingface dataset:
[69] von Kugelgen, J., Mey, A., Loog, M., and Scholkopf, B. (2020). Semi-supervised learning, causality, and the conditional cluster assumption. In Conference on Uncertainty in Artificial Intelligence, pages 1-10. PMLR. [Cited on pages 5 and 26.]
[70] Wald, Y., Feder, A., Greenfeld, D., and Shalit, U. (2021). On calibration and out-of-domain generalization. Advances in neural information processing systems, 34:2215-2227. [Cited on pages 3, 10, and 29.]
[71] Wang, D., Shelhamer, E., Liu, S., Olshausen, B., and Darrell, T. (2021a). Tent: Fully test-time adaptation by entropy minimization. In International Conference on Learning Representations. [Cited on page 2.]
[72] Wang, D.-B., Feng, L., and Zhang, M.-L. (2021b). Rethinking calibration of deep neural networks: Do not be afraid of overconfidence. Advances in Neural Information Processing Systems, 34:11809-11820. [Cited on page 10.]
[73] Zech, J. R., Badgeley, M. A., Liu, M., Costa, A. B., Titano, J. J., and Oermann, E. K. (2018). Variable generalization performance of a deep learning model to detect pneumonia in chest radiographs: a cross-sectional study. PLoS Medicine, 15(11). [Cited on page 3.]
[74] Zhang, J., Lopez-Paz, D., and Bottou, L. (2022). Rich feature construction for the optimization-generalization dilemma. In International Conference on Machine Learning. [Cited on pages 3 and 31.]
[75] Zhao, H., Des Combes, R. T., Zhang, K., and Gordon, G. (2019). On learning invariant representations for domain adaptation. In International Conference on Machine Learning, pages 7523-7532. PMLR. [Cited on page 32.]
[76] Zhao, H., Zhang, S., Wu, G., Moura, J. M., Costeira, J. P., and Gordon, G. J. (2018). Adversarial multiple source domain adaptation. Advances in Neural Information Processing Systems, 31. [Cited on page 32.]
[77] Zheng, J. and Makar, M. (2022). Causally motivated multi-shortcut identification & removal. Advances in Neural Information Processing Systems. [Cited on pages 2, 8, and 29.]
A Proof and Further Discussion of Theorem 4.4 17
A.1 Proof of Theorem 4.4 17
A.2 Further discussion of Theorem 4.4 19
B Proof of Theorem 4.6 20
C Multiclass Case 22
D Supplementary Results 24
D.1 Trivial solution to joint-risk minimization 24
D.2 Causal perspectives 25
E Datasets 26
F Further Experiments 27
F.1 ColorMNIST 28
F.2 Camelyon17 29
G Implementation Details 30
G.1 Adaptive baselines 30
G.2 Synthetic experiments 31
G.3 ColorMNIST experiments 31
G.4 PACS experiments 31
G.5Camelyon17 experiments 32
H Further Related Work 32
I Performance When Complementarity is Violated 33
A Proof and Further Discussion of Theorem 4.4
A.1 Proof of Theorem 4.4
In this section, we prove our main results regarding the marginal generalization problem presented in Section 4, namely Thm. 4.4. For the reader's convenience, we restate Thm. 4.4 here:
Theorem 4.4 (Marginal generalization with for binary labels and complementary features). Consider three random variables  $X_{S}$ ,  $X_{U}$ , and  $Y$ , where
1.  $Y$  is binary  $(\{0,1\} -\mathrm{valued})$
2.  $X_{S}$  and  $X_{U}$  are complementary features for  $Y$  (i.e.,  $X_{S} \perp X_{U}|Y$ ), and
3.  $X_{S}$  is informative of  $Y$ $(X_{S} \nsubseteq Y)$ .
Then, the joint distribution of  $(X_S, X_U, Y)$  can be written in terms of the joint distributions of  $(X_S, Y)$  and  $(X_S, X_U)$ . Specifically, if  $\widehat{Y} | X_S \sim \text{Bernoulli}(\Pr[Y = 1 | X_S])$  is pseudo-label and
$$
\epsilon_ {0} := \Pr [ \widehat {Y} = 0 | Y = 0 ] \quad a n d \quad \epsilon_ {1} := \Pr [ \widehat {Y} = 1 | Y = 1 ] \tag {A.1}
$$
are the conditional probabilities that  $\widehat{Y}$  and  $Y$  agree, given  $Y = 0$  and  $Y = 1$ , respectively, then,
1.  $\epsilon_0 + \epsilon_1 > 1$
2.  $\operatorname{Pr}[Y = 1 | X_U] = \frac{\operatorname{Pr}[\widehat{Y} = 1 | X_U] + \epsilon_0 - 1}{\epsilon_0 + \epsilon_1 - 1}$ , and
3.  $\operatorname{Pr}[Y = 1|X_S, X_U] = \sigma (\operatorname{logit}(\operatorname{Pr}[Y = 1|X_S]) + \operatorname{logit}(\operatorname{Pr}[Y = 1|X_U]) - \operatorname{logit}(\operatorname{Pr}[Y = 1]))$
Before proving Thm. 4.4, we provide some examples demonstrating that the complementarity and informativeness assumptions in Thm. 4.4 cannot be dropped.
Example A.1. Suppose  $X_S$  and  $X_U$  have independent Bernoulli(1/2) distributions. Then,  $X_S$  is informative of both of the binary variables  $Y_1 = X_S X_U$  and  $Y_2 = X_S (1 - X_U)$  and both have identical conditional distributions given  $X_S$ , but  $Y_1$  and  $Y_2$  have different conditional distributions given  $X_U$ :
$$
\Pr \left[ Y _ {1} = 1 \mid X _ {U} = 0 \right] = 0 \neq 1 / 2 = \Pr \left[ Y _ {2} = 1 \mid X _ {U} = 0 \right].
$$
Thus, the complementarity condition cannot be omitted.
On the other hand,  $X_{S}$  and  $X_{U}$  are complementary for both  $Y_{3} = X_{U}$  and an independent  $Y_{4} \sim$  Bernoulli(1/2) and both  $Y_{3}$  and  $Y_{4}$  both have identical conditional distributions given  $X_{S}$ , but  $Y_{1}$  and  $Y_{2}$  have different conditional distributions given  $X_{U}$ :
$$
\Pr \left[ Y _ {3} = 1 \mid X _ {U} = 1 \right] = 1 / 2 \neq 1 = \Pr \left[ Y _ {4} = 1 \mid X _ {U} = 1 \right].
$$
Thus, the informativeness condition cannot be omitted.
Before proving Thm. 4.4, we prove Lemma 4.5, which allows us to safely divide by the quantity  $\epsilon_0 + \epsilon_1 - 1$  in the formula for  $\operatorname*{Pr}[Y = 1|X_U]$ , under the condition that  $X_S$  is informative of  $Y$ .
Lemma 4.5. In the setting of Thm. 4.4, let  $\epsilon_0$  and  $\epsilon_{1}$  be the class-wise pseudo-label accuracies defined in as in Eq. (A.1). Then,  $\epsilon_0 + \epsilon_1 = 1$  if and only if  $X_{S}$  and  $Y$  are independent.
Note that the entire result also holds, with almost identical proof, in the multi-environment setting of Sections 3 and 5, conditioned on a particular environment  $E$ .
Proof. We first prove the forward implication. Suppose  $\epsilon_0 + \epsilon_1 = 1$ . If  $\operatorname*{Pr}[Y = 1] \in \{0,1\}$ , then  $X_S$  and  $Y$  are trivially independent, so we may assume  $\operatorname*{Pr}[Y = 1] \in (0,1)$ . Then,
$$
\begin{array}{l} \mathbb {E} [ \widehat {Y} ] = \epsilon_ {1} \Pr [ Y = 1 ] + (1 - \epsilon_ {0}) (1 - \Pr [ Y = 1 ]) \quad (\text {L a w o f T o t a l E x p e c t a t i o n}) \\ = \left(\epsilon_ {0} + \epsilon_ {1} - 1\right) \Pr [ Y = 1 ] + 1 - \epsilon_ {0} \\ = 1 - \epsilon_ {0} \quad (\epsilon_ {0} + \epsilon_ {1} = 1) \\ = \mathbb {E} [ \widehat {Y} | Y = 0 ]. \quad (\text {D e f i n i t i o n} \epsilon_ {0}) \\ \end{array}
$$
Since  $Y$  is binary and  $\operatorname{Pr}[Y = 1] \in (0,1)$ , it follows that  $\mathbb{E}[\widehat{Y}] = \mathbb{E}[\widehat{Y}|Y = 0] = \mathbb{E}[\widehat{Y}|Y = 1]$ ; i.e.,  $\mathbb{E}[\widehat{Y}|Y] \perp Y$ . Since  $\widehat{Y}$  is binary, its distribution is specified entirely by its mean, and so  $\widehat{Y} \perp Y$ . It follows that the covariance between  $\widehat{Y}$  and  $Y$  is 0:
$$
\begin{array}{l} 0 = \mathbb {E} \left[ \left(Y - \mathbb {E} [ Y ]\right) \left(\widehat {Y} - \mathbb {E} [ \widehat {Y} ]\right) \right] \\ = \mathbb {E} [ \mathbb {E} [ (Y - \mathbb {E} [ Y ]) (\widehat {Y} - \mathbb {E} [ \widehat {Y} ]) | X _ {S} ] ] \quad \text {(L a w o f T o t a l E x p e c t a t i o n)} \\ = \mathbb {E} [ \mathbb {E} [ Y - \mathbb {E} [ Y ] | X _ {S} ] \mathbb {E} [ \widehat {Y} - \mathbb {E} [ \widehat {Y} ] | X _ {S} ] ] \quad (Y \perp \perp \widehat {Y} | X _ {S}) \\ = \mathbb {E} [ (\mathbb {E} [ Y - \mathbb {E} [ Y ] | X _ {S} ]) ^ {2} ], \\ \end{array}
$$
where the final equality holds because  $\widehat{Y}$  and  $Y$  have identical conditional distributions given  $X_{S}$ . Since the  $\mathcal{L}_2$  norm of a random variable is 0 if and only if the variable is 0 almost surely, it follows that,  $P_{X_S}$ -almost surely,
$$
0 = \mathbb {E} [ Y - \mathbb {E} [ Y ] | X _ {S} ] = \mathbb {E} [ Y | X _ {S} ] - \mathbb {E} [ Y ],
$$
so that  $\mathbb{E}[Y|X_S] \perp X_S$ . Since  $Y$  is binary, its distribution is specified entirely by its mean, and so  $Y \perp X_S$ , proving the forward implication.
To prove the reverse implication, suppose  $X_S$  and  $Y$  are independent. Then  $\widehat{Y}$  and  $Y$  are also independent. Hence,
$$
\epsilon_ {1} = \mathbb {E} [ \widehat {Y} | Y = 1 ] = \mathbb {E} [ \widehat {Y} | Y = 0 ] = 1 - \epsilon_ {0},
$$
so that  $\epsilon_0 + \epsilon_1 = 1$
We now use Lemma 4.5 to prove Thm. 4.4:
Proof. To begin, note that  $\widehat{Y}$  has the same conditional distribution given  $X_{S}$  as  $Y$  (i.e.,  $P_{\widehat{Y} | X_S} = P_{Y|X_S}$  and that  $\widehat{Y}$  is conditionally independent of  $Y$  given  $X_{S}$  ( $\widehat{Y} \perp Y|X_{S}$ ). Then, since
$$
\Pr [ \widehat {Y} = 1 ] = \mathbb {E} \left[ \Pr [ Y = 1 \mid X _ {S} ] \right] = \Pr [ Y = 1 ], \tag {A.2}
$$
$$
\begin{array}{l} \epsilon_ {1} = \Pr [ \widehat {Y} = 1 | Y = 1 ] = \frac {\Pr [ Y = 1 , \widehat {Y} = 1 ]}{\Pr [ Y = 1 ]} \quad (\text {D e f i n i t i o n o f} \epsilon_ {1}) \\ = \frac {\Pr [ Y = 1 , \widehat {Y} = 1 ]}{\Pr [ \widehat {Y} = 1 ]} \tag {Eq. (A.2)} \\ = \frac {\mathbb {E} _ {X _ {S}} \left[ \Pr \left[ Y = 1 , \widehat {Y} = 1 | X _ {S} \right] \right]}{\mathbb {E} _ {X _ {S}} \left[ \Pr \left[ \widehat {Y} = 1 | X _ {S} \right] \right]} \quad (\text {L a w o f T o t a l E x p e c t a t i o n}) \\ = \frac {\mathbb {E} _ {X _ {S}} [ \Pr [ Y = 1 | X _ {S} ] \Pr [ \widehat {Y} = 1 | X _ {S} ] ]}{\mathbb {E} _ {X _ {S}} [ \Pr [ \widehat {Y} = 1 | X _ {S} ] ]} \quad (\widehat {Y} \perp \perp Y | X _ {S}) \\ = \frac {\mathbb {E} _ {X _ {S}} \left[ (\Pr [ Y = 1 | X _ {S} ]) ^ {2} \right]}{\mathbb {E} _ {X _ {S}} [ \Pr [ Y = 1 | X _ {S} ] ]} \quad (P _ {\widehat {Y} | X _ {S}} = P _ {Y | X _ {S}}) \\ \end{array}
$$
entirely in terms of the conditional distribution  $P_{Y|X_S}$  and the marginal distribution  $P_{X_S}$ . Similarly,  $\epsilon_0$  can be written as  $\epsilon_0 = \frac{\mathbb{E}_{X_S}\left[(\operatorname*{Pr}[Y = 0|X_S])^2\right]}{\mathbb{E}_{X_S}[\operatorname*{Pr}[Y = 0|X_S]]}$ . Meanwhile, by the law of total expectation, and the assumption that  $X_S$  (and hence  $\hat{Y}$ ) is conditionally independent of  $X_U$  given  $Y$ , the conditional distribution  $P_{\widehat{Y}|X_U}$  of  $\hat{Y}$  given  $X_U$  can be written as
$$
\begin{array}{l} \Pr [ \widehat {Y} = 1 | X _ {U} ] \\ = \Pr [ \widehat {Y} = 1 | Y = 0, X _ {U} ] \Pr [ Y = 0 | X _ {U} ] + \Pr [ \widehat {Y} = 1 | Y = 1, X _ {U} ] \Pr [ Y = 1 | X _ {U} ] \\ = \Pr [ \hat {Y} = 1 | Y = 0 ] \Pr [ Y = 0 | X _ {U} ] + \Pr [ \hat {Y} = 1 | Y = 1 ] \Pr [ Y = 1 | X _ {U} ] \\ = \left(1 - \epsilon_ {0}\right) \left(1 - \Pr [ Y = 1 | X _ {U} ]\right) + \epsilon_ {1} \Pr [ Y = 1 | X _ {U} ] \\ = \left(\epsilon_ {0} + \epsilon_ {1} - 1\right) \Pr \left[ Y = 1 \mid X _ {U} \right] + 1 - \epsilon_ {0}. \\ \end{array}
$$
By Lemma 4.5, the assumption  $X_S \nsubseteq Y$  implies  $\epsilon_0 + \epsilon_1 \neq 1$ . Hence, re-arranging the above equality gives us the conditional distribution  $P_{Y|X_U}$  of  $Y$  given  $X_U$  purely in terms of the conditional  $P_{Y|X_S}$  and  $P_{X_S,X_U}$ :
$$
\Pr [ Y = 1 | X _ {U} = X _ {U} ] = \frac {\Pr [ \widehat {Y} = 1 | X _ {U} = X _ {U} ] + \epsilon_ {0} - 1}{\epsilon_ {0} + \epsilon_ {1} - 1}.
$$
It remains now to write the conditional distribution  $P_{Y|X_S,X_U}$  in terms of the conditional distributions  $P_{Y|X_S}$  and  $P_{Y|X_U}$  and the marginal  $P_Y$ . Note that
$$
\begin{array}{l} \frac {\Pr [ Y = 1 \mid X _ {S} , X _ {U} ]}{\Pr [ Y = 0 \mid X _ {S} , X _ {U} ]} = \frac {\Pr [ X _ {S} , X _ {U} \mid Y = 1 ] \Pr [ Y = 1 ]}{\Pr [ X _ {S} , X _ {U} \mid Y = 0 ] \Pr [ Y = 0 ]} \tag {Bayes' Rule} \\ = \frac {\Pr \left[ X _ {S} \mid Y = 1 \right] \Pr \left[ X _ {U} \mid Y = 1 \right] \Pr \left[ Y = 1 \right]}{\Pr \left[ X _ {S} \mid Y = 0 \right] \Pr \left[ X _ {U} \mid Y = 0 \right] \Pr \left[ Y = 0 \right]} \quad (\text {C o m p l e m e n t a r i t y}) \\ = \frac {\Pr [ Y = 1 \mid X _ {S} ] \Pr [ Y = 1 \mid X _ {U} ] \Pr [ Y = 0 ]}{\Pr [ Y = 0 \mid X _ {S} ] \Pr [ Y = 0 \mid X _ {U} ] \Pr [ Y = 1 ]}. \quad \text {(B a y e s ^ {\prime} R u l e)} \\ \end{array}
$$
It follows that the logit of  $\operatorname*{Pr}[Y = 1|X_S,X_U]$  can be written as the sum of a term depending only on  $X_{S}$ , a term depending only on  $X_{U}$ , and a constant term:
$$
\begin{array}{l} \operatorname {l o g i t} \left(\operatorname * {P r} [ Y = 1 | X _ {S}, X _ {U} ]\right) = \log {\frac {\operatorname * {P r} [ Y = 1 | X _ {S} , X _ {U} ]}{1 - \operatorname * {P r} [ Y = 1 | X _ {S} , X _ {U} ]}} \\ = \log \frac {\Pr [ Y = 1 | X _ {S} , X _ {U} ]}{\Pr [ Y = 0 | X _ {S} , X _ {U} ]} \\ = \log \frac {\Pr [ Y = 1 | X _ {S} ]}{\Pr [ Y = 0 | X _ {S} ]} + \log \frac {\Pr [ Y = 1 | X _ {U} ]}{\Pr [ Y = 0 | X _ {U} ]} - \log \frac {\Pr [ Y = 1 ]}{\Pr [ Y = 0 ]} \\ = \operatorname {l o g i t} \left(\Pr [ Y = 1 | X _ {S} ]\right) + \operatorname {l o g i t} \left(\Pr [ Y = 1 | X _ {U} ]\right) - \operatorname {l o g i t} \left(\Pr [ Y = 1 ]\right). \\ \end{array}
$$
Since the sigmoid  $\sigma$  is the inverse of logit,
$$
\Pr \left[ Y = 1 \mid X _ {S}, X _ {U} \right] = \sigma \left(\operatorname {l o g i t} \left(\Pr \left[ Y = 1 \mid X _ {S} \right]\right) + \operatorname {l o g i t} \left(\Pr \left[ Y = 1 \mid X _ {U} \right]\right) - \operatorname {l o g i t} \left(\Pr \left[ Y = 1 \right]\right)\right),
$$
which, by Eq. (4.3), can be written in terms of the conditional distribution  $P_{Y|X_S}$  and the joint distribution  $P_{X_S,X_U}$ .
A.2 Further discussion of Theorem 4.4
Connections to learning from noisy labels. Thm. 4.4 leverages two theoretical insights about the special structure of pseudo-labels that complement results in the literature on learning from noisy labels. First, Blanchard et al. [7] showed that learning from noisy labels is possible if and only if the total noise level is below the critical threshold  $\epsilon_0 + \epsilon_1 > 1$ ; in the case of learning from pseudo-labels, we show (see Lemma 4.5 in Appendix A.1) that this is satisfied if and only if  $X_S$  is informative of  $Y$  (i.e.,  $Y \nsubseteq X_S$ ). Second, methods for learning under label noise commonly assume knowledge of  $\epsilon_0$  and  $\epsilon_1$  [44], which may be unrealistic in applications where we have absolutely no true (i.e., test-domain) labels; however, for pseudo-labels sampled from a known conditional probability distribution  $P_{Y|X_S}$ , one can express these noise levels in terms of  $P_{Y|X_S}$  and  $P_{X_S}$  and thereby estimate them without any true labels, as on line 3 of Alg. 1.
Possible applications of Thm. 4.4 beyond domain adaptation The reason we wrote Thm. 4.4 in the more general setting of the marginal problem rather than in the specific context of domain adaptation is that we envision possible applications to a number of problems besides domain adaptation. For example, suppose that, after learning a calibrated machine learning model  $M_{1}$  using a feature  $X_{S}$ , we observe an additional feature  $X_{U}$ . In the case that  $X_{S}$  and  $X_{U}$  are complementary, Thm. 4.4 justifies using the student-teacher paradigm [11, 2, 27] to train a model for predicting  $Y$  from  $X_{U}$  (or from  $(X_{S}, X_{U})$  jointly) based on predictions from  $M_{1}$ . This could be useful if we don't have access to labeled pairs  $(X_{U}, Y)$ , or if retraining a model using  $X_{S}$  would require substantial computational resources or access to sensitive or private data. Exploring such approaches could be a fruitful direction for future work
B Proof of Theorem 4.6
This appendix provides a proof of Thm. 4.6, which provides conditions under which our proposed domain adaptation procedure (Alg. 1) is consistent.
We state a formal version of Thm. 4.6:
Theorem 4.6 (Consistency of the bias-corrected classifier). Assume
1.  $X_{S}$  is stable,
2.  $X_{S}$  and  $X_{U}$  are complementary, and
3.  $X_{S}$  is informative of  $Y$  (i.e.,  $X_{S} \nsubseteq Y$ ).
Let  $\widehat{\eta}_n:\mathcal{X}_S\times X_U\to [0,1]$  given by
$$
\widehat {\eta} _ {n} (x _ {S}, x _ {U}) = \sigma \left(f _ {S} (x _ {S}) + \mathrm {l o g i t} \left(\frac {\widehat {\eta} _ {U , n} (x _ {U}) + \widehat {\epsilon} _ {0 , n} - 1}{\widehat {\epsilon} _ {0 , n} + \widehat {\epsilon} _ {1 , n} - 1}\right) - \beta_ {1}\right), \quad \text {f o r a l l} (x _ {S}, x _ {U}) \in \mathcal {X} _ {S} \times \mathcal {X} _ {U},
$$
denote the bias-corrected regression function estimate proposed in Alg. 1, and let  $\widehat{h}_n: \mathcal{X}_S \times \mathcal{X}_U \to \{0,1\}$  given by
$$
\widehat {h} _ {n} \left(x _ {S}, x _ {U}\right) = 1 \left\{\widehat {\eta} \left(x _ {S}, x _ {U}\right) > 1 / 2 \right\}, \quad f o r a l l \left(x _ {S}, x _ {U}\right) \in \mathcal {X} _ {S} \times \mathcal {X} _ {U},
$$
denote the corresponding hard classifier. Let  $\eta_U: \mathcal{X}_U \to [0,1]$ , given by  $\eta_U(x_U) = \operatorname*{Pr}[Y = 1 | X_U = x_U, E = 1]$  for all  $x_U \in \mathcal{X}_U$ , denote the true regression function over  $X_U$ , and let  $\widehat{\eta}_{U,n}$  denote its estimate as assumed in Line 4 of Alg. 1. Then, as  $n \to \infty$ ,
(a) if, for  $P_{X_U}$ -almost all  $x_U \in \mathcal{X}_U$ ,  $\widehat{\eta}_{U,n}(x_U)) \to \eta_U(x_U)$  in probability, then  $\widehat{\eta}_n$  and  $\widehat{h}_n$  are weakly consistent (i.e.,  $\widehat{\eta}_n(x_S, x_U) \to \eta(x_S, x_U)$ $P_{X_S, X_U}$ -almost surely and  $R(\widehat{h}_n) \to R(h^*)$  in probability).
(b) if, for  $P_{X_U}$ -almost all  $x_U \in \mathcal{X}_U$ ,  $\widehat{\eta}_{U,n}(x_U)) \to \eta_U(x_U)$  almost surely, then  $\widehat{\eta}_n$  and  $\widehat{h}_n$  are strongly consistent (i.e.,  $\widehat{\eta}_n(x_S, x_U) \to \eta(x_S, x_U)$ )  $P_{X_S, X_U}$ -almost surely and  $R(\widehat{h}_n) \to R(h^*)$  a.s.).
Before proving Thm. 4.6, we provide a few technical lemmas. The first shows that almost-everywhere convergence of regression functions implies convergence of the corresponding classifiers in classification risk:
Lemma B.1. Consider a sequence of regression functions  $\eta, \eta_1, \eta_2, \ldots: \mathcal{X} \to [0,1]$ . Let  $h, h_1, h_2, \ldots: \mathcal{X} \to \{0,1\}$  denote the corresponding classifiers
$$
h (x) = 1 \{\eta (x) > 1 / 2 \} \quad a n d \quad h _ {i} (x) = 1 \{\eta_ {i} (x) > 1 / 2 \}, \quad f o r a l l i \in \mathbb {N}, x \in \mathcal {X}.
$$
(a) If  $\eta_n(x) \to \eta(x)$  for  $P_X$ -almost all  $x \in \mathcal{X}$  in probability, then  $R(h_n) \to R(h^*)$  in probability.
(b) If  $\eta_n(x) \to \eta(x)$  for  $P_X$ -almost all  $x \in \mathcal{X}$  almost surely as  $n \to \infty$ , then  $R(h_n) \to R(h)$  almost surely.
Proof. Note that, since  $h_n(x) \neq h(x)$  implies  $|\eta_n(x) - \eta(x)| \geq |\eta(x) - 1/2|$ ,
$$
1 \left\{h _ {n} (x) \neq h (x) \right\} \leq 1 \left\{\left| \eta_ {n} (x) - \eta (x) \right| \geq \left| \eta (x) - 1 / 2 \right| \right\}. \tag {B.1}
$$
We utilize this observation to prove both (a) and (b).
Proof of (a) Let  $\delta > 0$ . By Inequality (B.1) and partitioning  $\mathcal{X}$  based on whether  $|2\eta(X) - 1| \leq \delta/2$ ,
$$
\begin{array}{l} \mathbb {E} _ {X} \left[ | 2 \eta (X) - 1 | 1 \{h _ {n} (X) \neq h (X) \} \right] \\ \leq \mathbb {E} _ {X} [ | 2 \eta (X) - 1 | 1 \{| \eta_ {n} (X) - \eta (X) | \geq | \eta (X) - 1 / 2 | \} ] \\ = \mathbb {E} _ {X} [ | 2 \eta (X) - 1 | 1 \{| \eta_ {n} (X) - \eta (X) | \geq | \eta (X) - 1 / 2 | \} 1 \{| 2 \eta (X) - 1 | > \delta / 2 \} ] \\ + \mathbb {E} _ {X} \left[ | 2 \eta (X) - 1 | 1 \{\left| \eta_ {n} (X) - \eta (X) \right| \geq \left| \eta (X) - 1 / 2 \right| \} \right. 1 \{\left| 2 \eta (X) - 1 \right| \leq \delta / 2 \} ] \\ \leq \mathbb {E} _ {X} [ 1 \{\left| \eta_ {n} (X) - \eta (X) \right| > \delta / 2 \} ] + \delta / 2. \\ \end{array}
$$
$$
\begin{array}{l} \lim  _ {n \rightarrow \infty} \Pr_ {\eta_ {n}} \left[ \mathbb {E} _ {X} \left[ | 2 \eta (X) - 1 | 1 \{h _ {n} (X) \neq h (X) \} \right] > \delta \right] \\ \leq \lim  _ {n \rightarrow \infty} \Pr_ {\eta_ {n}} \left[ \mathbb {E} _ {X} \left[ 1 \left\{\left| \eta_ {n} (X) - \eta (X) \right| > \delta / 2 \right\}\right] > \delta / 2 \right] \\ \leq \lim  _ {n \rightarrow \infty} \frac {2}{\delta} \mathbb {E} _ {\eta_ {n}} [ \mathbb {E} _ {X} [ 1 \{| \eta_ {n} (X) - \eta (X) | > \delta / 2 \} ] ] \quad (\text {M a r k o v ' s I n e q u a l i t y}) \\ = \lim  _ {n \rightarrow \infty} \frac {2}{\delta} \mathbb {E} _ {X} \left[ \mathbb {E} _ {\eta_ {n}} \left[ 1 \left\{\left| \eta_ {n} (X) - \eta (X) \right| > \delta / 2 \right\}\right]\right] \tag {Fubini's Theorem} \\ = \frac {2}{\delta} \mathbb {E} _ {X} \left[ \lim  _ {n \rightarrow \infty} \Pr_ {\eta_ {n}} \left[ | \eta_ {n} (X) - \eta (X) | > \delta / 2 \right]\right] \quad (\text {D o m i n a t e d C o n v e r g e n c e T h e o r e m}) \\ = 0. \quad (\eta_ {n} (X) \rightarrow \eta (X), P _ {X} - a. s., i n p r o b a b i l i t y) \\ \end{array}
$$
Proof of (b) For any  $x \in \mathcal{X}$  with  $\eta(x) \neq 1/2$ , if  $\eta_n(x) \to \eta(x)$  then  $1\{|\eta_n(x) - \eta(x)| \geq |\eta(x) - 1/2|\} \to 0$ . Hence, by Inequality (B.1), the dominated convergence theorem (with  $|2\eta(x) - 1|1\{|\eta_n(x) - \eta(x)| \geq |\eta(x) - 1/2|\} \leq 1$ ), and the assumption that  $\eta_n(x) \to \eta(x)$  for  $P_X$ -almost all  $x \in \mathcal{X}$  almost surely,
$$
\begin{array}{l} \lim  _ {n \rightarrow \infty} \mathbb {E} _ {X} [ | 2 \eta (X) - 1 | 1 \{h _ {n} (X) \neq h (X) \} ] \\ \leq \lim  _ {n \rightarrow \infty} \mathbb {E} _ {X} [ | 2 \eta (X) - 1 | 1 \{| \eta_ {n} (X) - \eta (X) | \geq | \eta (X) - 1 / 2 | \} ] \\ = \mathbb {E} _ {X} \left[ \lim  _ {n \rightarrow \infty} | 2 \eta (X) - 1 | 1 \{| \eta_ {n} (x) - \eta (x) | \geq | \eta (x) - 1 / 2 | \} \right] \\ = 0, \quad \text {a l m o s t s u r e l y}. \\ \end{array}
$$
Our next lemma concerns an edge case in which the features  $X_{S}$  and  $X_{U}$  provide perfect but contradictory information about  $Y$ , leading to Equation (4.4) being ill-defined. We show that this can happen only with probability 0 over  $(X_{S}, X_{U}) \sim P_{X_{S}, X_{U}}$  can thus be safely ignored:
Lemma B.2. Consider two predictors  $X_{S}$  and  $X_{Y}$  of a binary label  $Y$ . Then,
$$
\operatorname * {P r} _ {X _ {S}, X _ {U}} \left[ \mathbb {E} \left[ Y | X _ {S} \right] = 1 a n d \mathbb {E} \left[ Y | X _ {U} \right] = 0 \right] = \operatorname * {P r} _ {X _ {S}, X _ {U}} \left[ \mathbb {E} \left[ Y | X _ {S} \right] = 0 a n d \mathbb {E} \left[ Y | X _ {U} \right] = 1 \right] = 0.
$$
Proof. Suppose, for sake of contradiction, that the event
$$
A := \left\{\left(x _ {S}, x _ {U}\right): \mathbb {E} \left[ Y \mid X _ {S} = x _ {S} \right] = 1 \text {a n d} \mathbb {E} \left[ Y \mid X _ {U} = x _ {U} \right] = 0 \right\}
$$
has positive probability. Then, the conditional expectation  $\mathbb{E}[Y|A]$  is well-defined, giving the contradiction
$$
1 = \mathbb {E} _ {X _ {S}} [ \mathbb {E} [ Y | E, X _ {S} ] ] = \mathbb {E} [ Y | A ] = \mathbb {E} _ {X _ {U}} [ \mathbb {E} [ Y | E, X _ {U} ] ] = 0.
$$
The case  $\mathbb{E}[Y|X_S] = 0$  and  $\mathbb{E}[Y|X_U] = 1$  is similar.
We now utilize Lemmas B.1 and B.2 to prove Thm. 4.6.
Proof. By Lemma B.1, it suffices to prove that  $\widehat{\eta}(x_S, x_U) \to \eta(x_S, x_U)$ , for  $P_{X_S, X_U}$ -almost all  $(x_S, x_U) \in \mathcal{X}_S \times \mathcal{X}_U$ , in probability (to prove (a)) and almost surely (to prove (b)).
Finite case We first consider the case when both  $\operatorname*{Pr}[Y|X_S = x_S],\operatorname*{Pr}[Y|X_U = x_U]\in (0,1)$ , so that  $f_{S}(x_{S})$  and  $\logit\left(\frac{\tilde{\eta}(x_U) + \epsilon_0 - 1}{\epsilon_0 + \epsilon_1 - 1}\right)$  are both finite. Since
$$
\begin{array}{l} \widehat {\eta} _ {S, U} (x _ {S}, x _ {U}) - \eta_ {S, U} (x _ {S}, x _ {U}) \\ = \sigma \left(f _ {S} (x _ {S}) + \operatorname {l o g i t} \left(\frac {\widehat {\eta} _ {U , 1} (x _ {U}) + \widehat {\epsilon} _ {0} - 1}{\widehat {\epsilon} _ {0} + \widehat {\epsilon} _ {1} - 1}\right) - \widehat {\beta} _ {1, n}\right) - \sigma \left(f _ {S} (x _ {S}) + \operatorname {l o g i t} \left(\frac {\widetilde {\eta} (x _ {U}) + \epsilon_ {0} - 1}{\epsilon_ {0} + \epsilon_ {1} - 1}\right) - \beta_ {1}\right), \\ \end{array}
$$