-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhyper_record.R
115 lines (90 loc) · 3.54 KB
/
hyper_record.R
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
source('impacc_record.R')
source('load_packages.R')
#for (j in c(1:10)){
for (dd in c('yan','goolam','biase','hiseq','darmanis','coil')){
print(dd)
dat=readRDS(paste0('data/',dd,'.rds'))
sc_scale = as.matrix(dat$sc_cnt)
sc_label = dat$sc_label
K=length(unique(sc_label))
if (ncol(sc_scale)<100){
n=0.5
}else{
n=0.25
}
res = list()
hs = c(0.7,0.8,0.9,0.95,0.99)
for (hi in hs){
print(hi)
tic.clearlog()
tic()
css= IMPACC_record(d=sc_scale,K =K, reps=200,h =hi,pItem = n,early_stop = F)
toc(log = TRUE)
labels = lapply(css$record, function(i) IMPACC_cluster(i,K))
res$h[[as.character(hi)]] = sapply(labels, function(i) adjustedRandIndex(i,sc_label))
}
saveRDS(res,paste0('results/hyper_',dd,'.rds'))
ps = c(0.01,0.05,0.1,0.15,0.2)
for (pp in ps){
print(pp)
tic.clearlog()
tic()
css= IMPACC_record(d=sc_scale,K =K, reps=200,pp=pp,pItem = n,early_stop = F)
toc(log = TRUE)
labels = lapply(css$record, function(i) IMPACC_cluster(i,K))
res$ps[[as.character(pp)]] = sapply(labels, function(i) adjustedRandIndex(i,sc_label))
}
saveRDS(res,paste0('results/hyper_',dd,'.rds'))
alphas = seq(0.1,0.9,by=0.1)
for (a in alphas){
tic.clearlog()
tic()
css= IMPACC_record(d=sc_scale,K =K, reps=200,alpha_F =a,pItem = n,early_stop = F)
toc(log = TRUE)
labels = lapply(css$record, function(i) IMPACC_cluster(i,K))
res$alpha_f[[as.character(a)]] = sapply(labels, function(i) adjustedRandIndex(i,sc_label))
}
saveRDS(res,paste0('results/hyper_',dd,'.rds'))
alphas = seq(0.1,0.9,by=0.1)
for (a in alphas){
tic.clearlog()
tic()
css= IMPACC_record(d=sc_scale,K =K, reps=200,alpha_I = a,pItem = n,early_stop = F)
toc(log = TRUE)
labels = lapply(css$record, function(i) IMPACC_cluster(i,K))
res$alpha_i[[as.character(a)]] = sapply(labels, function(i) adjustedRandIndex(i,sc_label))
}
saveRDS(res,paste0('results/hyper_',dd,'.rds'))
qIs = c(0.7,0.8,0.9,0.95,0.99)
for (qq in qIs){
print(qq)
tic.clearlog()
tic()
css= IMPACC_record(d=sc_scale,K =K, reps=200,qI = qq,pItem = n,early_stop = F)
toc(log = TRUE)
labels = lapply(css$record, function(i) IMPACC_cluster(i,K))
res$qI[[as.character(qq)]] = sapply(labels, function(i) adjustedRandIndex(i,sc_label))
}
saveRDS(res,paste0('results/hyper_',dd,'.rds'))
qFs = c(0.9,0.95,0.99,1,1.5,2)
for (qq in qFs){
tic.clearlog()
tic()
css= IMPACC_record(d=sc_scale,K =K, reps=200,qF= qq,pItem = n,early_stop = F)
toc(log = TRUE)
labels = lapply(css$record, function(i) IMPACC_cluster(i,K))
res$qF[[as.character(qq)]] = sapply(labels, function(i) adjustedRandIndex(i,sc_label))
}
saveRDS(res,paste0('results/hyper_',dd,'.rds'))
models = c('EE+prob','EE','prob')
for (m in models){
print(m)
tic.clearlog()
tic()
css= IMPACC_record(d=sc_scale,K =K, reps=200,sample=m,pItem = n,early_stop = F)
toc(log = TRUE)
labels = lapply(css$record, function(i) IMPACC_cluster(i,K))
res$model[[m]] = sapply(labels, function(i) adjustedRandIndex(i,sc_label))
saveRDS(res,paste0('results/hyper_',dd,'.rds'))
}
}