![]() |
Code Examples
A repository of 155 code examples for BeepBeep
|
Trend distance based on the average of values in a stream. More...
Static Public Member Functions | |
static void | main (String[] args) |
Trend distance based on the average of values in a stream.
In this example, we consider a stream of numerical values. The reference trend P
is a single number, representing an average. The TrendProcessor
emits an alarm when the difference between P
and the average of values over a sliding window of width 3 is greater than ½. Note that here, the distance is measured as the absolute difference between the reference average and the observed average. One can also compute the distance in terms of percentages; see AverageValueRelative.
The parameters of the TrendDistance
processor in this example are as follows:
Parameter | Value |
---|---|
![]() | 3 |
![]() | ![]() |
![]() | 6 |
![]() | ![]() |
![]() | ![]() |
![]() | ½ |
Consider for example the input stream that starts with:
6.1, 5.9, 6, 6.7, 6.7, 6.7, …
On the first window of width 3 (6.1, 5.9, 6), the average of the values is 6, and |6-6| ½. This average lies between 6-½ and 6+½ for windows 2 and 3 as well. On the 4th window of width 3 (6.7, 6.7, 6.7), the average is 6.7, and |6-6.7| > ½; this time, the TrendDistance
processor returns false.
Definition at line 91 of file AverageValueAbsolute.java.