## 2 Materials and Methods
### Regression Model
#### 2.2.3 Network Architecture  
As stated above, the regression neural network will estimate the reflectances of the target bands using the reflectances of the other bands as predictors. All computations are performed for individual pixels. In order to take into account BRDF effects, the solar and sensor angles (both azimuth and zenith, as described in Section 1.3) are also used as predictors. More precisely, the sines and cosines of each angle are used. Instead of using all predictors (reflectances and angles) together in a flat vector as input for an MLP as in Figure 3, we use an attention mechanism where the angular information modulates the spectral values. This is implemented as illustrated in Figure 4. First, the spectral and angular information are fed to the _Angular MLP_ which is used to generate an attention mask. An attention mask is a vector of real numbers in \([0,1]\) with the same number of components as the data on which the attention is being applied. In our case, this is the vector of spectral bands. The _Angular MLP_ is a standard MLP with a single hidden layer containing eight neurons and a _SoftMax_ layer as output. The _SoftMax_ function is an exponential normalization that maps a set of values to the unit interval (simplex in more than one dimension) \(\sigma:\mathbb{R}^{K}\rightarrow[0,1]^{K}\) and is defined by:  
\[\sigma(\mathbf{z})_{i}=\frac{e^{z_{i}}}{\sum_{j=1}^{K}e^{z_{j}}}\quad\text{ for }i=1,\dots,K\text{ and }\mathbf{z}=(z_{1},\dots,z_{K})\in\mathbb{R}^{K},\]  
where \(z_{i}\) are the outputs of the layer preceding the _SoftMax_. Therefore, the _Angular MLP_ learns a set of multiplicative weights (this operation is represented by the \(\otimes\) symbol in Figure 4) that will be applied to the input reflectances in order to perform an angular correction. It is interesting to note that this angular correction takes into account the spectral information itself, that is, the reflectances and the angles are both used to estimate the correction. It is therefore a kind of self-attention mechanism [28]. A residual connection (a simple, elementwise addition, represented by \(\oplus\) in Figure 4) is used after the attention mask in order to keep spectral information that could be excessively removed by the attention mechanism before entering the _Backbone MLP_. The latter is used to embed the predictors into a feature space that will be used to feed the two modules used to estimate the target values and their uncertainties, respectively. The backbone part (a three-hidden-layer MLP with 10 neurons per layer) allows modeling of the correlation between the target variables and their uncertainties. The independent MLP branches (with the same architecture as the backbone) for \(\mu\) and \(\sigma\) get specialized into the estimation of each set of information. Performing the regression for several target variables with the same network is a kind of multitask learning that is able to leverage the correlation between target variables and is more efficient than preforming single target regressions. For numerical stability and positivity constraints, instead of estimating the \(\sigma\) or \(\sigma^{2}\), we estimate \(\log\sigma\). The output activation functions for the mean and the variance estimations are hyperbolic tangents so that the values are contained in the \([-1,1]\) interval. The output value  
Figure 4: Overview of the nonlinear regression of a set of spectral bands using other bands and angular information as predictors assuming a Gaussian error model. is then rescaled into a predefined interval, \([-0.2,1.3]\) for \(\mu\) and \([1\times 10^{-5},1.5]\) for \(\sigma^{2}\). The rescaling for \(\mu\) allows taking into account the fact that L2A reflectances can sometimes be negative due to over-correction. Reflectances can also be higher than one in specular conditions. The rescaling intervals could be learned from the data, but we set them for simplicity. The regression of several bands simultaneously is done by a straightforward extension of the single target case.