Extract subject-level features by single PCA
Source:R/initialization_utils.R
extract_subject_features_by_singlePCA.RdThis function applies PCA to the concatenated data across all subjects,
then for each subject i, computes the mean of the top r_dim principal
component scores as a single feature vector. This is useful for initializing
cluster assignments in mixture models.
Value
A numeric matrix of shape (N x r_dim), where N=length(list_of_data).
Each row contains the mean PC scores for one subject.
Details
The function first concatenates all subject data into a single matrix, performs PCA on this combined dataset, and then computes the mean of the PC scores for each subject's time points. This provides a low-dimensional representation of each subject that can be used for clustering initialization.