SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Let  $c_{u}^{*}$  be the opening cost such that  $\gamma |R_u|$  of the scenarios in  $R_{u}$  have opening cost less than  $c_{u}^{*}$ , and by  $R_{\mathrm{low}} = \{s\in R_u:c_s^{\mathrm{OPT}}\leq c_u^*\}$  the set of these scenarios. Similarly denote by  $v_{u}^{*}$  the value of scenarios in  $R_{\mathrm{low}}$  such that  $\beta |R_{\mathrm{low}}|$  of the scenarios have value less than  $v_{u}^{*}$  and by  $L = \{s\in R_{\mathrm{low}}^p:v_s^{\mathrm{OPT}}\leq v_u^*\}$  these scenarios. This split is shown in Figure 1.
Note that,  $c_{u}^{*}$  corresponds to the weights of node  $u$  in  $\mathcal{T}_{\mathrm{OPT}_o}^{(1 - \gamma)}$ , while the weights of node  $u$  at  $\mathcal{T}_{\mathrm{OPT}_v}^{(1 - \gamma)}$  are at least  $v_{u}^{*}$ .
Let  $B_{L}$  be the set of boxes that the optimal solution uses to cover the scenarios in  $L$ . Let  $L_{b} \subseteq L \subseteq R_{u}$  be the subset of scenarios in  $L$  that choose the value at box  $b$  in OPT. Using inequality (4) with  $b \in B_{L}$  and  $A = L_{b}$ , we obtain  $\sigma_{u}|L_{b}| \leq c_{b}|R_{u}| + \sum_{s \in L_{b}} v_{s}^{\mathrm{OPT}}$ , and by summing up the inequalities for all  $b \in B_{L}$  we get
$$
\sigma_ {u} \leq \frac {\left| R _ {u} \right| \sum_ {b \in B _ {L}} c _ {b} + \sum_ {s \in L} v _ {s} ^ {\mathrm {O P T}}}{| L |} \leq \frac {\left| R _ {u} \right| c ^ {*} + \sum_ {s \in L} v _ {s} ^ {\mathrm {O P T}}}{| L |} \leq \frac {c _ {u} ^ {*}}{\beta \cdot \gamma} + v _ {u} ^ {*} \tag {9}
$$
where for the second inequality we used that the cost for covering the scenarios in  $L$  is at most  $c_u^*$  by construction, and in the last inequality that  $|L| = |R_t| / (\beta \cdot \gamma)$ . We consider each term above separately, to show that the point  $p$  is within the histograms.
Proof of Lemma 3.3.1. We denote by  $\mathcal{T}_u$  the subtree rooted at  $u$ , by  $W(\mathcal{T}) = \{w : w \in \mathbf{w}_v \text{ for } v \in \mathcal{T}\}$  the (multi)set of weights in the tree  $\mathcal{T}$ . Denote, by  $q^\rho(\mathcal{T})$  be the top  $\rho$  percentile of all the weights in  $\mathcal{T}$ . Finally, we define  $Q(\rho|\mathcal{T})$  for any tree  $\mathcal{T}$  as follows:
- We create a histogram  $H(x)$  of the weights in  $W(\mathcal{T})$  in increasing order.
- We calculate the area enclosed within  $(1 - \rho)|W(\mathcal{T})|$  until  $|W(\mathcal{T})|$ :
$$
Q \left(\rho | \mathcal {T}\right) = \int_ {(1 - \rho) | W (\mathcal {T}) |} ^ {| W (\mathcal {T}) |} H (x) d x
$$
This is approximately equal to the sum of all the values greater than  $q^{\rho}(\mathcal{T})$  with values exactly  $q^{\rho}(\mathcal{T})$  taken fractionally so that exactly  $\rho$  fraction of values are selected.
We show by induction that for every node  $u$ , it holds that  $\rho \cdot \mathrm{cost}(\mathcal{T}_u^{(\rho)}) \leq Q(\rho|\mathcal{T})$
- For the base case, for all leaves  $u$ , the subtree  $\mathcal{T}_u$  only has one node and the lemma holds as  $\rho q^{\rho}(\mathcal{T}_u) \leq Q(\rho |\mathcal{T}_u)$ .
- Now, let  $r$  be any node of the tree, and denote by  $\operatorname{child}(r)$  the set of the children nodes of  $r$ .
$$
\begin{array}{l} \rho \cdot \operatorname {c o s t} \left(\mathcal {T} _ {r} ^ {(\rho)}\right) = \rho \cdot q ^ {\rho} \left(\mathcal {T} _ {r}\right) \left| \boldsymbol {w} _ {r} \right| + \rho \cdot \sum_ {v \in \operatorname {c h i l d} (r)} \operatorname {c o s t} \left(\mathcal {T} _ {v} ^ {(\rho)}\right) \quad \text {D e f i n i t i o n} \\ \leq \rho \cdot q ^ {\rho} \left(\mathcal {T} _ {r}\right) \left| \boldsymbol {w} _ {r} \right| + \rho \cdot \sum_ {v \in \operatorname {c h i l d} (r)} Q (\rho | T _ {v}) \quad \text {F r o m i n d u c t i o n h y p o t h e s i s} \\ \leq \rho \cdot q ^ {\rho} (\mathcal {T} _ {r}) | \boldsymbol {w} _ {r} | + Q \left(\rho \frac {| W (\mathcal {T} _ {r}) | - | \boldsymbol {w} _ {r} |}{| W (\mathcal {T} _ {r}) |} \Bigg | T _ {r}\right) \quad \text {S i n c e} \mathcal {T} _ {v} \subseteq T _ {r} \\ \leq Q \left(\rho | T _ {r}\right) \\ \end{array}
$$
The second-to-last inequality follows since  $Q$  is defined as the area of the largest weights of the histogram. Including more weights only increases and keeping the length of the integration range the same (equal to  $\rho(|W(\mathcal{T}_r)| - |\mathbf{w}_r|)$ ) can only increase the value  $Q$ .
The last inequality follows by noting that if  $H(x)$  is the histogram corresponding to the values of  $\mathcal{T}_r$ , then
$$
Q \left(\rho \mid T _ {r}\right) - Q \left(\rho \frac {\left| W \left(\mathcal {T} _ {r}\right) \right| - \left| \boldsymbol {w} _ {r} \right|}{\left| W \left(\mathcal {T} _ {r}\right) \right|} \Bigg | T _ {r}\right) = \int_ {(1 - \rho) \mid W \left(\mathcal {T} _ {r}\right)} ^ {\left| W \left(\mathcal {T} _ {r}\right) \right|} H (x) d x - \int_ {(1 - \rho) \mid W \left(\mathcal {T} _ {r}\right) + \rho \mid \boldsymbol {w} _ {r} \mid} ^ {\left| W \left(\mathcal {T} _ {r}\right) \right|} H (x) d x
$$
$$
\begin{array}{l} = \int_ {(1 - \rho) | W (\mathcal {T} _ {r}) |} ^ {(1 - \rho) | W (\mathcal {T} _ {r}) | + \rho | \boldsymbol {w} _ {r} |} H (x) d x \geq \int_ {(1 - \rho) | W (\mathcal {T} _ {r}) |} ^ {(1 - \rho) | W (\mathcal {T} _ {r}) | + \rho | \boldsymbol {w} _ {r} |} q ^ {\rho} (\mathcal {T} _ {r}) d x \\ = \rho q ^ {\rho} \left(\mathcal {T} _ {r}\right) | \boldsymbol {w} _ {r} | \\ \end{array}
$$
where the inequality follows since  $H(x) \geq q^{\rho}(\mathcal{T}_r)$  for  $x \geq (1 - \rho)|W(\mathcal{T}_r)|$  by the definition of  $q^{\rho}(\mathcal{T}_r)$  as the top- $r$  quantile of the weights in  $\mathcal{T}_r$ .
Figure 5: Picture depicting the proof above.
A.4 Lower Bound
To show that our algorithm is almost tight, we observe that the lower bound of Min Sum Set Cover presented in Feige et al. [2004] also applies to PANDORA's BOX. In MIN SUM SET COVER we are given  $n$  elements  $e_i$ , and  $m$  sets  $s_j$  where each  $s_j \subseteq [n]$ . We say a set  $s_j$  covers an element  $e_i$  if  $e_i \in s_j$ . The goal is to select elements in order to minimize the sum of the covering times of all the sets, where covering time of a set is the first time an element  $e_i \in s_j$  is chosen. This lower bound is also mentioned in Chawla et al. [2020], but we include it here with more details for the sake of completeness.
In Feige et al. [2004] the authors show that MIN SUM SET COVER cannot be approximated better than  $4 - \varepsilon$  even in the special case where every set contains the same number of elements<sup>5</sup>. We restate the theorem below.
Theorem A.1 (Theorem 13 of Feige et al. [2004]). For every  $\varepsilon > 0$ , it is NP-hard to approximate min sum set cover within a ratio of  $4 - \varepsilon$  on uniform hypergraphs.
Our main observation is that MIN SUM SET COVER is a special case of PANDORA'S BOX. When the boxes all have the same opening cost  $c_{b} = 1$  and the values inside are  $v_{s}^{b} \in \{0, \infty\}$ , we are required to find a 0 for each scenario; equivalent to covering a scenario. The optimal solution of MIN SUM SET COVER is an algorithm that selects elements one by one, and stops whenever all the sets are covered. This is exactly the partially adaptive optimal we defined for PANDORA'S BOX. The theorem restated above results in the following Corollary.
Corollary A.1.1. For every  $\varepsilon > 0$  it is NP-Hard to approximate Pandora's Box against the partially-adaptive within a ratio better than  $4 - \varepsilon$ .
A.5 Proofs from Section 4
We first present an example of a discrete distribution that shows that one needs exponentially many samples in the number of boxes to learn  $D_{V = v}$ .
Discrete Distribution Example Consider a distribution that only takes values  $0, H, H + 1$  for some very large  $H > 0$ . The scenario is drawn by choosing a random bit  $b_i \in \{0, 1\}$  for every box
Equivalently forms a uniform hypergraph, where sets are hyperedges, and elements are vertices.
and depending on the realized sequence  $\mathbf{b}$  a single box  $f(\mathbf{b}) \in [n]$  is chosen for an unknown and arbitrary function  $f$ . The value at box  $i$  is then chosen to be  $H + b_{i}$  unless  $i$  is the box  $f(\mathbf{b})$  in which case it is 0. In this case learning the probability  $D_{V = v}$  would require learning the unknown function  $f$  on all inputs which are exponentially many. In particular, if we only take  $s < 2^{n}$  samples, for any order of choosing boxes after  $\approx \log s$  steps, none of the samples in our collection will match the observed sequence of bits, therefore it will not be possible to compute a posterior distribution.
We continue by giving the omitted proofs.
$$
\left| \mathbb {E} _ {\hat {D}} \left[ A L G (\pi , \tau) - \min  _ {b \in \mathcal {B}} v _ {b} \right] - \mathbb {E} _ {D} \left[ A L G (\pi , \tau) - \min  _ {b \in \mathcal {B}} v _ {b} \right] \right| \leq \varepsilon
$$
for any permutation  $\pi$  and any vector of thresholds  $\pmb{v} \in \left[0, \frac{n}{\varepsilon}\right]^n$
Proof of Lemma 4.1.1. We first argue that we can accurately estimate the cost for any vector of thresholds  $\pmb{\tau}$  when the order of visiting boxes is fixed.
Consider any fixed permutation  $\pi = \pi_1, \pi_2, \ldots, \pi_n$  be any permutation of the boxes, we relabel the boxes without loss of generality so that  $\pi_i$  is box  $i$ .
Denote by  $\hat{V}_i = \min_{j\leq i}v_j$ , and observe that  $\hat{V}_i$  is a random variable that depends on the distribution  $\mathcal{D}$ . Then we can write the expected cost of the algorithm as the expected sum of the opening cost and the chosen value:  $\mathbb{E}_{\mathcal{D}}[\mathrm{ALG}] = \mathbb{E}_{\mathcal{D}}[\mathrm{ALG}_o] + \mathbb{E}_{\mathcal{D}}[\mathrm{ALG}_v]$ . We have that:
$$
\mathbb {E} _ {\mathcal {D}} \left[ \mathrm {A L G} _ {o} \right] = \sum_ {i = 1} ^ {n} \mathbf {P r} _ {\mathcal {D}} [ \text {r e a c h} i ] = \sum_ {i = 1} ^ {n} \mathbf {P r} _ {\mathcal {D}} \left[ \bigwedge_ {j = 1} ^ {i - 1} \left(\hat {V} _ {j} > \tau_ {j + 1}\right) \right]
$$
Moreover, we denote by  $\overline{V}_{\tau}^{i} = \bigwedge_{j=1}^{i-1}\left(\hat{V}_{j} > \tau_{j+1}\right)$  and we have
$$
\begin{array}{l} \mathbb {E} _ {\mathcal {D}} \left[ \mathrm {A L G} _ {v} - \hat {V} _ {n} \right] = \sum_ {i = 1} ^ {n} \mathbb {E} _ {\mathcal {D}} \left[ \left(\hat {V} _ {i} - \hat {V} _ {n}\right) \cdot \mathbb {1} \{\text {s t o p a t} i \} \right] \\ = \sum_ {i = 1} ^ {n - 1} \mathbb {E} _ {\mathcal {D}} \left[ \left(\hat {V} _ {i} - \hat {V} _ {n}\right) \cdot \mathbb {1} \left\{\overline {{V}} _ {\tau} ^ {i} \wedge \left(\hat {V} _ {i} \leq \tau_ {i + 1}\right) \right\} \right] \\ = \sum_ {i = 1} ^ {n - 1} \mathbb {E} _ {\mathcal {D}} \left[ \tau_ {i + 1} \mathbf {P r} _ {r \sim U [ 0, \tau_ {i + 1} ]} \left[ r <   \hat {V} _ {i} - \hat {V} _ {n} \right] \cdot \mathbb {1} \left\{\overline {{V}} _ {\tau} ^ {i} \wedge (\hat {V} _ {i} \leq \tau_ {i + 1}) \right\} \right] \\ = \sum_ {i = 1} ^ {n - 1} \tau_ {i + 1} \mathbf {P r} _ {\mathcal {D}, r \sim U [ 0, \tau_ {i + 1} ]} \left[ \bar {V} _ {\tau} ^ {i} \wedge \left(r + \hat {V} _ {n} \leq \hat {V} _ {i} \leq \tau_ {i + 1}\right) \right] \\ \end{array}
$$
In order to show our result, we use from Blumer et al. [1989] that for a class with VC dimension  $d < \infty$  that we can learn it with error at most  $\varepsilon$  with probability  $1 - \delta$  using  $m = \mathrm{poly}(1 / \varepsilon, d, \log(1 / \delta))$  samples.
Consider the class  $\mathcal{F}_{\tau}(\hat{V},r) = \bigwedge_{j = 1}^{i - 1}(\hat{V}_j > \tau_{j + 1})$ . This defines an axis parallel rectangle in  $\mathbb{R}^i$ , therefore its VC-dimension is  $2i$ . Using the observation above we have that using  $m = \mathrm{poly}(1 / \varepsilon ,n,\log (1 / \delta))$  samples, with probability at least  $1 - \delta$ , it holds
$$
\left| \mathbf {P r} _ {\mathcal {D}} \left[ \mathcal {F} _ {\boldsymbol {\tau}} (\hat {V}, r) \right] - \mathbf {P r} _ {\hat {\mathcal {D}}} \left[ \mathcal {F} _ {\boldsymbol {\tau}} (\hat {V}, r) \right] \right| \leq \varepsilon
$$
for all  $\pmb {\tau}\in \mathbb{R}^n$
Similarly, the class  $\mathcal{C}_{\tau}(\hat{V},r) = \bigwedge_{j = 1}^{i - 1}\left(\hat{V}_j > \tau_{j + 1}\right)\wedge \left(r + \hat{V}_n\leq \hat{V}_i\leq \tau_{i + 1}\right)$  has VC-dimension  $O(n)$  since it is an intersection of at most  $n$  (sparse) halfspaces. Therefore, the same argument as before applies and for  $m = \mathrm{poly}(1 / \varepsilon ,n,\log (1 / \delta))$  samples, we get
$$
\left| \mathbf {P r} _ {\mathcal {D}, r \sim U [ 0, \tau_ {i + 1} ]} \left[ \mathcal {C} _ {\boldsymbol {\tau}} (\hat {V}, r) \right] - \mathbf {P r} _ {\hat {\mathcal {D}}, r \sim U [ 0, \tau_ {i + 1} ]} \left[ \mathcal {C} _ {\boldsymbol {\tau}} (\hat {V}, r) \right] \right| \leq \varepsilon
$$
for all  $\pmb {\tau}\in \mathbb{R}^n$  , with probability at least  $1 - \delta$
Putting it all together, the error can still be unbounded if the thresholds  $\tau$  are too large. However, since we assume that  $\tau_{i} \leq n / \varepsilon$  for all  $i \in [n]$ ,  $\mathrm{poly}(n, 1 / \varepsilon, \log(1 / \delta))$  samples suffice to get  $\varepsilon$  error overall, by setting  $\varepsilon \gets \frac{\varepsilon^2}{n}$ .
While we obtain the result for a fixed permutation, we can directly obtain the result for all  $n!$  permutations through a union bound. Setting  $\delta \gets \frac{\delta}{n!}$  only introduces an additional factor of  $\log(n!) = n \log n$  in the overall sample complexity.
Lemma 4.1.2. Let  $\mathcal{D}$  be any distribution of values. Let  $\varepsilon >0$  and consider a permutation  $\pi$  and thresholds  $\pmb{\tau}$ . Moreover, let  $\tau^\prime$  be the thresholds capped to  $n / \varepsilon$ , i.e. setting  $\tau_b^{\prime} = \min \{\tau_b,n / \varepsilon \}$  for all boxes  $b$ . Then,
$$
\mathbb {E} _ {v \sim_ {D}} \left[ A L G \left(\pi , \tau^ {\prime}\right) \right] \leq (1 + \varepsilon) \mathbb {E} _ {v \sim_ {D}} \left[ A L G \left(\pi , \tau\right) \right].
$$
Proof of Lemma 4.1.2. We compare the expected cost of ALG with the original thresholds and the transformed one  $\mathrm{ALG}'$  with the capped thresholds. For any value vector  $v \sim \mathcal{D}$ , either (1) the algorithms stopped at the same point having the same opening cost and value, or (2) ALG stopped earlier at a threshold  $\tau > n / \varepsilon$ , while  $\mathrm{ALG}'$  continued. In the latter case, the value  $v$  that ALG gets is greater than  $n / \varepsilon$ , while the value  $v'$  that  $\mathrm{ALG}'$  gets is smaller,  $v' \leq v$ . For such a scenario, the opening cost  $c$  of ALG, and the opening cost  $c'$  of  $\mathrm{ALG}'$  satisfy  $c' \leq c + n$ . Thus, the total cost is  $c' + v' \leq c + v + n \leq (1 + \varepsilon)(c + v)$ . Overall, we get that
$$
\mathbb {E} _ {\mathcal {D}} \left[ \mathrm {A L G} ^ {\prime} \right] \leq \mathbb {E} _ {\mathcal {D}} \left[ \mathrm {A L G} \right] (1 + \varepsilon).
$$
Proof of Theorem 4.1. With  $\mathrm{poly}(n,\varepsilon ,\log (1 / \delta))$  samples from  $\mathcal{D}$ , we obtain an empirical distribution  $\hat{\mathcal{D}}$ .
From Lemma 4.1.1, we have that with probability at least  $1 - \delta \varepsilon / \log(1/\delta)$ , the following holds
$$
\left| \mathbb {E} _ {v \sim \hat {D}} \left[ \mathrm {A L G} (\pi , \tau) - \min  _ {b \in \mathcal {B}} v _ {b} \right] - \mathbb {E} _ {v \sim D} \left[ \mathrm {A L G} (\pi , \tau) - \min  _ {b \in \mathcal {B}} v _ {b} \right] \right| \leq \varepsilon \tag {10}
$$
for any permutation  $\pi$  and any vector of thresholds  $\pmb{v} \in \left[0, \frac{n}{\varepsilon}\right]^n$ . This gives us that we can estimate the cost of a threshold policy accurately.
To compare with the set of all partially adaptive policies that may not take the form of a threshold policy, we consider the set of scenario aware policies (SA). These are policies  $\mathrm{SA}(\pi)$  parameterized by a permutation  $\pi$  of boxes and are forced to visit the boxes in that order. However, they are aware of all values in the boxes in advance and know precisely when to stop. These are unrealistic policies introduced in Chawla et al. [2020] which serve as an upper bound to the set of all partially adaptive policies.
As shown in Chawla et al. [2020] (Lemma 3.3), scenario-aware policies are also learnable from samples. With probability at least  $1 - \delta \varepsilon / \log(1/\delta)$ , it holds that for any permutation  $\pi$
$$
\left| \mathbb {E} _ {v \sim \hat {D}} \left[ S A (\pi) - \min  _ {b \in \mathcal {B}} v _ {b} \right] - \mathbb {E} _ {v \sim D} \left[ S A (\pi) - \min  _ {b \in \mathcal {B}} v _ {b} \right] \right| \leq \varepsilon . \tag {11}
$$
The  $\alpha$ -approximation guarantees (with  $a \approx 4.428$ ) of Algorithm 1 hold even against scenario aware policies as there is no restriction on how the partially-adaptive policy may choose to stop. So for the empirical distribution, we can compute a permutation  $\hat{\pi}$  and thresholds  $\hat{\tau}$  such that:
$$
\mathbb {E} _ {\hat {D}} \left[ \mathrm {A L G} (\hat {\pi}, \hat {\tau}) \right] \leq \alpha \cdot \min  _ {\pi} \mathbb {E} _ {\hat {D}} \left[ S A (\pi) \right]
$$
Clipping the thresholds to obtain  $\hat{\tau}^{\prime} = \min \{\hat{\tau}, n / \varepsilon\}$ , and letting  $\Delta = \mathbb{E}_{v \sim \hat{D}}[\min_{b \in \mathcal{B}} v_b] - \mathbb{E}_{v \sim D}[\min_{b \in \mathcal{B}} v_b]$ , we have that:
$$
\mathbb {E} _ {D} \left[ \mathrm {A L G} (\hat {\pi}, \hat {\tau} ^ {\prime}) \right] \leq \mathbb {E} _ {\hat {D}} \left[ \mathrm {A L G} (\hat {\pi}, \hat {\tau} ^ {\prime}) \right] - \Delta + \varepsilon
$$
$$
\begin{array}{l} \leq (1 + \varepsilon) \mathbb {E} _ {\hat {D}} [ \mathrm {A L G} (\hat {\pi}, \hat {\tau}) ] + \Delta + \varepsilon / 4 \\ \leq (1 + \varepsilon) \alpha \cdot \min _ {\pi} \mathbb {E} _ {\hat {D}} [ S A (\pi) ] - \Delta + \varepsilon / 4 \\ \leq (1 + \varepsilon) \alpha \cdot \min  _ {\pi} \mathbb {E} _ {D} [ S A (\pi) ] + O (\Delta + \varepsilon) \\ \end{array}
$$
By Markov's inequality, we have that  $\mathbf{Pr}\left[\mathbb{E}_{v\sim \hat{D}}\left[\min_{b\in \mathcal{B}}v_b\right]\leq (1 + \varepsilon)\mathbb{E}_{v\sim D}\left[\min_{b\in \mathcal{B}}v_b\right]\right]\geq \frac{\varepsilon}{1 + \varepsilon}\geq$ $\varepsilon /2$
Thus, repeating the sampling process  $\frac{O(\log 1 / \delta)}{\varepsilon}$  times and picking the empirical distribution with minimum  $\mathbb{E}_{v\sim \hat{D}}[\min_{b\in \mathcal{B}}v_b]$  satisfies  $\Delta \leq \varepsilon \mathbb{E}_{v\sim D}[\min_{b\in \mathcal{B}}v_b]$  with probability at least  $1 - \delta$  and simultaneously satisfies equations (10) and (11).
This shows that  $\mathbb{E}_D[\mathrm{ALG}(\hat{\pi},\hat{\tau}')]\leq (1 + O(\varepsilon))\alpha \cdot \min_{\pi}\mathbb{E}_D[SA(\pi)]$  which completes the proof by rescaling  $\varepsilon$  by a constant.