-
Notifications
You must be signed in to change notification settings - Fork 0
/
dimensionality_reduction.py
60 lines (51 loc) · 1.3 KB
/
dimensionality_reduction.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.decomposition import PCA
from umap import UMAP
from modules.utils.general_utils.embedding_handlers import reduce_dimensions
##############################################################################
# we specify the number of temporal steps we want to embed
SNAPSHOTS = [snapshot for snapshot in range(10)]
COMPONENTS = [2, 3, 10]
PATH = 'results\\saved_emb\\'
NAME = 'td_mlp_eng_emb'
reduce_dimensions(
reducer={'name': 'pca', 'algo': PCA},
path=PATH,
name=NAME,
snapshots=SNAPSHOTS,
n_components=2,
context_aware=True
)
reduce_dimensions(
reducer={'name': 'umap', 'algo': UMAP},
path=PATH,
name=NAME,
snapshots=SNAPSHOTS,
n_components=10,
verbose=True,
n_neighbors=30,
n_epochs=1000,
min_dist=0,
metric='cosine',
context_aware=True
)
for componets in COMPONENTS:
reduce_dimensions(
reducer={'name': 'pca', 'algo': PCA},
path=PATH,
name=NAME,
snapshots=SNAPSHOTS,
n_components=componets,
)
reduce_dimensions(
reducer={'name': 'umap', 'algo': UMAP},
path=PATH,
name=NAME,
snapshots=SNAPSHOTS,
n_components=componets,
verbose=True,
n_neighbors=100,
n_epochs=1000,
min_dist=0.80,
metric='cosine'
)
#