topo.eval.global_scores
Functions
|
|
|
Compute the global score comparing an embedding to PCA. |
|
Compute the global score comparing an embedding to a Laplacian Eigenmap baseline. |
Module Contents
- topo.eval.global_scores.global_loss_(X, Y)
- topo.eval.global_scores.global_score_pca(X, Y, Y_pca=None)
Compute the global score comparing an embedding to PCA.
The score is defined as
exp(-(L_emb - L_pca) / L_pca)whereLdenotes the mean reconstruction error (global loss) of a linear projection. A score of 1 means the embedding preserves as much global structure as PCA; scores below 1 indicate worse global preservation. The result is clipped to [0, 1].- Parameters:
X (array-like of shape (n_samples, n_features) or sparse matrix) – Input feature matrix.
Y (array-like of shape (n_samples, n_components)) – Low-dimensional embedding to evaluate.
Y_pca (array-like of shape (n_samples, n_components), optional) – Pre-computed PCA embedding. If None, computed from
X.
- Returns:
score (float in (0, 1]) – Global structure preservation score relative to PCA.
- topo.eval.global_scores.global_score_laplacian(X, Y, k=10, data_is_graph=False, n_jobs=12, random_state=None)
Compute the global score comparing an embedding to a Laplacian Eigenmap baseline.
The score is defined as
exp(-(L_emb - L_lap) / L_lap)whereLdenotes the mean reconstruction error (global loss) of a linear projection. A score of 1 means the embedding preserves as much global structure as a Laplacian Eigenmap of the same dimension; scores below 1 indicate worse global preservation. The result is clipped to [0, 1].- Parameters:
X (array-like of shape (n_samples, n_features) or sparse (n_samples, n_samples)) – Input feature matrix, or precomputed affinity graph if
data_is_graph=True.Y (array-like of shape (n_samples, n_components)) – Low-dimensional embedding to evaluate.
k (int, default 10) – Number of neighbors used by
SpectralEmbeddingwhendata_is_graph=False.data_is_graph (bool, default False) – If True,
Xis treated as a precomputed affinity graph.n_jobs (int, default 12) – Number of parallel jobs for
SpectralEmbedding.random_state (numpy.random.RandomState or int, optional) – Random state for
SpectralEmbedding.
- Returns:
score (float in (0, 1]) – Global structure preservation score relative to Laplacian Eigenmaps.