-
Notifications
You must be signed in to change notification settings - Fork 12
/
runtime.py
60 lines (49 loc) · 1.5 KB
/
runtime.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# from sklearn.manifold import TSNE
from MulticoreTSNE import MulticoreTSNE as TSNE
from umap import UMAP
from umato import UMATO
import argparse
import os
import numpy as np
from scipy.stats import loguniform
from .models.dataset import get_data, save_csv
import time
parser = argparse.ArgumentParser(description="t-SNE embedding")
parser.add_argument("--data", type=str, help="choose dataset", required=True)
args = parser.parse_args()
if __name__ == "__main__":
# read data
x, label = get_data(args.data)
# # run TSNE
# times = []
# for i in range(10):
# print(f"TSNE {i} th run")
# t1 = time.time()
# y = TSNE(n_jobs=40).fit_transform(x)
# t2 = time.time()
# times.append(t2-t1)
# print("="*80)
# print(f"tsne mean: {np.mean(times)}")
# print(f"tsne std: {np.std(times)}")
# # run UMAP
# times = []
# for i in range(10):
# print(f"UMAP {i} th run")
# t1 = time.time()
# y = UMAP().fit_transform(x)
# t2 = time.time()
# times.append(t2-t1)
# print("="*80)
# print(f"umap mean: {np.mean(times)}")
# print(f"umap std: {np.std(times)}")
# run UMATO
times = []
for i in range(10):
print(f"UMATO {i} th run")
t1 = time.time()
y = UMATO(ll=label, hub_num=300, verbose=False).fit_transform(x)
t2 = time.time()
times.append(t2-t1)
print("="*80)
print(f"umato mean: {np.mean(times)}")
print(f"umato std: {np.std(times)}")