Input
The following diagram represents the input. The input signal is like a clock signal whose values can represent a cyclic recurrence of an event (for example, electric power consumption at certain periods or sequence, pulse rate, and so on).
cpt
sid |
id |
val |
1 |
1 |
10.8308 |
1 |
2 |
10.07182 |
1 |
3 |
10.30902 |
1 |
4 |
10.01128 |
1 |
5 |
10.83433 |
1 |
6 |
10.0189 |
1 |
7 |
10.8702 |
1 |
8 |
10.70688 |
1 |
9 |
10.72465 |
1 |
10 |
10.76334 |
1 |
11 |
100.9431 |
1 |
12 |
100.245 |
1 |
13 |
100.8667 |
1 |
14 |
100.0768 |
1 |
15 |
100.7646 |
1 |
16 |
100.0001 |
1 |
17 |
100.3316 |
1 |
18 |
100.8994 |
1 |
19 |
100.5965 |
1 |
20 |
100.1943 |
1 |
21 |
10.24228 |
1 |
22 |
10.78137 |
1 |
23 |
10.90752 |
1 |
24 |
10.02013 |
1 |
25 |
10.46117 |
1 |
26 |
10.08672 |
1 |
27 |
10.33539 |
1 |
28 |
10.0157 |
1 |
29 |
10.40867 |
1 |
30 |
10.17071 |
1 |
31 |
100.3789 |
1 |
32 |
100.2254 |
1 |
33 |
100.1049 |
1 |
34 |
100.9242 |
1 |
35 |
100.6543 |
1 |
36 |
100.5676 |
1 |
37 |
100.2341 |
1 |
38 |
100.9213 |
1 |
39 |
100.334 |
1 |
40 |
100.8727 |
SQL Call
SELECT * FROM ChangePointDetection (
ON cpt PARTITION BY sid ORDER BY id
USING
ValueColumn ('val')
Accumulate ('sid', 'id')
) AS dt ORDER BY sid, id;
Output
sid |
id |
cptid |
1 |
8 |
1 |
1 |
11 |
2 |
1 |
21 |
3 |
1 |
31 |
4 |
1 |
34 |
5 |