Skip to main content
. 2025 Nov 29;25(23):7285. doi: 10.3390/s25237285
Algorithm 1. EM Clustering.
1:  Input: Dataset X, stop_rule
2:  Initialize: 
3:    λ1 ← first quartile of X
4:    λ2 ← third quartile of X
5:          π  ← 0.5                                  # mixing proportion for cluster 1 
6:  Repeat until stop_rule:        
7:    For each i:                            # E-step
8:      Calculate Ii 
9:      γi,1=1/Ii
10:    γi,2=1γi,1     
11:       Update π                                 # M-step
12:       Update λ1,λ2
13:       Prepare for convergence check
14:  Check stop_rule
20:  Return π,λ1,λ2,γi1,γi2          # Output