Skip to main content
. 2025 Jul 30;25(15):4707. doi: 10.3390/s25154707
Algorithm 1 Health State Partitioning
1: Input: HI_sequence, M, εmax
2: Output: S (Final Segmentation)
3: Initialize:
4:    S=s1,s2,···,sN, where each si, is a data point from HI_sequence.
5:    Q = Priority Queue of pairs Csj,sj+1,sj,sj+1 for all adjacent pairs.
6:    Csj,sj+1= merge cost function sj,sj+1
7: Iterative Merging:
8: while  S>M and  maxεi>εmax do
9.          Cmin,sm,sm+1=Q
10:         sm=mergesm,sm+1 {Merge segments}
11:         Update Queue:
12:         Remove old pairs costs: Csm1,sm,Csm,sm+1,Csm+1,sm+2
13:         Insert new costs: Csm1,sm,Csm,sm+1
14: end while
15: Termination:
16: if  SM  or  maxεiεmax then
17:    Stop
18: end if
19: Output:S=s1,s2,···,sM.