# Adaptive Segmentation of Streaming Sensor Data on Edge Devices
## 4 Proposed Solution
### The Algorithm
\[\epsilon_{i_{k}}=\text{first }[\;e\;|\;e\;|\;e\;{\cal N}(\mu=0,\sigma=e_{i_{max} }/3),\;e<e_{i_{max}}\;] \tag{26}\]3 Auto-segmentation related limitations of the reference algorithm: approximation mean absolute error (Equation (28)) as a function of input stream length (\(n\)) for all test streams, (**a**–**d**) \(f_{1}\)–\(f_{4}\). For \(n>6\times 10^{4}\) one needs to specify the number of spline segments (knots) manually. \[\epsilon_{i_{k}}=\text{first }[\;e\;|\;e\;|\;e\;{\cal N}(\mu=0,\sigma=e_{i_{max} }/3),\;e<e_{i_{max}}\;] \tag{26}\]4 Approximation mean absolute error (Equation (28)) as a function of smooth.spline number of knots (segments) for all test streams, (**a**–**d**) \(f_{1}\)–\(f_{4}\) (in all cases: \(n=10^{6}\)). **Remark 5**: _In the evaluation process used, the number of knots for function smooth.spline was set to be the same as that found by the splinlet-based segmentation algorithm (which in all cases was more than \(4\times 10^{3}\))._

### Evaluation Results: Approximation Errors and Compression Ratio

Given a signal, the quality of its splinelet-based approximation--measured in terms of absolute and quadratic errors (see Section 5.1.2)--is the key performance indicator of the corresponding segmentation which, in turn, is strongly related to the signal compression ratio. The corresponding evaluation results are presented in Table 1 and in Figures 5 and 7. The values of error quotients QMAE and QRMSE (Table 1) show that the splinelet-based solutions, despite being completely local, in most cases are almost as good as their global (smoothing spline-based) correspondents. The same can be observed in Figures 6 and 7. They provide additional insight into the splinelet-based approximation. These supplement the integral measure view--given by error quotients--with error distributions. Almost identical shapes of density lines corresponding to the two compared solutions confirm the high quality of splinelet-based solution. In this context, the values of compression ratios, \(CR(s,t)\), given in Table 1 can be considered high (from 135 to 208, meaning that the compressed stream sizes are



### Evaluation Results: Segment Length Auto-Adaptation

Since the spline segment length auto-adaptation mechanism determines the search space at each segmentation step, it has significant impact on the algorithm's overall performance. Not only does this refer to the approximation quality (discussed in Section 5.2), but also--probably even more importantly--to the algorithm's stability, which becomes essential in the context of the \(C^{2}\)-continuous streaming approximation. Figure 8 shows concisely the spline segment auto-adaptation related results in the form of a segment length distribution for each tested data stream. We can see that:

* in all cases the dominating segment lengths (remember that the test streams differ only in their signal-to-noise ratios--see Equations (23) and (26)) belong to the interval \([5,10]\),
* the lower the noise level, the more distinct the three existing maxima of the density function become (they correspond to the main \"building blocks\" used by the segmentation algorithm to restore the true signal, which is periodic),
* the higher the noise level, the closer to uniform the segment length distribution becomes, and the longer the segments are (because of a higher error tolerance). **Remark 6**. : _Although simple (see Equation (15)), the segment length auto-adaptation mechanism proved effective._

\[\epsilon_{i_{k}}=\text{first }[\;e\;|\;e\;|\;e\;{\cal N}(\mu=0,\sigma=e_{i_{max} }/3),\;e<e_{i_{max}}\;] \tag{26}\]5 As in Figure 6, but for the _squared_ approximation errors, \(\text{SQE}\). (**a–d**) \(f_{1}\)–\(f_{4}\). ## 6 Conclusions

It has been shown that the \(C^{2}\)-continuous cubic splinelet-based adaptive segmentation of streaming data--despite its local/online character--is not only possible but also can be effective.