Manuscript Offprint
arXiv:2610.06355Latent Similarity Gaussian Processes: A Theory-Grounded Approach to Personalized Suicide-Risk Forecasting for Clinical Decision-Support
Yaniv Yacoby
Wellesley College
Weiwei Pan
Harvard University
Hope Neveux
Harvard University
Taylor C. McGuire
Harvard University
Franchesca Castro-Ramirez
Harvard University
Anushka R. Patel
Harvard Medical School
Massachusetts General Hospital
Matthew K. Nock
Harvard University
Abstract
Forecasting suicide risk is difficult due to the high heterogeneity of patients and the low base rate of suicide-related events (SREs). We present Latent Similarity Gaussian Processes (LSGPs), which embed patients in a continuous latent space to jointly model similarity and forecast risk. By selectively drawing information from latent peers, LSGPs better capture individualized risk trajectories, generalizing nomothetic (pooled), idiographic (per-patient), and hierarchical frameworks. Our contributions are: (1) an identifiable two-channel Similarity Kernel; (2) proof that the standard model-fitting algorithm, mean-field variational inference, collapses LSGPs to nomothetic models, along with a fix; and (3) empirical results on intensive longitudinal suicide data showing LSGPs outperform nomothetic, idiographic, and hierarchical models for next-week risk forecasting, with the largest gains in forecasting first-occurrence SREs.
1 INTRODUCTION
Machine Learning (ML) systems for suicide-risk forecasting face dual demands: providing accurate forecasts and actionable insights to clinicians. Existing approaches largely fall between two extremes: nomothetic (population-level/pooled) and idiographic (per-patient/individualized) models [e.g., 76, 58]. Hierarchical (mixed-effects) models bridge these extremes by decomposing forecasts into a shared population trend (fixed effects) and patient-specific deviations (random effects). All three model classes make implicit assumptions about the data that limit their clinical utility.
Nomothetic models assume that factors relevant to suicide risk are either observed or safely ignorable. By sharing a single global trend across all patients, nomothetic models treat any unobserved, patient-specific variation as uncorrelated noise. Their use therefore implicitly assumes that every meaningful driver of suicide risk has been observed; however, in clinical reality, pathways to suicide are heterogeneous [74, 16, 36], shaped by patient-specific contexts that may be absent from, incompletely recorded in, or difficult to extract from standard study instruments and health records [48]. For example, important determinants of near-term risk include acute stressors [26], trauma-related responses [43, 35], interpersonal dynamics [34, 56], and changes in social circumstances [42, 49, 68]. When an individual's baseline risk depends on unobserved factors, a single global trend may fail to alert clinicians in time to act.
Idiographic models assume no commonalities in pathways to suicide. Idiographic approaches model each patient independently; in doing so, they discard shared, population-level dynamics. For example, sleep disturbance [8, 28], hopelessness [77, 62], and prior suicide attempts [13, 61] are all known to increase suicide risk. And because suicide attempts occur with a low base rate, idiographic models are prone to overfitting [27], especially during early monitoring when data is sparse and when insights are most needed.
Hierarchical models assume patients represent
We adopt the standard clinical psychology terms “nomothetic” and “idiographic” to ground our framework in clinical practice and unify overlapping ML terminology.
deviations from a single norm. While hierarchical models bridge nomothetic and idiographic extremes, they assume patient trends are random deviations from a single global trend. In reality, patients inhabit a continuous spectrum of dynamic subtypes, governed by distinct, potentially conflicting trends [27]. Under sparse event histories—typical in suicide-risk monitoring—this assumption forces risk estimates for patients with no prior attempts to default to the global population trend, which may represent them poorly. This failure is clinically critical, as a substantial proportion of suicide fatalities occur on the first attempt [33].
Modeling patient similarity addresses these shortcomings and may support clinical decision-making and treatment planning. Explicitly modeling latent patient similarity overcomes key limitations of existing approaches by enabling cross-patient information sharing: when a patient's data is limited, the model leverages patterns from similar patients to forecast their future risk. Beyond predictive gains, similarity also offers a foundation for clinician-AI collaboration by supporting case-based reasoning [65]. Prior work demonstrates substantial heterogeneity in how at-risk patients respond to treatments, even in major interventions like psychiatric hospitalization [63]. Consequently, two patients with the same risk score may benefit from entirely different interventions—such as safety planning [69], lethal-means counseling [51], or family engagement [3]. By learning patient similarity, we can expose historical precedents that allow clinicians to evaluate which interventions succeeded for similar patients and why, assess whether off-survey context renders these precedents relevant, and adapt care accordingly, narrowing a vast, heterogeneous space of clinical actions down to a few targeted choices.
Contributions. Translating this clinical vision into practice requires a model that meets three demands: (1) predictive power via accurate individualized forecasts, (2) a mathematically well-posed mechanism for learning patient similarity, and (3) scalable inference whose objective does not itself bias the model toward purely nomothetic/idiographic regimes. We meet these demands as follows:
(A) Model Class: Latent Similarity Gaussian Processes (LSGPs). LSGPs generalize nomothetic, idiographic, and hierarchical models (Apx. B) by allowing each patient's forecast to be informed by others in direct proportion to their learned dynamic similarity. Formally, LSGPs are built as Latent Variable Multi-Output Gaussian Processes (LVMOGPs [18]), equipped with a family of Similarity Kernels with two channels: trend and relative-amplitude similarities. We prove these channels are identifiable: distinct parameterizations of a Similarity Kernel producing the same overall kernel function decompose into identical channels, ensuring that clinical interpretations are invariant to model parameterization.
(B) Theoretical Analysis of Personalization Collapse in the Standard Model-Fitting Algorithm—Mean-Field Variational Inference (MFVI)—and a Scalable Fix. We prove that the standard method for fitting LSGPs at scale (MFVI) can induce personalization collapse: even when the model is sufficiently flexible to capture patient heterogeneity, MFVI penalizes non-nomothetic models. We characterize the gap between the mean-field and structured bounds as a Bregman information that vanishes only at a fully nomothetic model. To avoid this collapse without sacrificing scalability, we adapt the Pólya-Gamma-augmented scheme [59, 78] that restores conditional Gaussian conjugacy between local and global variables, preserving the coupling MFVI discards while keeping coordinate-ascent updates tractable.
(C) Application to Data from an Intensive Longitudinal Suicide-Risk Study. We evaluate the LSGP on intensive Ecological Momentary Assessment (EMA) data tracking daily affect and suicidal thoughts with the goal of predicting next-week suicide-related events (SREs)—self-injurious behavior performed with non-zero intent to die or a psychiatric hospital presentation intended to avert a suicide attempt [54]. LSGPs outperform nomothetic, idiographic, and hierarchical baselines in within-patient forecasting, measured by per-patient average precision. Their largest gains occur on patients with no SREs in the training set who experience an SRE in the test set. Where idiographic models fail due to sparse positive labels, nomothetic models blur individual dynamics into a cohort average, and hierarchical models collapse directly back to that single global norm, the LSGP selectively informs forecasts by drawing on patients with similar risk trajectories. Further, we find that the learned similarity channels are not explained by static demographics alone, suggesting that the model isolates novel temporal patterns—a starting point for future clinical validation.
Impact Relative to Related Work. This work contributes to three areas (expanded in Apx. A): (i) Machine Learning: Scalable GPLVM-family models [e.g., 72, 50, 18] typically rely on MFVI [e.g., 30, 44]. While MFVI pathologies are known in other models [e.g., 73, 23, 79, 15, 80], we uncover and formalize a new failure mode where MFVI penalizes LSGPs toward the nomothetic extreme. (ii) Suicide Prevention: EMA studies primarily predict suicidal thoughts rather than SREs [e.g., 40, 17, 46, 76], which are rarer and harder to forecast. We show that the LSGP improves per-patient SRE forecasts—particularly for first-time SREs—by ensuring the learned patient similarity reflects gen-uine data-driven trends rather than inference artifacts. (iii) Implementation Science: Unlike existing clinical retrieval tools that compare patients based on static feature snapshots or latent embeddings [e.g., 65, 55], LSGPs learn similarity directly in function space—matching patients by how their survey responses map to suicide risk. By surfacing historical precedents that share true underlying dynamics rather than feature overlap, LSGPs provide a foundation for future decision-support systems that enable clinicians to synthesize their own contextual knowledge with the model's forecasts via case-based reasoning.
Notation. Let and be the number of patients and surveys, respectively. Let be the -th survey for patient at time , comprising 0–10 Likert items (affect, suicidal intent/urges, etc.) and survey metadata (e.g., response latency; see Apx. F.2). We predict a binary label indicating whether patient experienced an SRE within 7 days post-. The full dataset is , with patient-specific subsets varying in size due to differing response rates.
Goal. Given D, as well as a new survey , we want to predict whether patient n will experience an SRE, , during the week that follows.
Model. Patient heterogeneity naturally motivates the following model:
Here, appends patient 's latent code to the survey vector , which stacks row-wise into a design matrix. The kernel operates on these augmented inputs with hyperparameters . The vector collects latent function values across all observations, and is the -dimensional identity matrix. The mean function applies a code-independent transformation to input features . Because SREs are low-prevalence outcomes, we set , where is a learned scalar initialized to the logit of the empirical training prevalence.
The Similarity Kernel. To ensure similarity between patients is well-posed, we constrain the kernel:
Definition 1. A kernel on augmented inputs and is a Similarity Kernel if it factorizes as follows:
wherein:
(a) is not the degenerate 0 kernel.
(b) is continuous.
(c)
Within ,
(i) The correlation, , is continuous, positive-definite, and peaked at the origin: , and for .
(ii) The importances, , are non-negative.
(iii) The warp, , is continuous, injective, and order-preserving: coordinatewise implies coordinatewise.
In Apx. C.1, we show that this framework encompasses the standard stationary kernels and describe new extensions. By constraining the patient-code kernel to a unit-diagonal correlation matrix scaled by a learned amplitude [cf. 29], the LSGP adapts standard multi-output GP formulations [e.g., 10, 18] to decompose the coregionalization matrix [1] into two identifiable channels: trend and amplitude similarity (Prop. 1).
Quantifying Patient Similarity. Evaluated at the patients' codes, Similarity Kernels decompose patient similarity into two channels, a trend channel and an amplitude channel,
both with entries and with unit diagonal. We evaluate these matrices at the posterior mode, . To facilitate empirical evaluation, we also define their product, , representing one natural combination of the two.
The LSGP dynamically bridges idiographic and nomothetic regimes. Regime 1: Fully Nomothetic . Here, , reducing Eq. 5 to , resulting in a nomothetic GP. Regime 2: Fully Disjoint . Off-diagonal trend terms decay to zero , yielding a block-diagonal kernel corresponding to N independent, idiographic GPs. Regime 3: Adaptive Interpolation . The model dynamically shares statistical patterns across patients based on inferred similarity, learning the optimal degree of inter-patient sharing through S.
Identifiability of Similarity. Without an identifiable kernel decomposition, scale and similarity parameters trade off arbitrarily, allowing high-amplitude patients to appear deceptively similar to the entire cohort. As formalized in Prop. 1, our kernel structure eliminates this ambiguity: while the overall covariance admits an unavoidable global scale factor, both and are strictly invariant, ensuring that inferred patient relationships represent stable structural properties of the data rather than parameterization artifacts.
Proposition 1 (Proof in Apx. C.2). Let and be Similarity Kernels (Def. 1). Then if and only if there is a scalar such that, as functions,
As a result, when , we have and , whatever parameters or functional forms produced them.
3 APPROXIMATE INFERENCE
Sparse Variational LSGPs (SV-LSGP). Exact LSGP posterior inference is intractable due to the non-conjugate likelihood and non-linear latent variable transformations. Prior work addresses this via a sparse variational approximation [71, 30, 31], as applied to LVMOGPs [18, 27], conditioning on a small set of inducing point locations, , used to “summarize” the training inputs, replacing with:
Here . and are then typically learned with MFVI, i.e., with the variational family [e.g., 30, 44] (details in Apx. D.1).
Pitfalls of MFVI. While computationally convenient, MFVI can be biased when local latent variables and global parameters share dependencies. In Bayesian Neural Networks with Latent Variables [19]—which share the LSGP's structure (local latent variables and global parameters)—the posterior mode is asymptotically biased, leading MFVI to underfit and miscalibrate uncertainty [80]. We therefore adapt the Pólya-Gamma augmentation scheme [59, 78] to the LSGP. This restores conditional Gaussian conjugacy for U, yielding a structured variational family via closed-form coordinate-ascent updates, similar to structured stochastic variational inference for conditionally conjugate models [32], enabling the theoretical comparison of our inference method to MFVI (Sec. 4).
Pólya-Gamma LSGP (PG-LSGP). We write the likelihood as an expectation over an auxiliary variable [59],
(7)
Like Wenzel et al. [78], we introduce per observation and apply Jensen's inequality to obtain a variational bound,
(8)
where is under the variational joint (derivation in Apx. D.2).
Variational Expectation-Maximization (VEM). For the PG-LSGP, coordinate-ascent updates over the conjugate variational factors admit exact closed forms:
Step 1 (E-step, auxiliary update). Update the local Pólya-Gamma factors at the previous sweep's :
Step 2 (E-step, inducing-posterior update). Update the global inducing-value factor, conditioned on Z:
The moments for Steps 1 and 2 are calculated via:
where is the marginal left by integrating out of .
Step 3 (M-step). Update parameters via a stochastic gradient step, evaluated at the converged variational distribution :
(11) where is a Monte Carlo gradient estimator under reparameterized samples [39].
Training Scheme. For each outer VEM step, Steps 1 and 2 are repeated for sweeps to achieve conditional convergence. With mini-batching and at unit step size, those conjugate updates are exactly natural-gradient steps [78]; Step 3 then performs a single, plain gradient M-step. Details in Apx. D.
Variational Family. Because and have closed-form solutions, we only need to parameterize . We set it to a diagonal Gaussian with moments amortized via a shared encoder, . To accommodate variable-length, unordered datasets , we parameterize as a DeepSet [82], embedding each point , mean-pooling the embeddings, and decoding the aggregated vector. This guarantees permutation invariance by construction and mirrors conditional neural processes with patients as tasks and their surveys as context sets [24].
4 PERSONALIZATION COLLAPSE
We now show that the commonly used factorization in MFVI [e.g., 30, 44] introduces a structural bias into the LSGP: it adds a penalty to the objective that vanishes only at a nomothetic model—that is, only at . We call this pathology personalization collapse.
Characterizing the Coupling Gap. To quantify the cost of discarding the code-dependent posterior , we formulate the variational gap as a Bregman information over natural parameters.
Definition 2 ([12]). For a strictly convex, differentiable on a convex domain, the Bregman divergence it generates is , with equality if and only if .
Definition 3 ([5]). For valued in the domain of (Def. 2), the Bregman information of is the least expected divergence to a single representative, , attained at the mean [4] and vanishing if and only if is -a.s. constant.
Let denote the log-partition function of an -dimensional multivariate Gaussian. From Eq. 10, the exact conditional variational posterior can be written in natural coordinates as .
Theorem 1 (Proof in Apx. E.1). Suppose:
(i) The auxiliary factor and the code posterior are held fixed, so that the two maxima differ only in the U-factor;
(ii) and ;
(iii) And and can attain their optima in Eq. 12 (automatic for full-covariance Gaussians).
Then:
(a) The coupling gap is the Bregman information of under A:
(12)
(b) And GAP = 0 if and only if is -a.s. constant.
Thus, the optimal MFVI objective is the structured objective, penalized by GAP: at every ,
This exposes a fundamental tension in factorized inference: the structured objective rewards the code-dependence needed to express the data, while penalizes it. Next, we prove that driving results in a fully nomothetic model.
Driving GAP→0 Erases Patient Heterogeneity. Split each inducing location into input and latent blocks, , so and are the two halves of inducing point 's location.
Theorem 2 (Proof in Apx. E.2). Call an inducing point “live” if for some . Suppose the assumptions of Thm. 1 hold, and:
(i) W is fixed, and is nonsingular (as the definition of presupposes);
(ii) has full support on ;
(iii) The auxiliary factor is held fixed at a code-independent , as in the fully factorized posterior , so its Pólya-Gamma means form a constant diagonal ;
(iv) is a Similarity Kernel (Def. 1); and
(v) For each there are live inducing points with .
Then:
(a) GAP = 0 if and only if S = 0 and is constant.
(b) And whenever GAP = 0, both similarity channels collapse to all-ones, , at any codes, including the inferred posterior mode.
Enriching Alone Cannot Prevent Personalization Collapse. Because the gap arises from enforcing conditional independence between U and Z, Thm. 2 holds for any non-degenerate, full-support , including the exact posterior .

Figure 1: Structured Outperforms Factorized PG-LSGP by Learning Patient Similarity. Top row: structured. Bottom row: factorized. MODS is the mean off-diagonal similarity (Eq. 118); cells labeled PC denote personalization collapse (MODS( ) = 1.00 to two decimals); cells labeled Undefined represent rank correlations that are undefined because the learned similarity matrix is constant off the diagonal. Recovery is the Spearman rank correlation between the learned and true similarity. Details in Sec. 5 and Apx. F.
The Trade-Off Between Data Fit and GAP. We conjecture that when the data carries little predictive signal—e.g. when a cohort is small or its decision boundary is diffuse—the ELBO can be maximized by collapsing personalization ( , ), setting GAP = 0 at the cost of erasing patient dynamics. We demonstrate this empirically in Sec. 5.
5 RESULTS: SYNTHETIC DATA
So far, we showed that the similarity an LSGP recovers is identifiable (Prop. 1) and that the factorized variational family carries a penalty that vanishes only when that similarity collapses (Thms. 1 and 2). We now show that, on synthetic data with known ground truth, we do indeed recover the true similarity.
Note that we prove Thm. 2 for a code-independent auxiliary (assumption (iii)) and a fixed (assumption (i)); in the empirical analysis, we relax both assumptions—using the code-conditional (derivation in Apx. D.5) and freely learned inducing points—and still observe personalization collapse.
Setup. We evaluate 36 synthetic cohorts from the “Hemisphere” process (Apx. F.1), where unique patient classification boundaries are sampled on a 1D manifold. The cohorts consist of six cohort sizes ranging from N = 10 to 200, crossed with six levels of steepness of the decision surface around the decision boundary ( to 16), called “boundary sharpness.” This evaluates the performance of methods across different amounts of predictive signal in the data. Across 3 random restarts per cohort, we fit PG-LSGPs with vs. , selecting the best of each across the restarts via validation log-likelihood (LL). We report Mean Off-Diagonal Similarity of , MODS( ), to assess collapse, ground-truth similarity recovery via the Spearman rank correlation between the learned and true similarity, and held-out LL and per-patient Average Precision (AP). Details in Apx. F.
Result 5.1: Under Low Signal, the Structured Model Becomes Nomothetic. First, Fig. 1 confirms our conjecture (Sec. 4): when the likelihood provides minimal signal (e.g., small cohorts or diffuse decision boundaries), structured and factorized bounds perform comparably; both reduce to the nomothetic model. This adaptive behavior is desirable, as pooling data across patients is optimal under weak signal.
Result 5.2: Structured PG-LSGP Outperforms the Factorized Baseline by Learning Patient Similarity as Signal Strengthens. As shown in Fig. 1, as the signal strengthens (higher N and/or ), the structured PG-LSGP quickly prevents personalization collapse, better recovers ground-truth patient similarity, and achieves better per-patient AP and LL.
6 RESULTS: REAL DATA
We now apply the LSGP to EMA data that tracks suicidal thoughts and behaviors. We confirm that the LSGP is able to combine nomothetic trends with id-

Reference (PG-LSGP - ...)
○ Idiographic Base-Rate
○ Nomothetic Base-Rate
▼ Best Idiographic Baseline
▲ Best Nomothetic Baseline
◆ LSGP Ablation ( )
- Best Hierarchical Baseline
■ Better than PG-LSGP
Worse than PG-LSGP
Figure 2: Paired per-patient comparison: PG-LSGP outperforms baselines on per-patient AP. Markers denote mean patient-level differences (LSGP minus reference); bars denote and paired standard errors, for n patients. Pooled AP (non-decomposable) is shown without bars, while the MODS panel confirms the LSGP avoids collapse across all h. The LSGP gains concentrate in test-only event cases (top-right panel).
iographic dynamics, leading to improved per-patient forecasting performance by inferring similarities.
Setup. We evaluate on EMA data (N = 497 patients, 76,798 surveys; 3-month, 6-times-daily protocol), retaining all patients (81.7% SRE-free) to mirror clinical deployment. Timelines are split across per-patient training fractions , with the remainder divided equally into validation and test windows. Performance is evaluated primarily via per-patient AP (justification in Result 6.1), alongside pooled AP, log-likelihood (LL), and MODS( ). We selected all hyperparameters via validation per-patient AP, using validation LL to select intra-model restarts (5 per variant) to assess convergence (Apx. F.2). Baselines include idiographic linear variants (logistic regression, variational Bayes, empirical Bayes), nomothetic linear/non-linear baselines (gradient-boosted trees, random forests), hierarchical (mixed-effects) logistic regression with random intercepts and/or slopes, base-rate predictors, and a similarity-ablated LSGP ( ). Details in Apx. F.
Result 6.1: LL Fails to Select Models Capable of Forecasting Within-Patient Risk. As shown in Fig. 2, the Nomothetic Base-Rate baseline—which outputs a constant prediction equal to the training prevalence—is among the highest performers on pooled and per-patient LL across all h; however, it performs poorly on all remaining metrics because a constant predictor cannot capture individualized risk. Under severe class imbalance (96% event-free surveys), LL prioritizes static base-rate calibration over learning dynamic, within-patient risk trajectories. These observations are consistent with existing work that identifies shortcomings of LL for task-specific model selection [81, 20]. We therefore use validation per-patient AP for model selection, which remains robust under extreme class imbalance and avoids disproportionately weighting individuals with higher survey volume. We still use validation pooled LL to select among random restarts within each model, since LL confirms inference successfully converged according to our modeling assumptions—a necessary check until future work establishes better model selection metrics for this regime (see Sec. 7).
Result 6.2: LSGP Improves Within-Patient Risk Forecasting. Fig. 2 shows that the LSGP outperforms all baselines in overall per-patient AP across every h. Comparing the LSGP to its similarity-ablated variant ( ) isolates the performance benefit of learning patient similarity: the gain is on the “SRE in Test Only” subgroup—patients without training-period SREs who experience test-period events. On these patients, idiographic models collapse to the chance-level floor due to a lack of positive training signals, while nomothetic models ignore individual trajectories.
Result 6.3: Global vs. Per-Patient Forecasting

Figure 3: Learned combined similarity ( ) for patients with an SRE anywhere in their record. Each panel shows the variant with the highest validation per-patient AP, at the restart selected on validation LL, for its h. Patients are ordered by the first principal component of their inferred latent codes , with annotation strips displaying demographic categories, total survey counts, and numbers of SRE episodes. Full cohort in Fig. 6.
Trade-Offs. We hypothesize the trade-off between pooled and per-patient AP stems from our LSGP mean function, which lacks a patient-specific base rate. In future extensions, we hope to introduce a personalized prior mean and incorporate baseline prevalence into the kernel as another similarity channel, carefully adapted to maintain our identifiability guarantees.
Result 6.4: Recovering Uncollapsed Patient Similarity. Inspecting across the full cohort (Fig. 6) and the subset of patients with at least one SRE (Fig. 3) reveals two distinct groups: those with and those without training-window SREs. This is expected: without positive training labels to delineate individual decision boundaries, unobserved risk profiles remain less differentiated. Crucially, however, the LSGP identifies similarities between some patients with and without training-window SREs—leveraging this similarity to improve forecasts for individuals whose first SRE occurs in the test window. Ultimately, the learned similarity captures nuanced risk heterogeneity and may be clinically useful beyond predictive gains.
Result 6.5: Learned Similarity Is Not Explained by Demographics, Event Rate, or Survey Volume. In Fig. 3, patients are sorted by inferred latent codes alongside demographic annotations and survey counts. Visual inspection shows no demographic clustering. Following Hang et al. [27], we formalize this by treating the off-diagonal similarity as a weighted graph (Fig. 7) and measuring its weighted modularity [53] against a label-permutation null distribution. We find no statistical evidence of demographic structuring. The learned similarity is not driven by demographics, event frequencies (where the idiographic base-rate baseline trails the LSGP across all ; Fig. 2), or survey completion volume. Thus, the latent space encodes within-patient dynamics.
7 LIMITATIONS & FUTURE WORK
We set out to develop a model class extending established frameworks in clinical psychology that satisfies three core requirements: (i) accurate short-term forecasting, (ii) an explicit and interpretable formulation of patient similarity, and (iii) an inference scheme whose objective does not itself bias that similarity toward collapse. The LSGP meets these requirements: its within-patient forecasts improve over all baselines, with the largest gains in patients with no training-window SREs who go on to experience an SRE in the test window. And it does this by inferring patient similarity, exposing relevant historical precedents that may prompt clinicians to investigate unmeasured contextual factors driving risk. Still, several open problems remain.
Training Objectives & Metrics. Because LL fails to differentiate uninformative base-rate models from predictive models on the EMA data, we question its suitability for model selection and its impact on Bayesian inference. In future work, we plan to investigate alternative training objectives and selection criteria that optimize PAC-Bayes generalization bounds [e.g., 25, 60] rather than relying on marginal likelihoods.
Clinical Grounding Beyond Demographics.
While static demographic traits do not account for the learned similarity structure, the latent geometry likely captures underlying, unobserved clinical dynamics. In future work, we hope to validate the learned similarities against richer clinical variables to assess whether they correspond to actionable clinical phenotypes that can support clinical decision-making.
Accounting for Temporal Dynamics. The current LSGP evaluates risk cross-sectionally via latent codes , omitting temporal dependencies such as survey autocorrelation. Because psychiatric risk is inherently dynamic, future extensions should explicitly incorporate temporal dynamics across observation timestamps.
Acknowledgments
Research reported in this publication was supported by the National Institute of Mental Health (NIMH) of the National Institutes of Health (NIH) under Award Numbers R01MH139486, U01MH116928, P50MH132766, and K23MH135211. The content is solely the responsibility of the authors and does not necessarily represent the official views of the National Institutes of Health. The authors are also grateful for funding from the Tommy Fuss Collaborative STAR Fund, the Chet and Will Griswold Suicide Prevention Fund, and a gift from an anonymous donor.
AI use statement
Approach. We approached AI use in this project as an informal, first-person human-computer interaction experiment, treating our own experiences as a subject of inquiry. We carefully observed how interacting with AI affected our cognitive processes, using these observations to form, test, and refine hypotheses about when AI enhanced versus eroded our productivity, creativity, and sense of meaning in our work. We hope that this reflective approach can generate insights (useful for ourselves, and maybe later for others too) in deciding how, when, and why to use AI in research.
AI Use. In this work, we used generative AI to assist with software development, writing, and preliminary mathematical derivations under strict oversight:
• Implementation and Analysis. We wrote and verified the core model implementations ourselves, and used AI to check them against the relevant papers. We used AI to help refactor and write the generic experimental pipeline (synthetic data generators, hyperparameter grid search, evaluation pipelines, unit tests, and figure generation) and to run diagnostic checks on experimental outputs, which helped us identify and correct reporting bugs.
• Manuscript and Literature. We used AI to generate initial draft text from a detailed, granular outline that we wrote; we scrapped or heavily edited nearly all of it. We also used AI to polish prose and to verify related-work coverage. We authored the core arguments, narrative flow, and conceptual structure entirely ourselves.
• Theory. We used AI for initial proof sketching. Because the AI-generated derivations contained errors or were incomplete, we subsequently rewrote, finished, and verified all proofs ourselves.
• Verification and Accountability. We audited all AI-assisted text, claims, and code against our experimental logs. We computed every numerical result reported in this manuscript directly from raw experimental artifacts, not from AI-generated text and not from AI syntheses of the raw results.
We take full responsibility for the integrity, accuracy, and content of this manuscript.
References
[1] Mauricio A Alvarez, Lorenzo Rosasco, and Neil D Lawrence. Kernels for vector-valued functions: A review. Foundations and Trends® in Machine Learning, 4(3):195–266, 2012.
[2] Norman P Archer and Shouhong Wang. Application of the back propagation neural network algorithm with monotonicity constraints for two-group classification problems. Decision Sciences, 24(1):60–75, 1993.
[3] Joan Rosenbaum Asarnow, Jennifer L Hughes, Kalina N Babeva, and Catherine A Sugar. Cognitive-behavioral family treatment for suicide attempt prevention: A randomized controlled trial. Journal of the American Academy of Child & Adolescent Psychiatry, 56(6):506–514, 2017.
[4] Arindam Banerjee, Xin Guo, and Hui Wang. On the optimality of conditional expectation as a bregman predictor. IEEE Transactions on Information Theory, 51(7):2664–2669, 2005.
[5] Arindam Banerjee, Srujana Merugu, Inderjit S Dhillon, and Joydeep Ghosh. Clustering with bregman divergences. Journal of machine learning research, 6(Oct):1705–1749, 2005.
[6] David H Barlow and Matthew K Nock. Why can't we be more idiographic in our research? Perspectives on psychological Science, 4(1):19–21, 2009.
[7] Adriene M Beltz, Aidan GC Wright, Briana N Sprague, and Peter CM Molenaar. Bridging the nomothetic and idiographic approaches to the analysis of clinical data. Assessment, 23(4):447–458, 2016.
[8] Rebecca A Bernert, Melanie A Hom, Naomi G Iwata, and Thomas E Joiner. Objectively-assessed sleep variability as an acute warning sign of suicidal ideation in a longitudinal evaluation of high suicide risk young adults. The Journal of clinical psychiatry, 78(6):e678, 2017.
[9] Eli Bingham, Jonathan P Chen, Martin Jankowiak, Fritz Obermeyer, Neeraj Pradhan, Theofanis Karaletsos, Rohit Singh, Paul Szerlip, Paul Horsfall, and Noah D Goodman. Pyro: Deep universal probabilistic programming. The Journal of Machine Learning Research, 20(1):973–978, 2019.
[10] Edwin V. Bonilla, Felix V. Agakov, and Christopher K. I. Williams. Kernel multi-task learning using task-specific features. In Marina Meila and Xiaotong Shen, editors, Proceedings of the Eleventh International Conference on Artificial Intelligence and Statistics, volume 2 of Proceedings of Machine Learning Research, pages 43–50, San Juan, Puerto Rico, 21–24 Mar 2007. PMLR.
[11] James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: composable transformations of Python+NumPy programs, 2018. URL http://github.com/google/jax.
[12] Lev M Bregman. The relaxation method of finding the common point of convex sets and its application to the solution of problems in convex programming. USSR computational mathematics and mathematical physics, 7(3):200–217, 1967.
[13] Lai Fong Chan, Azhar Shah Shamsul, and Thambu Maniam. Are predictors of future suicide attempts and the transition from suicidal ideation to suicide attempts shared or distinct: a 12-month prospective study among patients with depressive disorders. Psychiatry research, 220(3):867–873, 2014.
[14] Chao Che, Cao Xiao, Jian Liang, Bo Jin, Jiayu Zho, and Fei Wang. An rnn architecture with dynamic temporal matching for personalized predictions of parkinson's disease. In Proceedings of the 2017 SIAM international conference on data mining, pages 198–206. Society for Industrial and Applied Mathematics, 2017.
[15] Beau Coker, Wessel P Bruinsma, David R Burt, Weiwei Pan, and Finale Doshi-Velez. Wide mean-field bayesian neural networks ignore the data. In International Conference on Artificial Intelligence and Statistics, pages 5276–5333. PMLR, 2022.
[16] Daniel DL Coppersmith, Evan M Kleiman, Alexander J Millner, Shirley B Wang, Cara Arizmendi,
Kate H Bentley, Dylan DeMarco, Rebecca G Fortgang, Kelly L Zuromski, Joseph S Maimone, et al. Heterogeneity in suicide risk: Evidence from personalized dynamic models. Behaviour research and therapy, 180:104574, 2024.
[17] Ewa K Czyz, Cheryl A King, Nadia Al-Dajani, Lauren Zimmermann, Victor Hong, and Inbal Nahum-Shani. Ecological momentary assessments and passive sensing in the prediction of short-term suicidal ideation in young adults. JAMA Network Open, 6(8):e2328005–e2328005, 2023.
[18] Zhenwen Dai, Mauricio Álvarez, and Neil Lawrence. Efficient modeling of latent information in supervised learning using gaussian processes. Advances in Neural Information Processing Systems, 30, 2017.
[19] Stefan Depeweg, Jose-Miguel Hernandez-Lobato, Finale Doshi-Velez, and Steffen Udluft. Decomposition of uncertainty in Bayesian deep learning for efficient and risk-sensitive learning. In Jennifer Dy and Andreas Krause, editors, Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 1184–1193. PMLR, 10–15 Jul 2018.
[20] Sameer Deshpande, Soumya Ghosh, Tin D. Nguyen, and Tamara Broderick. Are you using test log-likelihood correctly? Transactions on Machine Learning Research, 2024. ISSN 2835-8856.
[21] Jonas Dora, Connor J McCabe, Caspar J van Lissa, Katie Witkiewicz, and Kevin M King. A tutorial on analyzing ecological momentary assessment data in psychological research with bayesian (generalized) mixed-effects models. Advances in Methods and Practices in Psychological Science, 7(1):25152459241235875, 2024.
[22] Hao Sen Andrew Fang, Ngiap Chuan Tan, Wei Ying Tan, Ronald Wihal Oei, Mong Li Lee, and Wynne Hsu. Patient similarity analytics for explainable clinical risk prediction. BMC Medical Informatics and Decision Making, 21(1):207, 2021.
[23] Andrew Foong, David Burt, Yingzhen Li, and Richard Turner. On the expressiveness of approximate inference in bayesian neural networks. Advances in Neural Information Processing Systems, 33:15897–15908, 2020.
[24] Marta Garnelo, Dan Rosenbaum, Christopher Maddison, Tiago Ramalho, David Saxton, Murray Shanahan, Yee Whye Teh, Danilo Rezende, and SM Ali Eslami. Conditional neural processes. In International conference on machine learning, pages 1704–1713. PMLR, 2018.
[25] Pascal Germain, Francis Bach, Alexandre Lacoste, and Simon Lacoste-Julien. Pac-bayesian theory meets bayesian inference. Advances in Neural Information Processing Systems, 29, 2016.
[26] Jaimie L Gradus, Ping Qin, Alisa K Lincoln, Matthew Miller, Elizabeth Lawler, Henrik Toft Sørensen, and Timothy L Lash. Acute stress reaction and completed suicide. International journal of epidemiology, 39(6):1478–1484, 2010.
[27] Genesis Hang, Annie Chen, Hope Neveux, Matthew K. Nock, and Yaniv Yacoby. Improving forecasts of suicide attempts for patients with little data. In 39th Conference on Neural Information Processing Systems (NeurIPS 2025) Workshop: Learning from Time Series for Health (TS4H), 2025.
[28] Lauren M Harris, Xieyining Huang, Kathryn P Linthicum, Chloe P Bryen, and Jessica D Ribeiro. Sleep disturbances as risk factors for suicidal thoughts and behaviours: a meta-analysis of longitudinal studies. Scientific reports, 10(1):13888, 2020.
[29] Markus Heinonen, Henrik Mannerström, Juho Rousu, Samuel Kaski, and Harri Lähdesmäki. Non-stationary gaussian process regression with hamiltonian monte carlo. In Artificial Intelligence and Statistics, pages 732–740. PMLR, 2016.
[30] James Hensman, Nicolò Fusi, and Neil D. Lawrence. Gaussian processes for big data. In Proceedings of the Twenty-Ninth Conference on Uncertainty in Artificial Intelligence, UAI'13, page 282–290, Arlington, Virginia, USA, 2013. AUAI Press.
[31] James Hensman, Alexander Matthews, and Zoubin Ghahramani. Scalable Variational Gaussian Process Classification. In Guy Lebanon and S. V. N. Vishwanathan, editors, Proceedings of the Eighteenth International Conference on Artificial Intelligence and Statistics, volume 38 of Proceedings of Machine Learning Research, pages 351–360, San Diego, California, USA, 09–12 May 2015. PMLR.
[32] Matthew D Hoffman and David M Blei. Structured stochastic variational inference. In Artificial Intelligence and Statistics, pages 361–369, 2015.
[33] Joshua T Jordan and Dale E McNiel. Characteristics of persons who die on their first suicide attempt: results from the national violent death reporting system. Psychological Medicine, 50(8):1390–1397, 2020.
[34] Bindu Kalesan, Matthew E Mobily, Sowmya Vasan, Michael Siegel, and Sandro Galea. The role of interpersonal conflict as a determinant
of firearm-related homicide-suicides at different ages. Journal of interpersonal violence, 33(15):2335–2351, 2018.
[35] Z Kaminsky, HC Wilcox, William W Eaton, K Van Eck, V Kilaru, Tanja Jovanovic, Torsten Klengel, B Bradley, EB Binder, KJ Ressler, et al. Epigenetic and genetic variation at ska2 predict suicidal behavior and post-traumatic stress disorder. Translational psychiatry, 5(8):e627–e627, 2015.
[36] Aleksandra Kaurin, Alexandre Y Dombrovski, Michael N Hallquist, and Aidan GC Wright. Integrating a functional view on suicide risk into idiographic statistical models. Behaviour research and therapy, 150:104012, 2022.
[37] Mohammad Khan and Wu Lin. Conjugate-computation variational inference: Converting variational inference in non-conjugate models to inferences in conjugate models. In Artificial Intelligence and Statistics, pages 878–887. PMLR, 2017.
[38] Patrick Kidger and Cristian Garcia. Equinox: neural networks in JAX via callable PyTrees and filtered transformations. Differentiable Programming workshop at Neural Information Processing Systems 2021, 2021.
[39] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
[40] Evan M Kleiman, Brianna J Turner, Szymon Fedor, Eleanor E Beale, Jeff C Huffman, and Matthew K Nock. Examination of real-time fluctuations in suicidal ideation and its risk factors: Results from two ecological momentary assessment studies. Journal of abnormal psychology, 126(6): 726, 2017.
[41] Evan M Kleiman, Brianna J Turner, Szymon Fedor, Eleanor E Beale, Rosalind W Picard, Jeff C Huffman, and Matthew K Nock. Digital phenotyping of suicidal thoughts. Depression and anxiety, 35(7):601–608, 2018.
[42] Augustine J Kposowa. Unemployment and suicide: a cohort analysis of social factors predicting suicide in the US national longitudinal mortality study. Psychological medicine, 31(1):127–138, 2001.
[43] Karolina Krysinska and David Lester. Post-traumatic stress disorder and suicide risk: a systematic review. Archives of suicide research, 14(1):1–23, 2010.
[44] Vidhi Lalchand, Aditya Ravuri, and Neil D. Lawrence. Generalised gplvm with stochastic variational inference. In Gustau Camps-Valls,
Francisco J. R. Ruiz, and Isabel Valera, editors, Proceedings of The 25th International Conference on Artificial Intelligence and Statistics, volume 151 of Proceedings of Machine Learning Research, pages 7841–7864. PMLR, 28–30 Mar 2022. URL https://proceedings.mlr.press/v151/lalchand22a.html.
[45] Isotta Landi, Benjamin S Glicksberg, Hao-Chih Lee, Sarah Cherng, Giulia Landi, Matteo Danieletto, Joel T Dudley, Cesare Furlanello, and Riccardo Miotto. Deep representation learning of electronic health records to unlock patient stratification at scale. NPJ digital medicine, 3(1):96, 2020.
[46] Chang Lei, Diyang Qu, Kunxu Liu, and Runsen Chen. Ecological momentary assessment and machine learning for predicting suicidal ideation among sexual and gender minority individuals. JAMA network open, 6(9):e2333164–e2333164, 2023.
[47] Malinda Lu, Yue-Jane Liu, Matthew K. Nock, and Yaniv Yacoby. Neural stochastic differential equations on compact state spaces: Theory, methods, and application to suicide risk modeling. In Proceedings of The 1st Symposium on Probabilistic Machine Learning, volume 327 of Proceedings of Machine Learning Research, pages 135–188. PMLR, 2026.
[48] Jeanne M Madden, Matthew D Lakoma, Donna Rusinak, Christine Y Lu, and Stephen B Soumerai. Missing clinical and behavioral health data in a large electronic health record (ehr) system. Journal of the American Medical Informatics Association, 23(6):1143–1149, 2016.
[49] Anna Madigan and Michael Daly. Socioeconomic status and depressive symptoms and suicidality: the role of subjective social status. Journal of affective disorders, 326:36–43, 2023.
[50] Kaspar Märtens, Kieran Campbell, and Christopher Yau. Decomposing feature-level variation with covariate Gaussian process latent variable models. In Kamalika Chaudhuri and Ruslan Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pages 4372–4381. PMLR, 09–15 Jun 2019. URL https://proceedings.mlr.press/v97/martens19a.html.
[51] Matthew Miller, Carmel Salhi, Catherine Barber, Deborah Azrael, Elizabeth Beatriz, John Berrigan, Sara Brandspigel, Marian E Betz, and Carol Runyan. Changes in firearm and medication storage practices in homes of youths at risk for
suicide: results of the safety study, a clustered, emergency department-based, multisite, stepped-wedge trial. Annals of emergency medicine, 76(2):194–205, 2020.
[52] Daniel S Nagin, Bobby L Jones, and Jonathan Elmer. Recent advances in group-based trajectory modeling for clinical research. Annual Review of Clinical Psychology, 20, 2024.
[53] Mark EJ Newman. Analysis of weighted networks. Physical Review E—Statistical, Nonlinear, and Soft Matter Physics, 70(5):056131, 2004.
[54] Matthew K Nock, Evan M Kleiman, Kate H Bentley, Rebecca G Fortgang, Alexander J Millner, Kelly L Zuromski, Adam Bear, Alexis Christie, Merryn Daniel, Dylan DeMarco, et al. Using smartphone surveys to predict next-week suicide attempts. Journal of psychopathology and clinical science, 2026.
[55] Ronald Wihal Oei, Hao Sen Andrew Fang, Wei-Ying Tan, Wynne Hsu, Mong-Li Lee, and Ngiap-Chuan Tan. Using domain knowledge and data-driven insights for patient similarity analytics. Journal of Personalized Medicine, 11(8):699, 2021.
[56] Erin Orlins, Kristen DeBois, and Sheryl L Chatfield. Characteristics of interpersonal conflicts preceding youth suicide: analysis of data from the 2017 national violent death reporting system. Child and adolescent mental health, 26(3):204–210, 2021.
[57] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.
[58] Alessandro Pigoni, Giuseppe Delvecchio, Nunzio Turtulici, Domenico Madonna, Pietro Pietrini, Luca Cecchetti, and Paolo Brambilla. Machine learning and the prediction of suicide in psychiatric populations: a systematic review. Translational psychiatry, 14(1):140, 2024.
[59] Nicholas G Polson, James G Scott, and Jesse Windle. Bayesian inference for logistic models using pólya-gamma latent variables. Journal of the American Statistical Association, 108(504):1339–1349, 2013.
[60] David Reeb, Andreas Doerr, Sebastian Gerwinn, and Barbara Rakitsch. Learning gaussian processes by minimizing pac-bayesian generalization bounds. Advances in Neural Information Processing Systems, 31, 2018.
[61] Jessica D Ribeiro, Joseph C Franklin, Kathryn Rebecca Fox, Kate H Bentley, Evan M Kleiman, Bernard P Chang, and Matthew K Nock. Self-injurious thoughts and behaviors as risk factors for future suicide ideation, attempts, and death: a meta-analysis of longitudinal studies. Psychological medicine, 46(2):225–236, 2016.
[62] Pau Riera-Serra, Guillem Navarra-Ventura, Adoración Castro, Margalida Gili, Angie Salazar-Cedillo, Ignacio Ricci-Cabello, Lorenzo Roldan-Espinola, Victoria Coronado-Simsic, Mauro Garcia-Toro, Rocio Gomez-Juanes, et al. Clinical predictors of suicidal ideation, suicide attempts and suicide death in depressive disorder: a systematic review and meta-analysis. European archives of psychiatry and clinical neuroscience, 274(7):1543–1563, 2024.
[63] Eric L Ross, Robert M Bossarte, Steven K Dob-scha, Sarah M Gildea, Irving Hwang, Chris J Kennedy, Howard Liu, Alex Luedtke, Brian P Marx, Matthew K Nock, et al. Estimated average treatment effect of psychiatric hospitalization in patients with suicidal behaviors: A precision treatment analysis. JAMA psychiatry, 81(2):135–143, 2024.
[64] Skipper Seabold and Josef Perktold. statsmodels: Econometric and statistical modeling with python. In 9th Python in Science Conference, 2010.
[65] Anis Sharafoddini, Joel A Dubin, and Joon Lee. Patient similarity in prediction models based on health data: a scoping review. JMIR medical informatics, 5(1):e7, 2017.
[66] Amazasp Shaumyan. GitHub: AmazaspShumik/sklearn-bayes: Python package for Bayesian Machine Learning with scikit-learn API. https://github.com/AmazaspShumik/sklearn-bayes, 2016. [Accessed 01-09-2025].
[67] Jasper Snoek, Kevin Swersky, Rich Zemel, and Ryan Adams. Input warping for bayesian optimization of non-stationary functions. In Eric P. Xing and Tony Jebara, editors, Proceedings of the 31st International Conference on Machine Learning, volume 32 of Proceedings of Machine Learning Research, pages 1674–1682, Beijing, China, 22–24 Jun 2014. PMLR.
[68] Steven Stack. Contributing factors to suicide: Political, social, cultural and economic. Preventive medicine, 152:106498, 2021.
[69] Barbara Stanley, Gregory K Brown, Lisa A Brenner, Hanga C Galfalvy, Glenn W Currier, Kerry L Knox, Sadia R Chaudhury, Ashley L Bush, and Kelly L Green. Comparison of the safety planning
intervention with follow-up vs usual care of suicidal patients treated in the emergency department. JAMA psychiatry, 75(9):894–900, 2018.
[70] Qiuling Suo, Weida Zhong, Fenglong Ma, Yuan Ye, Mengdi Huai, and Aidong Zhang. Multi-task sparse metric learning for monitoring patient similarity progression. In 2018 IEEE International Conference on Data Mining (ICDM), pages 477–486. IEEE, 2018.
[71] Michalis Titsias. Variational learning of inducing variables in sparse gaussian processes. In Artificial intelligence and statistics, pages 567–574. PMLR, 2009.
[72] Michalis Titsias and Neil D. Lawrence. Bayesian gaussian process latent variable model. In Yee Whye Teh and Mike Titterington, editors, Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, volume 9 of Proceedings of Machine Learning Research, pages 844–851, Chia Laguna Resort, Sardinia, Italy, 13–15 May 2010. PMLR. URL https://proceedings.mlr.press/v9/titsias10a.html.
[73] Richard E. Turner and Maneesh Sahani. Two problems with variational expectation maximisation for time series models. In David Barber, A. Taylor Cemgil, and Silvia Chiappa, editors, Bayesian Time Series Models, pages 104–124. Cambridge University Press, 2011.
[74] Kees Van Heeringen, Keith Hawton, and J Mark G Williams. Pathways to suicide: an integrative approach. The international handbook of suicide and attempted suicide, pages 223–234, 2000.
[75] Martin J Wainwright and Michael I Jordan. Graphical models, exponential families, and variational inference. Foundations and Trends® in Machine Learning, 1(1-2):1–305, 2008.
[76] Shirley B Wang, Ruben DI Van Genugten, Yaniv Yacoby, Weiwei Pan, Kate H Bentley, Suzanne A Bird, Ralph J Buonopane, Alexis Christie, Merryn Daniel, Dylan DeMarco, et al. Building personalized machine learning models using real-time monitoring data to predict idiographic suicidal thoughts. Nature Mental Health, pages 1–10, 2024.
[77] Marjorie E Weishaar and Aaron T Beck. Hopelessness and suicide. International Review of Psychiatry, 4(2):177–184, 1992.
[78] Florian Wenzel, Théo Galy-Fajou, Christian Donner, Marius Kloft, and Manfred Opper. Efficient gaussian process classification using pólya-gamma data augmentation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 5417–5424, 2019.
[79] Yaniv Yacoby, Weiwei Pan, and Finale Doshi-Velez. Failure modes of variational autoencoders and their effects on downstream tasks. arXiv preprint arXiv:2007.07124, 2020.
[80] Yaniv Yacoby, Weiwei Pan, and Finale Doshi-Velez. Mitigating the effects of non-identifiability on inference for Bayesian neural networks with latent variables. Journal of Machine Learning Research, 23(190):1–54, 2022.
[81] Jiayu Yao, Weiwei Pan, Soumya Ghosh, and Finale Doshi-Velez. Quality of uncertainty quantification for bayesian neural network inference. ICML 2019 Workshop on Uncertainty and Robustness in Deep Learning, 2019.
[82] Manzil Zaheer, Satwik Kottur, Siamak Ravanbakhsh, Barnabas Poczos, Russ R Salakhutdinov, and Alexander J Smola. Deep sets. Advances in neural information processing systems, 30, 2017.
[83] Zihao Zhu, Changchang Yin, Buyue Qian, Yu Cheng, Jishang Wei, and Fei Wang. Measuring patient similarities via a deep architecture with medical concept embedding. arXiv preprint arXiv:1902.03376, 2019.
APPENDIX
CONTENTS
A RELATED WORK 15
B HIERARCHICAL MODELS AS GAUSSIAN PROCESSES 17
C THEORY FOR THE MODEL 18
C.1 Instantiating the Similarity Kernel 18
C.2 The Identifiability of the Similarity 18
D THEORY FOR APPROXIMATE INFERENCE 19
D.1 The Sparse Variational LSGP Lower Bound 19
D.2 The Pólya-Gamma Sparse Variational LSGP Lower Bound 20
D.3 Coordinate-Ascent Updates on the Sparse Variational Pólya-Gamma Lower Bound 22
D.4 Variational Expectation-Maximization (VEM) Inference Algorithm 24
D.5 The Factorized Pólya-Gamma Bound 26
E THEORY FOR PERSONALIZATION COLLAPSE 27
E.1 Proof That the Coupling Gap Is a Bregman Information 27
E.2 Proof That the Gap Vanishes Exactly When Similarity Collapses 28
F DATA AND EXPERIMENTAL SETUP 29
F.1 The “Hemisphere” Synthetic Dataset 30
F.2 The EMA Dataset 31
G ADDITIONAL RESULTS 34
A RELATED WORK
There are many modeling paradigms for learning latent structure from EMA data alongside a prediction, ranging from classical frameworks like linear mixed-effects models [e.g., 21] to continuous-time and deep sequence models like Latent SDEs [e.g., 47]. Rather than broadly comparing across all paradigms, we constrain our model selection using two key criteria.
First, to ensure clinical accessibility, the model should represent a minimal departure from frameworks familiar to clinical researchers—nomothetic, idiographic, and mixed-effects models—while offering an explicit, interpretable latent structure. Second, because our primary goal is fixed-horizon forecasting (predicting next-week risk), framing the task as a classification problem cleanly isolates our core theoretical contributions—e.g., kernel identifiability, personalization collapse of MFVI, etc.—without the confounding computational and inference complexities of sequential models. This establishes a rigorous theoretical foundation that future work can readily extend to more complex sequential frameworks and continuous-time point processes.
These constraints point directly to the GPLVM family [e.g., 72, 50, 18]—a GP extended with a continuous input latent variable. By focusing on this model class, we can cleanly illustrate our core claims regarding continuous patient-similarity representations for risk forecasting, while leaving extensions to sequential models to future work.
Existing Modeling Approaches for EMA Data in Clinical Psychology. Most work on forecasting suicide risk from EMA data targets suicidal thoughts rather than SREs [e.g., 40, 17, 46, 76]. SREs are particularly challenging to predict due to severe class imbalance and acute stressors layered atop suicidal thoughts. Historically, nomothetic and idiographic approaches have been common in clinical modeling research due to their intuitive presentation [e.g., 6, 7]. But since they make unfavorable trade-offs between pooling and personalization, EMA researchers have increasingly been turning to hierarchical (mixed-effects) models. Hierarchical models bridge the gap between nomothetic and idiographic paradigms by decomposing risk trajectories into a shared population trend (fixed effects) and patient-specific deviations (random effects) [21]. In Sec. 2 and Apx. B, we show that LSGPs generalize both nomothetic and idiographic extremes, as well as hierarchical models, offering four key advantages:
-
Explicit Patient Similarity: Hierarchical models assume that individual patient deviations are completely independent. In contrast, LSGPs directly quantify similarity between patients and use it to improve risk forecasting of SREs.
-
Targeted Information Sharing: Hierarchical models shrink all patient-specific trends toward a single global population mean. For patients with no SREs during the training window, risk predictions default entirely to this generic average. In contrast, LSGPs selectively inform forecasts using the sub-population of patients who share similar dynamic risk trajectories, significantly improving risk predictions for individuals who experience their first SRE during the test period (Result 6.2). That is, under an LSGP, the prediction for a given patient is informed directly by their own observed data, while the model selectively reweighs data from other patients based on the learned similarity of their predictive functions. Finally, under an LSGP, the shrinkage strength itself is per-patient, set by the code-dependent amplitude rather than by a single cohort-wide parameter.
-
Non-linear Representation Learning: Hierarchical random slopes enter linearly through a fixed design matrix. In contrast, LSGPs transform the latent code through any choice of kernel, enabling the model to learn arbitrarily complex, non-linear transformations of risk trajectories over time.
-
Capacity Control under High Sparsity: Fitting random-slope models requires estimating individual parameters per patient directly from sparse longitudinal data. In our cohort ( ), where 81.7% of patients exhibit zero events, estimating this many parameters per individual can lead to overfitting. In contrast, LSGPs map each patient into a low-dimensional latent space (1–2 dimensions in our experiments), replacing dozens of individual parameter estimates with a compact representation of patient similarity.
Existing Approaches for Learning Patient Similarity from EMA Data in Clinical Psychology. Methods for inferring patient similarity in EMA data generally fall into two categories: (1) feature-based clustering on summary statistics [e.g., 41], and (2) parametric latent variable modeling [e.g., 52, 21]. Summary-statistic approaches collapse EMA histories into aggregate metrics (e.g., means or variances) independently of risk forecasting. This discards temporal nuance: two patients with identical summary statistics may exhibit vastly different risk dynamics—such as a steady decline versus extreme volatility—that imply fundamentally different near-term SRE risk. Parametric latent models structure patient heterogeneity but restrict representations to discrete subgroup categories or impose rigid functional forms that struggle to capture complex, non-linear EMA patterns. In contrast, we frame next-week risk prediction by modeling patient similarity directly within the predictive function space via a continuous latent process. This enables sharing statistical strength across patients with similar non-linear profiles without collapsing EMA histories into aggregate metrics, forcing discrete subtyping, or assuming restrictive parametric curves.
Leveraging Similarity in Clinical Decision Support. Clinical decision support systems increasingly leverage patient similarity to retrieve historical precedents for case-based reasoning [65]. Existing approaches broadly fall into two categories. The first calculates similarity over static health records using fixed distance metrics or domain heuristics [e.g., 65, 22, 55]. The second uses metric learning or deep architectures to map longitudinal feature trajectories into latent embeddings on which similarities are computed [e.g., 14, 70, 83, 45]. However, both paradigms evaluate similarity between two patients, i and j, in the input feature space or latent embedding space , rather than in function space . For dynamic outcomes like suicide risk, matching feature values or embedding overlaps is insufficient. Function-space similarity instead captures how the inputs, x—like daily EMA survey responses—dynamically drive changes in risk . That is, two patients may present with identical symptom scores , yet these scores may drive suicide risk differently : for example, an acute spike in interpersonal conflict might increase suicide risk in one patient while leaving another relatively stable. The LSGP addresses these limitations by explicitly capturing function-space similarity while providing formal identifiability guarantees.
Inference Pathologies in GPLVM Family Models. Scalable inference for the GPLVM family typically relies on MFVI, factorizing the variational posterior across the inducing variables and the local latent variables [e.g., 30, 44] (the collapsed bound of Titsias and Lawrence [72] instead integrates the inducing variables out analytically, which is possible for a Gaussian likelihood but not for the Bernoulli likelihood here). However, the specific inference pathologies arising from MFVI in GPLVMs remain uncharacterized, despite a broad literature showing pathologies of MFVI in other models [e.g., 73, 23, 79, 15]. Most closely related to the pathology we expose here is the work by Yacoby et al. [80] on Bayesian Neural Networks with Latent Variables (BNN+LVs)—the neural network analog of GPLVMs. In BNN+LVs, MFVI drives inference toward an asymptotically biased posterior mode, resulting in poor model fit, generalization, and uncertainty quantification. While this pathology has been demonstrated in neural architectures, its impact on non-parametric GP-based models has not been characterized. In this work, we give an exact, closed-form characterization of the penalty incurred by MFVI for LSGPs and show that minimizing it collapses the LSGP to a nomothetic model. In future work, we hope to translate these findings from the LSGP to the broader GPLVM family.
B HIERARCHICAL MODELS AS GAUSSIAN PROCESSES
We now recall the well-known result that hierarchical (mixed-effects) models can be represented as GPs, using this relationship to highlight the exact points where LSGPs differ.
Hierarchical (Mixed-Effects) Model. Let and denote the shared fixed-effect bias and slopes. Each patient carries a random bias and, in the intercept+slopes model, random slopes ; the intercept model omits the random slopes, so all formulas below specialize to it by deleting the slope terms. We write for patient 's random effects and for the slope variance components. The generative process is:
where the logit function for patient n makes the shared trend and the patient's deviation explicit:
Hierarchical Model as a GP. Integrating out and yields a zero-mean GP over the joint patient-feature index :
(19)
Thus, hierarchical models can be represented as GPs with a linear fixed-effect kernel plus an indicator-gated linear deviation kernel .
LSGPs Generalize the Hierarchical Model. Specifically, they do this by (1) replacing the rigid indicator with a learned continuous similarity kernel ; (2) replacing the fixed identity input with an inferable low-dimensional code ; (3) relaxing linear feature kernels to flexible input kernels ; and (4) parameterizing shrinkage strength via a learned, patient-specific amplitude function , parameterized by a neural network.
C THEORY FOR THE MODEL
C.1 Instantiating the Similarity Kernel
Existing Kernels. Recall from Def. 1 that the similarity factor is defined as , where is the weighted feature distance. We incorporate Automatic Relevance Determination (ARD) across all kernels via feature “importances” . The table below shows that many popular kernels are instantiations of this similarity formulation, and each row can be combined with any -independent kernel satisfying Def. 1.
New Kernels. We extend the stationary, constant-amplitude kernels above by introducing two key mechanisms: (i) input-dependent amplitude, , where is a neural network; and (ii) non-stationarity, via per-dimension input warping [67]. As shown by Archer and Wang [2], a sigmoid network with non-negative weights yields a monotonic transformation. Whereas Archer and Wang [2] enforce non-negativity dynamically during optimization by damping learning rates, we enforce monotonicity by construction via a softplus parameterization:
where is the number of sigmoid units per coordinate, and , , , are parameters in . The bias terms remain unconstrained as they merely set activation thresholds. Crucially, this guaranteed positivity ensures that is strictly order-preserving, satisfying Def. 1(iii).
| ARD | Amplitude | Correlation | Warp | |
|---|---|---|---|---|
| Examples of Existing Kernels | RBF | |||
| Matérn (5/2) | ||||
| Rational-Quadratic | where | |||
| Examples of New Kernels | RBF, amplitude-scaled | |||
| RBF, per-dim. warp | ||||
| RBF, per-dim. warp, amplitude-scaled |
C.2 The Identifiability of the Similarity
Proof of Prop. 1. Write both kernels in the form of Eq. 5. () Assume the three identities hold for some ; upon substituting them, the three factors cancel:
(⇒) Fix with and write . Then, for all and all ,
assumed
(22)
positive roots
(26)
divide Eq. 22 at by
(27)
Thus, evaluating at any pair of codes , we have . Finally, since cancels out,
D THEORY FOR APPROXIMATE INFERENCE
D.1 The Sparse Variational LSGP Lower Bound
Sparse Augmentation. We use the sparse augmentation of Sec. 3, whose has rows . The inducing values carry the zero-mean sparse GP, with the mean function entering additively at ; integrating out of therefore returns of Sec. 2 exactly.
Inference. We define our variational family,
Here is Gaussian and is a general code posterior, both drawn from the families in the Variational Families paragraph below; the mean-field default takes and independent of the codes. The KL divergence between the approximate and true posteriors is:
Thus,
(30)
(31)
(32)
(33)
wherein we follow Hensman et al. [31] for the analytical form of:
(34)
(35) with . Mini-batching the reconstruction term brings the cost of a gradient step down to [31, 30, 44].
Variational Families. For the inducing posterior , we compare two designs: a factorized Gaussian that treats as independent of the codes, and a structured Gaussian whose moments depend directly on . To map the unordered set of codes to the inducing moments while preserving permutation invariance, we parameterize this structured family using a DeepSet [82]. For the latent code posterior , we can leverage amortization via DeepSets rather than optimizing free per-instance parameters. Specifically, uses an encoder evaluated over patient 's observation set (Sec. 3).
D.2 The Pólya-Gamma Sparse Variational LSGP Lower Bound
Pólya-Gamma Augmentation. From Polson et al. [59], we know that, for any :
where PG( , ) is the Pólya-Gamma distribution. With this identity, we rewrite the Bernoulli likelihood as follows:
wherein can be further simplified:
The Pólya-Gamma Augmented ELBO. We define our variational family,
and begin with the same ELBO, , of the Sparse Variational LSGP. Then, drawing on work by Wenzel et al. [78], we substitute the PG identity into :
(49)
This provides us with a variational lower bound we can optimize via VEM.
Closed-Form Pólya-Gamma ELBO. Eq. 8 defines the variational lower bound with terms expressed as expectations. We now derive analytical expressions for these terms, with the exception of expectations with respect to , which lack a closed-form solution and are estimated via Monte Carlo sampling. To this end, we specify a Gaussian inducing factor and a Pólya-Gamma auxiliary factor parameterized by tilt parameters . As demonstrated later, the optimal coordinate-ascent updates take precisely these parametric forms; hence, this choice incurs no loss of generality at the fixed point. We do this term by term:
• The Pólya-Gamma Mean. From Polson et al. [59], we know the mean of a Pólya-Gamma distribution is
a fact we use in the derivation of the reconstruction term and the coordinate-ascent updates below. Since here we only care about the case in which , we define:
• The Reconstruction Term Given Z. Taking the expectation of Eq. 47 over , and writing for the mean-function value at row , we obtain the augmented log-likelihood:
where the two moments of are taken under the Gaussian marginal obtained by integrating out of —the sparse-variational marginal of Hensman et al. [31], , in which:
(58)
• The Auxiliary KL Term Given Z. From Polson et al. [59], we have:
Therefore,
(60)
• The Remaining KL Terms. The inducing-point KL term, , is a KL between two Gaussians and admits an analytic form. In this work we use a mean-field diagonal Gaussian variational family over the latent codes, giving the standard KL term, .
Substituting the three terms above into Eq. 8, we get:
The per-observation sum is what permits mini-batching: for a batch of rows drawn uniformly, rescaling that inner sum by is unbiased, while the two KL terms are not rescaled.
D.3 Coordinate-Ascent Updates on the Sparse Variational Pólya-Gamma Lower Bound
Update for . We adopt the approach of Wenzel et al. [78] to derive the update. The terms in (Eq. 8) that depend on are:
Taking the functional derivative with respect to for fixed Z, and writing out the expectation as an integral, we get:
Since , setting and solving for , we get:
where the -1 is absorbed into the normalizing constant. Substituting in from Eq. 47 and taking the expectation term by term, we get:
(66)
All terms except are constant with respect to , so:
This is exactly the exponential tilt of Eq. 59, so
Therefore, by Eq. 58,
Update for . We adopt the approach of Wenzel et al. [78] to derive the update. Taking the functional derivative of with respect to for fixed Z, and writing out the expectation as an integral, we get:
Since , setting and solving for :
where the -1 is absorbed into the normalizing constant. Substituting in from Eq. 47 and taking the expectation over term by term, we get:
(75)
where (so conditional on ), and we used and:
(76)
with as in Apx. D.1. Now, taking the expectation over , whose mean is , we get:
(77) using the second moment from above. Summing over all observations and dropping all terms constant with respect to (expanding the square, the mean contributes the linear term ), we get:
(78)
where is the matrix with rows , (both depending on ), and is the vector of mean-function values. We add from , using :
We combine all terms:
We now complete the square by expanding :
Since does not depend on , it is absorbed into the constant:
This is the log of a Gaussian, so , where and are obtained by inverting the definitions above:
SO:
D.4 Variational Expectation-Maximization (VEM) Inference Algorithm
We perform inference via a Variational Expectation-Maximization (VEM) algorithm (Algorithm 1) that alternates between a conjugate E-step and a non-conjugate M-step. In the E-step, we execute Coordinate-Ascent Variational
Algorithm 1 A Single Iteration of the VEM Algorithm for PG-LSGP.
Require: parameters ; rows ; inner sweeps ; Monte Carlo samples .
1: for to do ▷ Monte Carlo samples of the codes
2: draw (reparameterized)
3: for every row ▷ initialize the Pólya-Gamma tilt parameters
E-step (closed-form CAVI over the conjugate factors; every iterate below is at , so the argument is left implicit):
4: for to do ▷ alternate the two closed-form conjugate updates
5: for each row do ▷ PG mean (Eq. 55)
6: end for
7: ▷ closed-form (Eq. 87)
8:
9: for each row do at ▷ refresh tilt parameters (Eq. 71)
10: end for
11: end for
12: Freeze via stop-gradient ▷ envelope theorem: at the fixed point
13: Recompute in closed form at the frozen ▷ differentiated through
14: the bracketed integrand of Eq. 61 at
15: end for
16: M-step (gradient step on the non-conjugate parameters):
17: ▷ Monte Carlo estimate of Eq. 61
18:
Inference (CAVI) over the conjugate factors, which exhibits fast, monotonic convergence to its fixed point. Crucially, because the variational parameters reach the CAVI optimum where , the envelope theorem guarantees that stopping gradients through the inner loop yields exact total derivatives for the non-conjugate parameters (kernel hyperparameters, inducing inputs, and remaining variational parameters). This stop-gradient eliminates the need to store intermediate states across sweeps during reverse-mode automatic differentiation—drastically reducing memory overhead for large inducing sets —without altering the forward value. In the M-step, we take a plain Euclidean gradient step on , differentiating through the closed-form distribution , which is recomputed at the current parameters and thus envelope-exact as well. Unlike Conjugate-Computation Variational Inference [37], which recasts non-conjugate updates via mirror descent in mean-parameter space, our M-step uses standard Euclidean gradients and naturally admits mini-batching over observation rows.
Numerical Stability of the Pólya-Gamma Mean. Eq. 55 has a removable singularity at , where the numerator and denominator vanish together. Expanding the numerator resolves it:
(substituting )
(91)
The leading term gives the limit, , so extends continuously through . In floating point the two cases differ: evaluated directly, Eq. 55 is accurate for every , but at exactly it returns rather than , and its derivative loses precision to cancellation as . We therefore pick a small threshold and evaluate Eq. 91 below it and Eq. 55 above it:
Algorithm 2 A Single Iteration for the Factorized PG-LSGP.
Require: parameters ; rows (or a mini-batch , with scale ); code samples
1: one for every draw: it does not read the codes
2: for to do Monte Carlo samples of the codes
3: (reparameterized)
4:
5: at Eq. 71 under the substitution: one step, no sweeps
6:
7: Freeze via stop-gradient envelope theorem, as in Algorithm 1
8: the row sum of Eq. 61 at
9:
M-step (a single gradient step; no E-step precedes it):
10: neither KL depends on
11:
This guards the forward value; the gradient is not at issue in Algorithm 1, where is frozen by stop-gradient before the M-step.
Mini-Batching and Stochastic Natural Gradients. To scale training to more rows, we can execute Algorithm 1 using mini-batches. For a mini-batch , we apply the dataset scaling factor in two places:
-
Reconstruction Term. The likelihood reconstruction sum in is rescaled by , leaving the global KL divergence terms unscaled.
-
Conjugate Updates. Inside the conjugate updates for , the posterior moments depend on two full-dataset row sums:
which yield and . On a mini-batch , we replace these full-dataset sums with their rescaled, unbiased estimators:
Solving the conjugate system in closed form is a stochastic natural-gradient step at unit step size [78]. Finally, we note that while the estimated statistics and are unbiased, the matrix inversion required to compute introduces a small bias of order . As a result, training ELBO values across different batch sizes are not directly comparable, and model selection should be evaluated on held-out log-likelihoods.
D.5 The Factorized Pólya-Gamma Bound
To empirically demonstrate personalization collapse, we need to derive a factorized bound. To do this, we replace the code-conditional factor by a free, full-rank multivariate Gaussian that is independent of :
with and a lower-triangular Cholesky factor with positive diagonal, both free variational parameters , optimized via gradient descent. This gives us Algorithm 2.
E THEORY FOR PERSONALIZATION COLLAPSE
E.1 Proof That the Coupling Gap Is a Bregman Information
We express the multivariate Gaussian family in natural parameters as:
where denotes the natural parameters, and the sufficient statistic and log-partition function [75] are defined as:
Correspondingly, the code-conditional natural parameters constructed from Eq. 87 are given by:
Proof of Thm. 1. We begin by establishing that and are Gaussian (Parts 1 and 2, respectively). Then we show that the GAP is an expectation of KL divergences (Part 3), which can be expressed as a Bregman information (Part 4).
Part 1: is Gaussian. With all other variational factors held fixed, the coordinate-ascent variational inference (CAVI) optimum for the inducing values satisfies
where is an unnormalized density with normalizer and normalized distribution . Completing the square in (Eqs. 86 and 87) confirms that is Gaussian:
(101)
Part 2: is Gaussian. By Part 1, is a member of the family above, with natural parameters . Since is linear in , taking the expectation over simply averages the natural parameters:
The only U-dependence is the inner product ; every remaining term is a constant. Exponentiating and normalizing therefore gives
the Gaussian at the expectation of the natural parameters. Reading back in moment form,
so it is the precisions that average, not the covariances. Normalizability is immediate: is an expectation of positive-definite precision matrices under a probability measure, hence positive definite.
Part 3: GAP is an Expected KL Divergence. Let . As a function of (with all other factors fixed), writing const for terms independent of , we express the optimization of as:
where is the CAVI-optimal conditional distribution (Eqs. 74 and 86), and is absorbed into const.
Evaluating this objective under both and yields:
(106)
where setting is admissible since is Gaussian (Part 2).
Finally, subtracting the factorized bound from the structured bound cancels the shared const terms:
expressing the coupling gap directly as an expected KL divergence.
Part 4: The Expected KL is a Bregman Information. Parts 1 and 2 put both distributions in the family: and with (Eqs. 102 and 103). Each KL is then the Bregman divergence of (Def. 2),
(Def. 2)
(112)
and since is the mean,
by Def. 3, which is Eq. 12. By Def. 2 it is and vanishes iff -a.s., i.e. iff —equivalently —is -a.s. constant.
E.2 Proof That the Gap Vanishes Exactly When Similarity Collapses
Proof of Thm. 2. First, we show that the latent codes Z affect the conditional optimum exclusively through the cross-covariance matrix between observations and inducing points. By the Hadamard factorization of the Similarity Kernel (Def. 1), cross-covariance entries separate across feature and latent channels:
Given a code-independent auxiliary matrix (Thm. 2(iii)) and base mean , the natural parameters (Eqs. 10 and 87) satisfy:
where , and is code-independent and well defined by Thm. 2(i). Thus, depends on solely through .
Part 1 ( ): Collapse implies a zero coupling gap. If and , then , making . The code-dependent term in Eq. 114 becomes constant, rendering —and by extension —independent of . By Thm. 1, GAP = 0.
Part 2 ( ): A zero coupling gap forces personalization collapse. Assume GAP = 0. By Thm. 1, is -almost surely constant, i.e. constant except possibly on a set of -probability zero. No such exceptions exist: if took a different value at some Z, then by continuity (Def. 1) it would do so on a whole neighborhood of Z, and under full support (Thm. 2(ii)) every neighborhood has positive probability. Hence, is pointwise constant everywhere on .
Step 1: Pointwise constancy of live-inducing covariances. By Eq. 115, constancy of implies that —and consequently the Gram matrix —is constant in . With all patient codes set equal ( ) for an arbitrary , the -th diagonal entry expands as:
For any live inducing point , because and for at least one observation. Thus, is constant across for every live .
Step 2: Joint live-inducing constraints force . Since is constant across , evaluating it at fixes its value to (since ). Writing out (Def. 1), equating it to , and dividing through by yields:
Fix and select live points with distinct warped coordinates (Thm. 2(v)). Evaluating Eq. 117 for at , and for at gives:
By kernel symmetry, . Multiplying these equations yields . Since , we have , which requires:
Since for all , this implies . Because is diagonal, the -th coordinate of this vector equation reads , where is the importance of latent dimension (Def. 1); we know that is non-zero by the choice of ; hence . Since was arbitrary, .
Step 3: Uniform amplitude constancy and complete personalization collapse. With , . Equation 117 reduces to for all , proving that is constant (Thm. 2(a)). Furthermore, implies everywhere, and constant implies everywhere, so as well, establishing total personalization collapse (Thm. 2(b)).
F DATA AND EXPERIMENTAL SETUP
We begin with the components of the experimental setup that are common to both the synthetic and real-data experiments.
Evaluation Metrics. We evaluate model performance along four complementary dimensions, the last of which requires a known ground truth and is therefore reported on synthetic data alone:
• Test Average Precision (AP): Measures performance across precision-recall thresholds.
• Test Log-Likelihood (LL): Assesses probabilistic calibration and goodness-of-fit.
• Mean Off-Diagonal Similarity (MODS): For an similarity matrix (e.g., , , or ), define:
MODS quantifies inter-patient information sharing; values near 1 signal personalization collapse (Thm. 2), whereas values near 0 reflect fully independent modeling.
- Similarity Recovery: The Spearman rank correlation between the off-diagonal entries of a learned similarity matrix and the corresponding ground-truth patient similarities (only applicable to synthetic data). Recovery is scored on and complements MODS: MODS asks whether the model distinguishes patients at all, recovery whether the distinctions it draws are the right ones. It is undefined for a similarity matrix that is constant off the diagonal, where no ranking exists.
We evaluate AP and LL both at the pooled level (aggregating cohort observations to assess global discrimination) and at the per-patient level (measuring within-patient temporal forecasting). Per-patient AP excludes any patient whose evaluation period contains only one class—no SREs, or no non-SRE surveys—since AP is undefined there. To contextualize performance across baseline risk profiles, we stratify results by whether a patient experienced an SRE during training.
Software. The LSGP is implemented in NumPyro [9] on JAX [11], with the neural components (e.g. the DeepSet encoder and the kernel warps) written in Equinox [38]. The linear baselines use scikit-learn [57], the variational and empirical-Bayes logistic regressions use sklearn-bayes [66], and the hierarchical (mixed-effects) baselines use statsmodels [64]. All fits run in double precision, which the Cholesky steps of the sparse bound require.
F.1 The “Hemisphere” Synthetic Dataset
Because EMA data lacks ground-truth patient similarities, we construct a synthetic benchmark—the “Hemisphere” dataset—to evaluate similarity recovery alongside predictive accuracy. The dataset satisfies three primary design objectives: (1) providing an explicit ground-truth similarity metric to verify recovery, (2) modeling continuous patient heterogeneity by rotating decision boundaries along a manifold, and (3) generating Likert-formatted responses to mirror real EMA survey structures.
Data-Generating Process. Each patient is assigned a latent direction on the upper hemisphere of a unit sphere in feature space (where need not equal in experiments). For survey belonging to patient , the sampling process is defined as:
where represents Likert survey responses. Taking the absolute value projects every direction onto the upper hemisphere, yielding ground-truth pairwise similarities . The parameter controls decision boundary sharpness. Surveys are sampled per patient until at least three positive and three negative outcomes are observed. For a visual illustration of this data-generating process, see Fig. 4.
Cohort Construction. We generate 36 synthetic cohorts by crossing six cohort sizes ( ) with six “boundary sharpness levels” ( ), dictating label noise around the decision boundary. These two parameters govern how much “signal” is in the data. Each cohort uses features and surveys per patient, producing datasets with rough class label balance to ensure results are not confounded by the class imbalance present in real EMA data.
1D Manifold of Patient Heterogeneity

True Patient Similarity
Patient 0
Patient 100
Patient 199
Figure 4: Synthetic Hemisphere dataset with ground-truth similarity. Top left: Patient directions on the upper unit semicircle ( ). Top right: True similarity matrix (monotonically equivalent to ), ordered along the manifold. Bottom row: Observed feature space for three representative patients, showing patient-specific decision boundaries and survey outcomes.
Experimental Setup. Surveys are split, in generation order, into a 50/25/25 train/validation/test partition, with features min-max scaled on training rows. Models are fit on each cohort across three random initializations, with the restart selected via the highest validation log-likelihood.
Hyperparameters and Model Selection. The two evaluated variants differ only in how couples to latent codes Z, isolating the structural effect of variational coupling:
• PG-LSGP (Structured ): Pólya-Gamma bound (Apx. D.2) where attains the exact code-conditional optimum in closed form (Eq. 10).
• PG-LSGP (Factorized ): Factorized bound (Apx. D.5) using a free, full-covariance Gaussian.
Both variants use free inducing points, full-batch Adam optimizer updates (2,000 iterations, learning rate 0.01), a product kernel (linear , ARD-RBF ), and (matching the manifold's intrinsic dimension). The code posterior uses a DeepSet encoder (2 hidden layers, width 64, 3 Monte Carlo samples per step), with warm-started to the logit of the training prevalence. Encoder inputs are remapped from [0, 1] to [-1, 1] to prevent amortized posterior collapse. Two necessary implementation differences exist: structured executes inner CAVI sweeps per step, whereas factorized requires gradient norm clipping at 1.0 to stabilize its free Cholesky factor.
F.2 The EMA Dataset
Patients and Recruitment. A total of 623 unique patients presenting with suicidal thoughts or recent suicidal behavior were recruited across two Boston-area hospital sites: 315 adults (ages 18+) from an emergency psychiatric service and 308 adolescents (ages 12–19) from an inpatient unit. Patients who re-enrolled are counted once, even if they were assigned more than one study ID. Exclusions included non-smartphone ownership, lack of English fluency, inability to consent, or severe cognitive impairment (e.g., psychosis, acute intoxication, dementia).
Consent, Compensation, and Safety Protocol. Patients completed baseline assessments, installed the LifeData smartphone app, and received 1 per submitted survey. Study protocols were approved by the institutional review board. A dedicated clinical risk team monitored real-time responses to intervene upon high reported suicidal intent.
EMA Sampling and Survey Structure. Prompts were delivered 6 times daily for three months: a daily survey and a nighttime survey at fixed times as the first and last prompts of each day, with 4 randomized prompts in between. Patients could also submit voluntary self-initiated surveys (e.g., to report self-injury). Surveys evaluated 3 suicidal-thoughts items (urge, intent, ability to resist) and 17 affective states on a 0–10 Likert scale.
Suicide-Related Event (SRE) Outcomes. SREs could be identified from seven sources: three patient self-reports (a user-initiated survey, the daily survey, or the nighttime survey); the study's event log, maintained by the clinical team; emergency calls, in which clinicians learned of an event and logged it; reports relayed by study staff over the team's internal messaging channel; and, for patients who consented to record access, the electronic health record (EHR), consensus-coded by trained reviewers. An SRE is retained only if preceded by at least one EMA survey within 7 days.
De-Identification. All data was de-identified before being shared with the research team: patients are indexed only by a study ID, with no names, dates of birth, or other direct identifiers retained. The demographic-annotated similarity figures we report (Figs. 3 and 7 and their appendix variants) are drawn entirely from these de-identified records; each patient appears only as a node or a row keyed by study ID, colored by a broad demographic category shared by many patients, so no figure in this paper displays a name, a raw survey response, or any information beyond a patient's de-identified demographic category and their position in the learned similarity structure.
Data Cleaning and Cohort Construction. When patients explicitly skipped suicidal-thoughts items, the instrument recorded a skip; these surveys were retained, and missing items were imputed using each patient's individual training-data mean to capture within-person levels without introducing between-person differences. Two kinds of surveys were dropped instead. First, a survey in which a suicidal-thoughts item was missing without a recorded skip: we do not know why the value is absent, so imputing it would tell the model the question was answered. Second, a skipped survey from a patient who never answered that item anywhere in their training data, since there is then no personal mean to impute from.
This strategy retained 76,798 of 79,448 recorded surveys (a 3.3% loss). In contrast, listwise deletion would have retained only 73,739 surveys, discarding 3,059 surveys where patients declined suicidal-thoughts questions—a response pattern plausibly tied to clinical risk and therefore not missing at random. Of 623 recruited patients, 503 contributed at least one EMA survey. Six were excluded for lacking valid responses required for person-mean imputation, resulting in a final analytical cohort of N = 497 patients and 76,798 surveys (81.7% of patients experienced zero SREs).
Features. Every model sees the same columns:
• Affect items (17): humiliated, isolated, negative, numb, desire to escape, energetic, fatigued, hopeless, trapped, worried, positive, self-hate, agitated, angry, burdensome, desire to approach people, places, and things, and desire to avoid people, places, and things.
• Suicidal-thoughts items (3): urge to die by suicide, intent to die by suicide, and ability to resist dying by suicide.
• Survey metadata and context (8): minutes from prompt to survey start, survey duration in minutes, days since the previous survey, daytime indicator, weekend indicator, holiday indicator, day-before-holiday indicator, and daylight duration.
• Other survey-level columns (4): count of extreme affect responses, COVID-19 state-of-emergency indicator, number of SREs accumulated so far in the study, and adult-versus-adolescent indicator (by recruitment site).
• Skip indicators (3): whether the urge, intent, and ability-to-resist items were skipped.
Experimental Setup. Models are evaluated on these 35 columns across three training fractions, . Because temporal splitting is deterministic for a given , we evaluate the three training fractions as distinct datasets representing varying amounts of history rather than reporting a mean and variance across them. Class prevalence remains stable across splits (train: 3.9%, 3.7%, 3.6%; test: 4.1%, 3.7%, 3.4%). Test windows contain 69, 57, and 31 SRE episodes across 51, 47, and 30 patients for , respectively.
Within each patient’s trajectory, surveys are ordered chronologically. To prevent temporal leakage and avoid splitting multi-day clinical events across sets, split boundaries are snapped strictly outside any continuous 7-day SRE run. Each patient’s timeline is then cut into train | val | test in time order, training taking a fraction h and validation and test each taking half of what remains: . Features are min-max standardized to [0, 1] based on training set statistics.
We fit non-deterministic models across 5 random initializations, selecting among them on validation log-likelihood for the LSGP and on validation per-patient AP for the baselines, for which the seed is tuned alongside the remaining hyperparameters.
The two criteria answer two different questions. Restart selection asks which of several local optima of one objective to keep: every LSGP variant maximizes the same evidence lower bound on the log marginal likelihood, so the held-out LL is the out-of-sample counterpart of that objective, and selecting on it mitigates local optima without introducing a criterion the objective never saw. Model comparison asks which method forecasts within-patient risk, which per-patient AP measures (Result 6.1), and this criterion is applied identically to every LSGP variant and every baseline. The baselines have no comparable inner objective (their seed enters through data subsampling, not through a bound being maximized), which is why their seed is tuned as a hyperparameter instead.
Hyperparameters and Model Selection. Each baseline's hyperparameters are selected via validation per-patient AP (see Result 6.1). Shared LSGP settings include inducing points, mini-batch size , 10,000 Adam iterations (learning rate = 0.005), the product kernel , linear , a DeepSet encoder (2 layers, width 16), , gradient norms clipped at 1.0, and a constant mean warm-started to the logit of the training prevalence. The LSGP ablation has no encoder to stabilize, so it is unclipped at with a mean-field , and it searches its under a zero-initialized linear mean . We give the (non-ablation) LSGPs the less expressive mean deliberately: a linear mean's per-feature slopes absorb the shared trend, which pre-explains the signal and, due to local optima, collapses the amortized codes onto the prior, whereas a scalar intercept is code-independent and cannot. The LSGP ablation has no codes to collapse, so it keeps the more expressive mean. One Monte Carlo code sample is drawn per step in every model; the two sparse-variational models additionally draw 10 samples of the latent function , conditional on that single code, to estimate their reconstruction term—a term the Pólya-Gamma bound does not sample, being closed form in once the codes and the auxiliary variables are fixed. The inner CAVI sweeps ( ) belong to the two models optimizing the Pólya-Gamma bound—the deployed model and the LSGP ablation—the factorized bound and the sparse-variational model having no E-step.
We evaluate the LSGP against the two extremes it bridges, alongside targeted controls that isolate specific model capabilities; each model's search space follows.
• PG-LSGP (Structured ): Grid-searched over the crossing of amplitude scaling with warping,
each further crossed with whether the amortized encoder's own copy of the input features is re-centered from to before it sees them (the kernel itself always sees the untouched features). This hyperparameter axis was motivated by preliminary experiments on synthetic data, which revealed that the amortized DeepSet encoder can otherwise collapse to the prior when processing strictly non-negative inputs.
• PG-LSGP (Factorized ): Uses the factorized bound over the same and encoder-input grid as the structured model.
• SV-LSGP: Sparse-variational bound comparing mean-field vs. amortized (diagonal covariance, 10 latent-function samples per step), over the same and encoder-input grid.
• LSGP Ablation ( ): Retains the full model's variational bound, inducing points, and optimizer, but pools across patients. Switching the similarity channel off makes the codes inert, so this variant drops the amortized code posterior for a mean-field one, needs no gradient clipping, and takes the default linear mean. It additionally searches , held fixed by the personalized variants, which makes it the natural shared-GP reference rather than a single-factor ablation.
• Logistic Regression Baselines (LR / VB-LR / EB-LR): -regularized logistic regression, with variational (VB-LR) and empirical-Bayes (EB-LR, via type-II maximum likelihood with a Laplace approximation) variants. Fitting each both nomothetically and idiographically captures the trade-off between masking individual dynamics and overfitting data-sparse patients (Apx. A). Evaluated in both modes without early stopping to ensure convergence rather than relying on default library iteration limits (tol = 0 for standard LR; 5,000 iterations for VB-LR and EB-LR). Hyperparameter grids comprise:
– Standard LR: Inverse regularization strength .
– Variational Bayes LR (VB-LR): Gamma prior shape and rate .
– Empirical Bayes LR (EB-LR): Initial precision .
- Tree Baselines (GBM / RF): Gradient-boosted decision trees and random forests fitted at the cohort level. Because the input covariance is linear, these test for non-linear structure its input kernel omits. Evaluated in nomothetic mode using HistGradientBoostingClassifier (300 boosting rounds, no early stopping or withheld validation split; max_leaf_nodes , learning_rate ) and RandomForestClassifier (300 trees, inverse-frequency class weighting; max_depth , min_samples_leaf ).
• Hierarchical LR Baselines: We evaluate mixed-effects logistic regression as the standard bridge between nomothetic and idiographic modeling in clinical psychology, in two variants: a random-intercept model (intercept) and a full random-intercept-and-slopes model (intercept+slopes). The generative process, notation, and function-space (GP) form of both variants are given in Apx. B. We fix the fixed-effect prior scale to and grid-search the log-scale variance component prior , which dictates the strength of hierarchical pooling across patients. Models are fit via mean-field variational inference using the statsmodels [64] Bayesian mixed GLM implementation.
- Base-Rate Baselines: A featureless baseline that ignores survey responses entirely, separating identifying high-risk individuals from forecasting temporal risk within a patient: a prediction constant within a patient gives an uninformative temporal ranking yet can score well pooled, so a model matching its pooled metrics is merely stratifying patients rather than forecasting their dynamics. It predicts smoothed event rates derived from a conjugate Beta-Binomial prior Beta( , ), where is the global training prevalence and acts as a prior pseudocount. The predictive rate is the posterior mean:
for patient event count and survey count . In nomothetic mode (Nomothetic Base-Rate in the figures), data is pooled so that every patient receives the uniform global prevalence . In idiographic mode (Idiographic Base-Rate), shrinks individual rates toward , with either grid-searched over or fit via empirical Bayes maximizing the Beta-Binomial marginal likelihood:
(124)
written with rather than the Beta function so that Beta refers only to the prior distribution.
G ADDITIONAL RESULTS
Structured Bound Behavior and Factorized Baselines. While Thm. 2 proves that the factorized bound carries an explicit optimization penalty that vanishes only at the all-ones similarity (actively pulling inference toward personalization collapse), it makes no such prediction for the structured bound. The structured objective eliminates this artificial penalty, allowing the model to either personalize or collapse strictly as dictated by the data likelihood. On this cohort, structured variants can also reach personalization collapse, ; for example, the selected structured SV variant collapses at (Fig. 5). We interpret this behavior through three distinct mechanisms:
-
Data Homogeneity: A collapsing structured variant does not contradict our theoretical framework. In a cohort where 81.7% of patients experience no SREs, individual trajectories may lack sufficient heterogeneity to warrant personalization, rendering the nomothetic model likelihood-optimal. Crucially, Thms. 1 and 2 demonstrate that an all-ones similarity matrix is far more credible under the structured bound: because the structured objective contains no variational penalty favoring collapse, an all-ones matrix reflects a less confounded, likelihood-driven outcome rather than an artifact of mean-field optimization.
-
Optimization Artifacts in Baselines: Factorized references achieve substantially lower per-patient LL than structured variants, indicating convergence to local minima away from the global optimum analyzed in Thm. 1. Consequently, lower MODS in factorized baselines may reflect optimization noise rather than genuine personalization missed by the structured bound. Furthermore, the low-prevalence LL dynamics (Result 6.1) prevent using log-likelihood alone to rank these fits.
-
Likelihood as the Training Signal: Both bounds are maximized as surrogates for the marginal likelihood, and Result 6.1 shows that on this cohort the likelihood barely distinguishes a model that forecasts within a patient from one that matches the prevalence: a constant predictor is already near the best LL any model attains. The training objective therefore exerts little pull toward personalization for either bound, and a small residual gain in likelihood from personalizing can be outweighed by the KL cost of the codes. Under such an objective the structured bound is free to collapse, and a metric that rewarded within-patient discrimination directly might not collapse where LL does.
Definitively separating data-driven collapse from optimization local minima requires an exact optimum-versus-optimum comparison on real-world cohorts, which we leave to future work.

Reference (PG-LSGP - ...)
PG-LSGP — Factorized q(U)
SV-LSGP — Structured q(U | Z)
SV-LSGP — Factorized q(U)
Better than PG-LSGP
Worse than PG-LSGP
Figure 5: Paired comparison of the structured PG-LSGP against the factorized and SV variants on the EMA data. This plot is similar to Fig. 2: each marker is the mean paired per-patient difference (best-validated structured PG-LSGP minus the best-validated member of each reference family at each h), with thick and thin bars spanning and paired standard errors; the MODS panel shows each method's own similarity. Within the PG bound, adopting the structured over the factorized variational family improves per-patient LL by more than two paired standard errors at every h, reflecting superior predictive calibration, while per-patient AP differences remain largely within noise; the within-SV contrast is mixed. In the MODS panel, the factorized PG variant sits closer to collapse than the structured one at every h, yet the selected structured SV variant itself collapses at h = 0.8—neither class of models consistently exhibits personalization collapse (Apx. G). Still, employing the structured family provides critical theoretical safeguards: it eliminates the optimization penalty against non-nomothetic fits, guaranteeing that any collapse is likelihood-driven rather than an artifact of the variational family.

Figure 6: Combined similarity ( ) across the full cohort (N = 497). Extending Fig. 3 to every patient, across all training fractions h. Patients with training-window SREs exhibit distinct, well-defined similarity structures, while the remaining patients display less differentiated similarity, as the absence of positive training labels limits the model’s ability to resolve fine-grained boundaries among lower-risk trajectories.
Gender Identity

Sexual Orientation
Highest Completed Education
Marital Status

man
non-binary/gender non-conforming
transgender man
transgender woman
woman
other
unknown
asexual
bisexual
gay/lesbian
questioning or unsure
straight
prefer not to answer
other
unknown
elementary
middle school
hs
hs+
post hs certificate
two yr college
four yr college
grad
unknown
living with partner, unmarried
married
separated or divorced
single, never married
unknown
Figure 7: Patient similarity graphs for the training-event cohort: demographic information does not explain patient similarity. Nodes represent patients who experienced an SRE during their training window. Edge thickness reflects the learned combined similarity . For legibility, only the strongest edges are drawn: a single similarity threshold, shared across all panels so that an edge means the same similarity everywhere, is chosen so that each panel shows about six edges per patient. Graph modularity Q and permutation p-values are computed on the complete similarity matrix before this pruning. Rows correspond to training fractions , each showing the variant with the highest validation per-patient AP at the restart selected on validation log-likelihood; columns correspond to demographic attributes (node colors).