Skip to main content
. Author manuscript; available in PMC: 2022 Jul 8.
Published in final edited form as: ACM Trans Comput Healthc. 2022 Apr 7;3(3):33. doi: 10.1145/3508020
ALGORITHM 1: Permutation-based Change Detection(X)
Input:X=time series dataOutput: VectorVof (distance, significance) pairsInitialize:n=7#window length in number of daysInitialize:i=1;j=i+nforeachpair of windows,Wi,WjXdoWi=X[i:i+n]Wj=X[j:j+n]k=0;N=1000C=KL_Divergence(Wi,Wj)V=vector of lengthNwhilek<NdoWi,Wj=Shuffle time intervals ofWiandWjC=KL_Divergence(Wi,Wj)V=append(V,C)k=k+1endwhilesig=BoxplotOutlierDetection(C,V)V=append(V,(C,sig))j=j+nendforreturnV