For each feature, computes the sample-by-sample cosine similarity between
its embedding vectors in the different samples. One minus this matrix is the
feature-specific sample distance \(D_f\) whose lower triangle forms the
feature's stratification profile in unsupervised subgroup detection; the
matrices can also be passed to plot_mds_cluster to visualize
how a feature's embedding varies across samples.
Arguments
- mosaic_embed_list
Named list of per-sample embedding matrices (features x latent dimensions), as returned by
run_MOSAIC()$mosaic_embed_list.- feature_idx
Optional integer vector of features (row indices). By default all features are used.
Value
A list with one symmetric n_samples x n_samples cosine similarity matrix per feature, named by feature. A zero embedding vector has similarity 0 to every other sample.