# Low-Cost COTS GNSS Interference Monitoring, Detection, and Classification System +
## 5 Algorithmic Design
### Post-Processing  
The post-processing component explores the robustness and indicates outliers in detection and classification. In general, our model outputs a prediction and its variance, i.e., the uncertainty, for every second over one minute. From there, a simple threshold-based decision method (on both the accuracy and the variance of all categories) selects the contextually correct interference class per minute and a naive moving average filter of ten time steps. It yields optimal results for detection (two categories) and classification (multiple categories). RF and ResNet provide mean values regarding the classification accuracy (\(F_{\beta=2}\)). However, to return the variance of these predictions, specific techniques are required, at least in the case of ResNet. A benefit of the RF is its ability to estimate the uncertainty for each prediction by utilizing out-of-bag (OOB) error estimates, i.e., RF implicitly returns a mean and a variance of its estimates as it incorporates the ensemble technique (forest of decision trees). Thus, the following techniques are employed to derive mean and variance from our ResNet model. In the post-processing step of the ResNet architecture, MCD is applied to the output layers to assess the uncertainty of each estimate. With sparse data or a complex network (with many parameters), the model can memorize the training data (so-called overfitting to the data) and, as a result, work great with the data it saw during training, but gives poor results for unknown data [102]. Dropout addresses these problems, as it is a well-understood regularization technique to prevent overfitting. Dropout turns off a different set of neurons (with a predefined number of neurons) at each training step. Hence, with dropout, any information can disappear anytime during training. Therefore, a neuron cannot rely on just a few inputs: it must distribute the weights and consider all inputs. As a result, it becomes less sensitive to input changes, leading to a better generalization of the model. In addition to regularization, dropout also provides a mean with an uncertainty estimate. As on each training iteration, dropout randomly selects the neurons to fail in each layer. According to the dropout rate of that layer, a different set of neurons is dropped each time. Thus, the architecture of the model is slightly different each time. Consequently, the result is an average ensemble of many different neural networks, each trained on just one batch of data. Hence, the results of the ML framework reflect the mean of an ensemble of the networks. From there, the variance (uncertainty) is derived if dropout is activated during interference. The MCD model estimation can be computed as the average of \(T\) predictions:  
Figure 13: Example tree of a trained RF model. Dependent on the properties of the current features, the RF model (at each block) makes a decision that is true (left arrow) or false (right arrow) until the leaf of the RF model is reached and a decision for classification is made. \[p =\frac{1}{T}\sum_{i=0}^{T}f_{nn}^{d_{i}}(x) \tag{9}\] \[c =\frac{1}{T}\sum_{i=0}^{T}\Bigl{[}f_{nn}^{d_{i}}(x)-p\Bigr{]}^{2} \tag{10}\]  
where \(p\) represents the posterior predictive mean of the model output for a given input \(x\). The equation computes the average of \(T\) forward passes through the model with dropout enabled, denoted as \(f_{nn}^{d_{i}}(x)\), where \(d_{i}\) is a dropout mask sampled from a Bernoulli distribution during each forward pass. By averaging the predictions across multiple dropout masks, the equation provides a more robust estimate of the model prediction. In the second equation, \(c\) represents the uncertainty of the model prediction for the same input \(x\). The equation computes the average of the squared differences between each individual prediction and the posterior predictive mean computed in the first equation. This represents the variance of the model predictions, which can be used as a measure of uncertainty.