-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_runs.py
174 lines (169 loc) · 6.19 KB
/
make_runs.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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
"""
Builds runs table for snakemake
"""
import os
import pandas as pd
import numpy as np
def build_runs():
seeds = 10
dataset = 'mnist'
prefix = '/data/atong/anomaly/'
model_types = ['rcae', 'conv', 'dcae',
#'lipschitz_gp',
# 'shallow_isolation_forest',
# 'shallow_ocsvm',
# 'shallow_lof',
# 'lipschitz_gp_long',
#'lipschitz_gp_high_noise',
#'lipschitz_gp_higher_noise',
#'lipschitz_gp_big_high_noise',
#'lipschitz_gp_beta_zero',
#'lipschitz_gp_beta_zero_long',
# 'lipschitz_gp_big',
# 'lipschitz_gp_dense',
#'lipschitz_gp_spectral',
#'lipschitz_spectral_conv',
#'lipschitz_gp_patches',
#'lipschitz_gp_patches_small',
#'lipschitz_gp_patches_noise',
'dsvdd',
]
# model_types = ['lipschitz_gp']
num_sevens = range(0, 501, 100)
#num_sevens = range(0, 501, 20)
batch_size = 128
num_batches = 20000
data = []
for i in range(seeds):
for ns in num_sevens:
for model_type in model_types:
path = os.path.join(prefix, dataset, model_type,
str(i), str(ns), 'model.json')
data.append([5000 - ns, ns, i, dataset, batch_size,
num_batches, path])
columns = ['num_fives', 'num_sevens', 'seed', 'dataset',
'batch_size', 'num_batches', 'path']
return pd.DataFrame(data, columns=columns)
def build_runs2():
seeds = 3
dataset = 'mnist2'
prefix = '/home/atong/data/anomaly/'
model_types = [
'shallow_isolation_forest',
'shallow_ocsvm',
'shallow_lof',
'rcae',
'conv',
'dcae',
# 'shallow_isolation_forest',
# 'shallow_ocsvm',
# 'shallow_lof',
# 'lipschitz_gp_beta_zero',
#'lipschitz_spectral_dense',
#'lipschitz_spectral_conv',
# 'lipschitz_gp_spectral',
'lipschitz_gp_patches',
# 'lipschitz_spectral_patches',
# 'lipschitz_gp_patches_small',
# 'lipschitz_gp_patches_noise',
'dsvdd',
'ALOCC',
]
digits = range(10)
percent_corrupt = np.linspace(0, 0.1, 11)
batch_size = 128
num_batches = 20000
data = []
for i in range(seeds):
for pc in percent_corrupt:
#for pc in [0]:
for d in digits:
for model_type in model_types:
path = os.path.join(prefix, dataset, model_type,
str(d), str(i), '%0.2f' % pc, 'model.json')
data.append([d, pc, i, dataset, batch_size,
num_batches, path])
columns = ['digit', 'percent_corrupt', 'seed', 'dataset',
'batch_size', 'num_batches', 'path']
return pd.DataFrame(data, columns=columns)
def build_runs3():
seeds = 3
dataset = 'vacs2'
prefix = '/home/atong/data/anomaly/'
model_types = ['lipschitz_gp_dense_vacs',
'dsvdd_dense',
'dense_ae',
'dense_dae',
'dense_rae',
'dense_alocc',
'shallow_isolation_forest',
'shallow_ocsvm',
'shallow_lof']
percent_corrupt = np.linspace(0, 0.03, 11)
batch_size = 128
num_batches = 20000
data = []
d = 0
for i in range(seeds):
for pc in percent_corrupt:
#for pc in [0]:
for model_type in model_types:
path = os.path.join(prefix, dataset, model_type,
str(d), str(i), '%0.3f' % pc, 'model.json')
data.append([d, pc, i, dataset, batch_size,
num_batches, path])
columns = ['digit', 'percent_corrupt', 'seed', 'dataset',
'batch_size', 'num_batches', 'path']
return pd.DataFrame(data, columns=columns)
def build_cifar():
seeds = 3
dataset = 'cifar2'
prefix = '/home/atong/data/anomaly/'
model_types = [
'shallow_isolation_forest',
'shallow_ocsvm',
'shallow_lof',
'rcae',
'conv',
'dcae',
# 'shallow_isolation_forest',
# 'shallow_ocsvm',
# 'shallow_lof',
# 'lipschitz_gp_beta_zero',
#'lipschitz_spectral_dense',
#'lipschitz_spectral_conv',
# 'lipschitz_gp_spectral',
'lipschitz_gp_patches',
# 'lipschitz_spectral_patches',
# 'lipschitz_gp_patches_small',
# 'lipschitz_gp_patches_noise',
'dsvdd',
'ALOCC',
]
digits = range(10)
percent_corrupt = np.linspace(0, 0.1, 11)
batch_size = 256
num_batches = 60000
data = []
for i in range(seeds):
for pc in percent_corrupt:
#for pc in [0]:
for d in digits:
for model_type in model_types:
path = os.path.join(prefix, dataset, model_type,
str(d), str(i), '%0.2f' % pc, 'model.json')
data.append([d, pc, i, dataset, batch_size,
num_batches, path])
columns = ['digit', 'percent_corrupt', 'seed', 'dataset',
'batch_size', 'num_batches', 'path']
return pd.DataFrame(data, columns=columns)
if __name__ == '__main__':
runs = build_runs2()
runs.to_csv('runs/spectral_runs2.csv', index=False)
runs = build_runs3()
#runs = build_runs()
print(runs.shape)
runs.to_csv('runs/vacs_runs.csv', index=False)
runs = build_cifar()
runs.to_csv('runs/cifar_runs.csv', index=False)
print(runs.head())