Table of Contents
Introduction
Recurrent spontaneous abortion, also called recurrent pregnancy loss in much of the clinical literature, is a difficult data-analysis problem because the signal is usually distributed across many weak and correlated measurements. A single biomarker is rarely enough. The practical question is instead whether a collection of measurements can reveal stable patterns that help distinguish patient groups, summarize risk, or suggest which biological pathways deserve closer study.
This note records a Bayesian functional-learning approach for analyzing RSA data. The purpose is not to replace clinical judgment, but to describe a reproducible statistical workflow: represent each subject by structured features, learn a lower-dimensional set of shared patterns, and connect those patterns to outcomes or labels with uncertainty preserved.
The main ideas are:
- Treat the observed measurements as noisy functions or high-dimensional profiles rather than isolated scalar variables.
- Learn a compact dictionary of latent patterns shared across subjects.
- Use supervised information, when available, so that the learned representation is useful for classification or prediction.
- Report uncertainty, not only point estimates, because biomedical sample sizes are often limited.
Results
A functional-learning analysis should produce three kinds of results.
First, it should give a low-dimensional representation of each patient. Instead of inspecting hundreds or thousands of raw features, each subject can be summarized by a small vector of latent scores. These scores are easier to visualize with scatter plots, clustering, or posterior credible intervals.
Second, it should identify shared functional patterns. In a dictionary-learning model, these patterns are basis elements. A patient profile is reconstructed by combining a subset of them. If the dictionary is sparse, each subject uses only a few patterns, which makes the representation easier to interpret.
Third, the supervised layer should connect those latent scores to the clinical label or outcome. For example, if the outcome is binary, the model may use logistic regression on the latent scores. If the outcome is continuous, a Gaussian regression layer may be more appropriate. The important point is that prediction is performed on the learned representation rather than directly on the raw high-dimensional data.
A minimal reporting checklist is:
- Cross-validated predictive performance, such as accuracy, AUC, calibration, or mean squared error, depending on the outcome.
- Posterior uncertainty for model parameters and patient-level latent scores.
- Reconstruction diagnostics showing whether the learned dictionary represents the observed profiles well.
- Sensitivity checks for the number of dictionary elements and prior choices.
- A clear separation between exploratory patterns and clinically validated conclusions.
Method
The analysis starts from a matrix of subject-level observations. Let \(X_i\) denote the observed profile for subject \(i\), and let \(y_i\) denote the associated label or outcome. The profile may be a vector of biomarkers, gene-expression measurements, immune indicators, or another structured feature set.
A simple functional representation is:
where \(d_k(t)\) is the \(k\)-th learned dictionary function, \(z_{ik}\) is the subject-specific loading, and \(\epsilon_i(t)\) is residual noise. In vector form, this is:
Here, \(D\) is the dictionary matrix and \(z_i\) is the latent score vector for subject \(i\). Sparsity can be encouraged by priors on \(z_i\), so that each subject is represented by only a small number of active dictionary elements.
For a binary outcome, the supervised layer can be written as:
For a continuous outcome, one can use:
The Bayesian version places priors on \(D\), \(z_i\), \(\beta\), and the variance terms. Posterior inference can then be performed with MCMC, variational inference, or another approximate method, depending on the size of the data.
Functional learning
Functional learning is useful when measurements are naturally ordered or structured. The index \(t\) may represent time, genomic position, frequency, dose, or simply an ordered feature axis. Even when the observations are stored as a table, treating them as a profile can preserve neighborhood information that would be lost in a purely independent-feature model.
A practical workflow is:
- Clean the data and document missingness.
- Normalize features using parameters learned only from the training split.
- Choose an initial number of dictionary elements \(K\).
- Fit the unsupervised reconstruction model.
- Add the supervised outcome model.
- Evaluate prediction and calibration on held-out data.
- Repeat with different values of \(K\) and compare stability.
The model should be checked by reconstructing held-out profiles. If the learned dictionary cannot reconstruct the data, then the supervised result is unlikely to be reliable. If it reconstructs well but predicts poorly, the measured profile may not contain enough information for the chosen outcome.
Supervised dictionary learning
Unsupervised dictionary learning only tries to explain \(X\). Supervised dictionary learning tries to explain \(X\) while also learning a representation that is useful for \(y\). This can be done by fitting the reconstruction model and outcome model jointly:
This joint objective encourages latent scores that are both reconstructive and predictive. In practice, it is important to avoid overfitting, especially when the number of features is much larger than the number of subjects. Regularization, sparsity, cross-validation, and posterior predictive checks are not optional details; they are the core safeguards of the analysis.
Graph neural networks can be considered when the features have a known graph structure, such as interaction networks or pathway relationships. In that case, the graph should be defined from external knowledge or training data only, and the evaluation should confirm that the graph-based model improves over simpler baselines. A graph model is useful only if the structure adds predictive or interpretive value beyond ordinary functional regression or dictionary learning.
The final output of the analysis should be modest: a set of learned patterns, patient-level latent summaries, predictive diagnostics, and uncertainty estimates. Any biological interpretation should be treated as a hypothesis for further validation rather than a clinical conclusion.
