## 2 Methods
### Hyperband Early Stopping Algorithm  
Although the BO algorithm allows us to automatically find the optimal hyperparameters in order to maximize IoU and F1-score segmentation metrics, it does not prevent the full test of unpromising experiments. For that reason and to save computational time resources, we included an early stopping mechanism in our BO loop for preventing unpromising training experiments. Hyperband is a bandit optimization algorithm developed by [PERSON] et al. (2017). It is based on the Successive Halving (SH) algorithm from [PERSON] et al. (2018). The SH algorithm is resource-based, which means that it allocates a budget B, for example, training time to a set of hyperparameter configurations \(n\). It evaluates the performance of all configurations by uniformly allocating the \(\frac{B}{n}\) average resource. Then, it throws away the worst half of the performances and repeats the procedure until one configuration remains. However, a fundamental issue is how to choose the tradeoff between considering a large budget (e.g., long training time) with a small number of configurations, or the reverse. Hyperband attempts to solve this tradeoff by fixing the budget and exploring several configurations using a grid search method (i.e., design of experiment of all possible configurations).  
The Hyperband algorithm, as described in Algorithm 2, requires two inputs: R, the maximum number of allocated resources to one configuration, and \(\eta\), the proportion of throwing out configurations generated by SH algorithms at each iteration. A bracket designed a run of the SH algorithm. The input parameters control the number of brackets and allocating budgets.  
```
input:\((R,\eta)\)
1 initialization:\(s_{\max}=\left\lfloor\log_{\eta}R\right\rfloor\), B=\((s_{\max}+1)R\)
2 for\(s\in\{s_{\max},s_{\max}-1,\ \ldots,0\}\)do
3\(n=\left\lceil\frac{B}{R}\frac{n^{s}}{S+1}\right\rceil\), \(r=R_{1}-S\)
4//Start Successive Halving inner loop
5\(\Omega=\text{get\_hyperparameter\_configuration}(n)\)
6 for\(i\in\{0,s\}\)do
7\(n_{i}=\left\lceil m^{-1}\right\rceil\), \(r_{i}=m^{i}\)
8\(L(\Omega)=\{\text{run\_then\_return\_val\_loss}(t,r_{i})|\ t\in\Omega\}\)
9\(\Omega=\text{top\_}k(\Omega,L(\Omega),\left\lfloor\frac{n}{\eta}\right\rfloor)\)
10 endfor
11 endforreturn configuration with the best validation loss seen so far
```  
**Algorithm 2**Hyperband early stopping.  
In lines 1-2, the algorithm starts with the more aggressive bracket with the maximum allocated resources for maximizing exploration (i.e., give some minimal time to tracking experiment and prevent premature experiment early stopping). The function \"get_hyperparameter_configuration\((n)\)\" performs a hypercube sampling of the input hyperparameter and obtains an initial guess configuration. Then, each bracket (i.e., SH iterations, lines 6-9) decreases the number of remaining configurations \(n\) by the dropout \(\eta\) until the last bracket (\(s=0\)). For each bracket, the function \"run_then_return_val_loss\((t,r_{i})\)\" (line 8) takes an input hyperparameter configuration \(t\) with the corresponding resources budget \(r_{i}\), performs a training of the network and returns the associated validation loss. Finally, at line 9, the function \"top_k\" returns the top \(k\) training configurations.  
To summarize, Hyperband is an adaptative algorithm that tracks iterations as a budget resource and associated training/validation losses. In this way, by adaptatively optimizing the average budget ratio, it could automatically stop unpromising experiments early.