## 3 Algorithms for Validation and Ranking
### Slope-Based Curve Signature  
As mentioned in the motivation, one challenge to be solved algorithmically is to provide support for validating the screening measurements. To be as efficient as possible, without having detailed knowledge about the behavior of the sensor itself, the fastest way is to search for similar curves to a given reference time series. Since the proposed signature is based on the curve's slope, the algorithm works on the first derivative of the Savitzky-Golay [15] filtered measurement time series. It assigns each measurement a sequence comprised of the symbols \(\boldsymbol{+},\boldsymbol{-}\) and \(\boldsymbol{\cdot}\), representing its slope characteristic. In preparation for the signature, a threshold \(t\) for the measurement's noise is needed. It is calculated using the residual standard deviation \(s\) of the baseline's last 200 s before analyte exposure and multiplying it with a customizable tolerance factor \(\tau_{\text{v}}\) according to:  
\[t=s(\mathbf{x},\hat{\mathbf{x}})\cdot\tau_{\text{v}}\text{, with }\mathbf{x}=\hat{\mathbf{m}}_{\text{b}}\langle|\hat{ \mathbf{m}}_{\text{b}}|,199\rangle \tag{3}\]  
Each sample from the first derivative is then assigned a symbol as follows:  
\[\text{sgn}(\mathbf{m},i)= \begin{cases}\boldsymbol{+}&\text{if }\hat{\mathbf{m}}_{ \text{a}}[i]>t,\\ \boldsymbol{-}&\text{if }\hat{\mathbf{m}}_{\text{a}}[i]<-t,\\ \boldsymbol{\cdot}&\text{else}\end{cases}  \tag{4}\]  
If the absolute value of \(\hat{\mathbf{m}}_{\text{a}}[i]\) is smaller than the noise threshold \(t\), it is assigned the \(\boldsymbol{\cdot}\) sign, indicating that the slope is caused by noise. Else the sgn function values are coded as either \(\boldsymbol{+}\) or \(\boldsymbol{-}\). The values assigned with the \(\boldsymbol{\cdot}\) symbol are not important to the signature itself, but are needed for correct hysteresis filtering. The resulting symbols from the sgn function are concatenated into a sequence, resulting in the measurement slope signature. The final signature is created, hysteresis filtered and simplified as follows:  
* Build sig by concatenating results of \(\text{sgn}(\mathbf{m},i)\) for each sample. * Delete all leading \(\boldsymbol{\cdot}\) from sig
* Replace each remaining \(\boldsymbol{\cdot}\) with the immediately preceding \(\boldsymbol{+}\) or \(\boldsymbol{-}\) symbol
* Delete all symbols that are not part of an at least \(\omega_{\text{s}}\) long sub-string of the same symbol
* Reduce all identical consecutive occurrences of the same symbol to one occurrence  
Following is a non-exhaustive list of well-known curve similarity measures that can be extended by the proposed signature. * Area Method [16]
* Discrete Frechet Distance [17] \begin{table}
\begin{tabular}{l l} \hline \hline
**Notation** & **Meaning** \\ \hline \(\mathbf{x}\) & Vector. \\ \(|\mathbf{x}|\) & Amount of elements in Vector \(\mathbf{x}\) \\ \(\mathbf{x}[i]\) & Element with index \(i\). \\ \(\mathbf{x}\langle i,w\rangle\) & Vector defined by window of size \(w\) around index \(i\) \\ \(\mathbf{x}^{\prime}\) & Min-max normalized vector elements \\ \(\hat{\mathbf{x}}\) & First derivative \\ \(\hat{\mathbf{x}}\) & Arithmetic mean of all vector elements \\ \(\hat{\mathbf{x}}\) & Savitzky Golay [15] filtered vector elements \\ \(\hat{\mathbf{x}}\) & Linear regression model, based on index and elements of \(\mathbf{x}\) \\ \(s(\mathbf{x},\mathbf{r})\) & Residual standard deviation \\ \hline \(\mathbf{m}\) & Complete measurement with all segments \\ \(\mathbf{m}_{\text{a}},\mathbf{m}_{\text{b}},\mathbf{m}_{\text{c}}\) & Analyte, baseline and clearing segment \\ \(M\) & Set of all measurements of a sensor screening \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Summary of notation conventions for this work. Partial Curve Mapping (PCM) [17]  
We decided to use a simple difference-based approach for our application example, since it is fast and sufficient.