SlowGuess/NeurIPS_2023_OCR huggingface dataset:
$$
\hat {R} _ {P U b N \hat {e}, \eta , \hat {\sigma}} (g) = \pi \hat {R} _ {P} ^ {\hat {e}} (g, + 1) + \rho \hat {R} _ {b N} ^ {\hat {e}} (g, - 1) + \hat {\bar {R}} _ {s = - 1, \eta , \hat {\sigma}} ^ {\hat {e}} (g)
$$
where  $\hat{R}_{bN}^{\hat{e}}(g, - 1) = \sum_{i = 1}^{n_{bN}}\frac{1}{\hat{e}(x_i^{bN})} L(g(x_i^{bN}), - 1)$  and
$$
\begin{array}{l} \hat {\hat {R}} _ {s = - 1, \eta , \hat {\sigma}} ^ {\hat {e}} (g) = \frac {1}{n _ {U}} \sum_ {i = 1} ^ {n _ {U}} \left[ \mathbb {1} _ {\hat {\sigma} \left(x _ {i} ^ {U}\right) \leq \eta} L \left(g \left(x _ {i} ^ {U}\right), - 1\right) \left(1 - \hat {\sigma} \left(x _ {i} ^ {U}\right)\right) \right] \\ + \pi \sum_ {i = 1} ^ {n _ {P}} \left[ \frac {1}{\hat {\bar {e}} (x _ {i} ^ {P})} \mathbb {1} _ {\hat {\sigma} (x _ {i} ^ {P}) > \eta} L (g (x _ {i} ^ {P}), - 1) \frac {1 - \hat {\sigma} (x _ {i} ^ {P})}{\hat {\sigma} (x _ {i} ^ {P})} \right] + \rho \sum_ {i = 1} ^ {n _ {b N}} \left[ \frac {1}{\hat {\bar {e}} (x _ {i} ^ {b N})} \mathbb {1} _ {\hat {\sigma} (x _ {i} ^ {b N}) > \eta} L (g (x _ {i} ^ {b N}), - 1) \frac {1 - \hat {\sigma} (x _ {i} ^ {b N})}{\hat {\sigma} (x _ {i} ^ {b N})} \right] \\ \end{array}
$$
D.6 unbiased
$$
\begin{array}{l} \mathbb {E} [ \hat {R} _ {P U e} (g) ] \\ = \mathbb {E} [ \pi \hat {R} _ {P} ^ {e} (g, + 1) + \hat {R} _ {U} (g, - 1) - \pi \hat {R} _ {P} ^ {e} (g, - 1) ] \\ = \mathbb {E} \left[ \frac {1}{n} \sum_ {i = 1} ^ {n _ {P}} \frac {1}{e \left(\boldsymbol {x} _ {i} ^ {P}\right)} \left(L \left(g \left(\boldsymbol {x} _ {i} ^ {P}\right), + 1\right) - L \left(g \left(\boldsymbol {x} _ {i} ^ {P}\right), - 1\right)\right) + \frac {1}{n} \sum_ {i = 1} ^ {n} L \left(g \left(\boldsymbol {x} _ {i}\right), - 1\right) \right] \\ = \mathbb {E} \left[ \frac {1}{n} \sum_ {i = 1} ^ {n _ {P}} \frac {1}{e \left(\boldsymbol {x} _ {i} ^ {P}\right)} L \left(g \left(\boldsymbol {x} _ {i} ^ {P}\right), + 1\right) + \left(1 - \frac {1}{e \left(\boldsymbol {x} _ {i} ^ {P}\right)}\right) L \left(g \left(\boldsymbol {x} _ {i} ^ {P}\right), - 1\right) + \frac {1}{n} \sum_ {i = 1} ^ {n} \left(1 - s _ {i}\right) L \left(g \left(\boldsymbol {x} _ {i}\right), - 1\right) \right] \\ = \mathbb {E} \left[ \frac {1}{n} \sum_ {i = 1} ^ {n} s _ {i} \frac {1}{e \left(\boldsymbol {x} _ {i} ^ {P}\right)} L \left(g \left(\boldsymbol {x} _ {i} ^ {P}\right), + 1\right) + s _ {i} \left(1 - \frac {1}{e \left(\boldsymbol {x} _ {i} ^ {P}\right)}\right) L \left(g \left(\boldsymbol {x} _ {i} ^ {P}\right), - 1\right) + \left(1 - s _ {i}\right) L \left(g \left(\boldsymbol {x} _ {i}\right), - 1\right) \right] \\ = \frac {1}{n} \sum_ {i = 1} ^ {n} y _ {i} e _ {i} \frac {1}{e (\boldsymbol {x} _ {i})} L (g (\boldsymbol {x} _ {i}), + 1) + y _ {i} e _ {i} \left(1 - \frac {1}{e (\boldsymbol {x} _ {i})}\right) L (g (\boldsymbol {x} _ {i}), - 1) + (1 - y _ {i} e _ {i}) L (g (\boldsymbol {x} _ {i}), - 1) \\ = \frac {1}{n} \sum_ {i = 1} ^ {n} y _ {i} L (g (\boldsymbol {x} _ {i}), + 1) + y _ {i} (e _ {i} - 1) L (g (\boldsymbol {x} _ {i}), - 1) + (1 - y _ {i} e _ {i}) L (g (\boldsymbol {x} _ {i}), - 1) \\ = \frac {1}{n} \sum_ {i = 1} ^ {n} y _ {i} L (g (\boldsymbol {x} _ {i}), + 1) + (1 - y _ {i}) L (g (\boldsymbol {x} _ {i}), - 1) \\ = R _ {P N} (g | y). \tag {15} \\ \end{array}
$$
The change of  $\hat{R}_{PUe}(g)$  will be no more than  $L_{\max} / n$  if some  $x_i \in \chi_P \cup \chi_U$  is replaced, and McDiarmid's inequality gives us:
$$
\operatorname * {P r} \{| \hat {R} _ {P U e} (g) - R _ {P N} (g | y) | \geq \epsilon \} = \operatorname * {P r} \{| \hat {R} _ {P U e} (g) - \mathbb {E} [ \hat {R} _ {P U e} (g) | \geq \epsilon \} \leq 2 \exp \left(- \frac {2 \epsilon^ {2}}{n (L _ {\max } / n) ^ {2}}\right).
$$
And make the right side of the previous formula equal to  $\eta$ :
$$
\begin{array}{l} 2 \exp \left(- \frac {2 \epsilon^ {2}}{n (L _ {\max} / n) ^ {2}}\right) = \eta \\ \Longleftrightarrow \exp \left(\frac {2 \epsilon^ {2}}{n (L _ {\max } / n) ^ {2}}\right) = \frac {2}{\eta} \\ \Longleftrightarrow \frac {2 \epsilon^ {2}}{L _ {\max } ^ {2} / n} = \ln \left(\frac {2}{\eta}\right) \\ \Longleftrightarrow 2 \epsilon^ {2} = \frac {L _ {\operatorname* {m a x}} ^ {2} \ln \left(\frac {2}{\eta}\right)}{n} \\ \Longleftrightarrow \epsilon = \sqrt {\frac {L _ {\operatorname* {m a x}} ^ {2} \ln \left(\frac {2}{\eta}\right)}{2 n}} \\ \end{array}
$$
Equivalently, with probability at least  $1 - \eta$
$$
\left| \hat {R} _ {P U e} (g) - R _ {P N} (g | y) \right| = \left| \hat {R} _ {P U e} (g) - \mathbb {E} \left[ \hat {R} _ {P U e} (g) \right] \right| \leq \sqrt {\frac {L _ {\max } ^ {2} \ln \frac {2}{\eta}}{2 n}}. \tag {16}
$$
And because we know the expressions of  $\hat{R}_{PUe}(g)$  and  $\hat{R}_{uPU}(g)$ :
$$
\hat {R} _ {P U e} (g) = \pi \hat {R} _ {P} ^ {e} (g, + 1) + \hat {R} _ {U} (g, - 1) - \pi \hat {R} _ {P} ^ {e} (g, - 1), \tag {17}
$$
$$
\hat {R} _ {P U} (g) = \pi \hat {R} _ {P} (g, + 1) + \hat {R} _ {U} (g, - 1) - \pi \hat {R} _ {P} (g, - 1), \tag {18}
$$
Since we know that  $\sum_{j=1}^{n_P} \frac{1}{e(\boldsymbol{x}_j^P)} = N_P$ , we can get the following formula:
$$
\begin{array}{l} \left| \hat {R} _ {P U e} (g) - \hat {R} _ {P U} (g) \right| \\ = \pi | \hat {R} _ {P} ^ {e} (g, + 1) - \hat {R} _ {P} ^ {e} (g, - 1) - \left(\left(\hat {R} _ {P} (g, + 1) - \hat {R} _ {P} (g, - 1)\right) \right| \\ \leq \frac {1}{n} | \sum_ {i = 1} ^ {n _ {P}} (\frac {1}{e (\boldsymbol {x} _ {i} ^ {P})} - \frac {N _ {P}}{n _ {p}}) L (g (\boldsymbol {x} _ {i} ^ {P}), + 1) | + \frac {1}{n} | \sum_ {i = 1} ^ {n _ {P}} (\frac {1}{e (\boldsymbol {x} _ {i} ^ {P})} - \frac {N _ {P}}{n _ {p}}) L (g (\boldsymbol {x} _ {i} ^ {P}), - 1) | \\ \leq \frac {2}{n} N _ {P} L _ {\max } = 2 \pi L _ {\max } \tag {19} \\ \end{array}
$$
Then, we can prove:
$$
\begin{array}{l} \left| R _ {P N} (g \mid y) - \hat {R} _ {P U} (g) \right| \\ \leq \left| R _ {P N} (g | y) - \hat {R} _ {P U e} (g) \right| + \left| \hat {R} _ {P U e} (g) - \hat {R} _ {P U} (g) \right| \\ \leq 2 \pi L _ {\max } + \sqrt {\frac {L _ {\max } ^ {2} \ln \frac {2}{\eta}}{2 n}}. \tag {20} \\ \end{array}
$$