Skip to main content
. Author manuscript; available in PMC: 2022 Aug 10.
Published in final edited form as: ACM BCB. 2022 Aug 7;2022:9. doi: 10.1145/3535508.3545541
Algorithm 1 Embedding-based K-nearest Neighborhood Sampling Contrastive Learning
Input:Longitutinal EHR featuresOutput:Pretrained systemm with parameters tuned1:Initialize system parametersθ2:foreach epochdo3:Foreachclassgroup(label1or0),Computesimilaritiesbetween all pairs of embedding feature representations basedon their inner product,and build KNN graph from it.4:whilenot convergeddo5:Sample a mini-batch training patientsPPall6:foreachpPdo7:Sample1positive"sample datapk+Pallthat havethe same label asp,and are connected to nodepin theKNN graph.8:endfor9:OptimizeLin equation310:endwhile11:endfor12:returnPre-trained deep learning system