Skip to main content
. 2022 Jan 27;22(3):992. doi: 10.3390/s22030992
Algorithm 1: Baseline detection considering both activity sequence and activity length
Inputs:MM—transition probability matrix, PS—set holding each activity probability to be the first one of the day, PE—set holding each activity probability to be the last one of the day, EP—end probability weight, LM—length median, LDMax—length probability weight, P—the transition probability from an activity Ai to an activity Aj;
Outputs: B—activity sequence representing the baseline.
Begin
1      B [];
3      lastVal  max(PS);
4      lastActivity label(lastVal);
4      prevVal  null, prevActivity null;
5      LD  LDMax
6      while   Ai such MM[lastActivity, Ai]>PE[lastActivity]×EP LD do
7      append(B, lastActivity);
8      prevVal  lastVal;
9      prevActivity lastActivity;
10     LD  interpolate(len(B), [0, LM],[LDMax, 0]);
11     lastVal PE[prevActivity]×EPLD;
12     foreach Ai do
13     P  MM[prevActivity, Ai]
14     if lastVal<prevVal×P then
15     lastVal  prevVal×TP;
16     lastActivity  Ai
17     end
18     end
19     end
20     return B
End