Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions experiments/run_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,13 @@ def faster_svm_eval(X, y, n_splits=10, **kwargs):
def random_triplet_eval(X, X_new, num_triplets=5):
'''
This is a function that is used to evaluate the lower dimension embedding.
An triplet satisfaction score is calculated by evaluating how many randomly
A triplet satisfaction score is calculated by evaluating how many randomly
selected triplets have been violated. Each point will generate 5 triplets.
Input:
X: A numpy array with the shape [N, p]. The higher dimension embedding
of some dataset. Expected to have some clusters.
X_new: A numpy array with the shape [N, k]. The lower dimension embedding
of some dataset. Expected to have some clusters as well.
y: A numpy array with the shape [N, 1]. The labels of the original
dataset. Used to identify clusters
Output:
acc: The score generated by the algorithm.
'''
Expand Down Expand Up @@ -249,8 +247,6 @@ def neighbor_kept_ratio_eval(X, X_new, n_neighbors=30):
of some dataset. Expected to have some clusters.
X_new: A numpy array with the shape [N, k]. The lower dimension embedding
of some dataset. Expected to have some clusters as well.
y: A numpy array with the shape [N, 1]. The labels of the original
dataset. Used to identify clusters
Output:
acc: The score generated by the algorithm.

Expand Down Expand Up @@ -468,7 +464,7 @@ def spearman_correlation_eval(X, X_new, n_points=1000, random_seed=100):
'''Evaluate the global structure of an embedding via spearman correlation in
distance matrix, following https://www.nature.com/articles/s41467-019-13056-x
'''
# Fix the random seed to ensure reproducability
# Fix the random seed to ensure reproducibility
rng = np.random.default_rng(seed=random_seed)
dataset_size = X.shape[0]

Expand Down