-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_all.sh
executable file
·205 lines (169 loc) · 6.58 KB
/
run_all.sh
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# This script runs all the experiments performed for BioMON. It is recommended to run this script on a server with a GPU.
# Authors: Manos Chatzakis (emmanouil.chatzakis@epfl.ch), Lluka Stojollari (lluka.stojollari@epfl.ch)
# To make this script runnable: $chmod u+x run_all.sh
N_WAY=5
N_SHOT=5
N_QUERY=15
EPOCHS=30
EPISODES=50
EXP_NAME=t
echo "========= BioMON Experiment Script ========="
echo ">> This script runs all the experiments performed for BioMON. It is recommended to run this script on a server with a GPU."
echo ">> Authors: Manos Chatzakis (emmanouil.chatzakis@epfl.ch) Lluka Stojollari (lluka.stojollari@epfl.ch)"
echo ">> Note: Make sure you have Swissprot downloaded and unzipped in the data folder."
echo ">> Epochs: $EPOCHS, Episodes: $EPISODES, N-way: $N_WAY, N-shot: $N_SHOT, N-query: $N_QUERY"
echo ""
run_benchmark_algorithms(){
dataset_name=$1
backbone_name=$2
backbone_target=$3
layer_dim=$4
echo " Dataset: $dataset_name, Backbone: ($backbone_target, $layer_dim)"
for method in "maml" "protonet" "matchingnet" "baseline" "baseline_pp"
do
model_name=${method}.yaml
python3 run.py exp.name=$EXP_NAME \
method=$model_name \
model=$backbone_name \
dataset=$dataset_name \
backbone._target_=$backbone_target \
backbone.layer_dim=$layer_dim \
n_way=$N_WAY \
n_shot=$N_SHOT \
n_query=$N_QUERY \
iter_num=$EPISODES \
method.stop_epoch=$EPOCHS \
method.start_epoch=0
done
}
run_bioMON_simple_classifiers(){
dataset_name=$1
backbone_name=$2
backbone_target=$3
layer_dim=$4
echo " Dataset: $dataset_name, Backbone: ($backbone_target, $layer_dim)"
for classifier in "SVM" "LR" "DT" "NB" "GMM"
do
model_name=bioMON_${classifier}.yaml
python3 run.py exp.name=$EXP_NAME \
method=$model_name \
model=$backbone_name \
dataset=$dataset_name \
backbone._target_=$backbone_target \
backbone.layer_dim=$layer_dim \
n_way=$N_WAY \
n_shot=$N_SHOT \
n_query=$N_QUERY \
iter_num=$EPISODES \
method.stop_epoch=$EPOCHS \
method.start_epoch=0
done
}
run_bioMON_KNN() {
dataset_name=$1
backbone_name=$2
backbone_target=$3
layer_dim=$4
echo " Dataset: $dataset_name, Backbone: ($backbone_target, $layer_dim)"
for classifier in "1NN" "2NN" "3NN" "4NN" "5NN"
do
model_name=bioMON_${classifier}.yaml
python3 run.py exp.name=$EXP_NAME \
method=$model_name \
model=$backbone_name \
dataset=$dataset_name \
backbone._target_=$backbone_target \
backbone.layer_dim=$layer_dim \
n_way=$N_WAY \
n_shot=$N_SHOT \
n_query=$N_QUERY \
iter_num=$EPISODES \
method.stop_epoch=$EPOCHS \
method.start_epoch=0
done
}
run_bioMON_RF() {
dataset_name=$1
backbone_name=$2
backbone_target=$3
layer_dim=$4
echo " Dataset: $dataset_name, Backbone: ($backbone_target, $layer_dim)"
for classifier in "RF10" "RF50" "RF100"
do
model_name=bioMON_${classifier}.yaml
python3 run.py exp.name=$EXP_NAME \
method=$model_name \
model=$backbone_name \
dataset=$dataset_name \
backbone._target_=$backbone_target \
backbone.layer_dim=$layer_dim \
n_way=$N_WAY \
n_shot=$N_SHOT \
n_query=$N_QUERY \
iter_num=$EPISODES \
method.stop_epoch=$EPOCHS \
method.start_epoch=0
done
}
run_bioMON_MLP() {
dataset_name=$1
backbone_name=$2
backbone_target=$3
layer_dim=$4
echo " Dataset: $dataset_name, Backbone: ($backbone_target, $layer_dim)"
for epoch in "1" "5" "10" "15"
do
for layer in "512-256-128-64" "256-64-64" "128-64"
do
model_name=bioMON_MLP_e${epoch}_l${layer}.yaml
python3 run.py exp.name=$EXP_NAME \
method=$model_name \
model=$backbone_name \
dataset=$dataset_name \
backbone._target_=$backbone_target \
backbone.layer_dim=$layer_dim \
n_way=$N_WAY \
n_shot=$N_SHOT \
n_query=$N_QUERY \
iter_num=$EPISODES \
method.stop_epoch=$EPOCHS \
method.start_epoch=0
done
done
}
fcnet_target=backbones.fcnet.FCNet
fcnet_name=FCNet
r2d2_target=backbones.r2d2.R2D2
r2d2_name=R2D2
echo "========= Running all experiments for Swissprot ========="
fcnet_layer_dim=[512,512]
r2d2_layer_dim=[512,512]
run_benchmark_algorithms "swissprot" $fcnet_name $fcnet_target $fcnet_layer_dim
run_bioMON_simple_classifiers "swissprot" $fcnet_name $fcnet_target $fcnet_layer_dim
run_bioMON_KNN "swissprot" $fcnet_name $fcnet_target $fcnet_layer_dim
run_bioMON_RF "swissprot" $fcnet_name $fcnet_target $fcnet_layer_dim
run_bioMON_MLP "swissprot" $fcnet_name $fcnet_target $fcnet_layer_dim
run_benchmark_algorithms "swissprot" $r2d2_name $r2d2_target $r2d2_layer_dim
run_bioMON_simple_classifiers "swissprot" $r2d2_name $r2d2_target $r2d2_layer_dim
run_bioMON_KNN "swissprot" $r2d2_name $r2d2_target $r2d2_layer_dim
run_bioMON_RF "swissprot" $r2d2_name $r2d2_target $r2d2_layer_dim
run_bioMON_MLP "swissprot" $r2d2_name $r2d2_target $r2d2_layer_dim
echo ""
echo "========= Running all experiments for tabula_muris ========="
fcnet_layer_dim=[64,64]
r2d2_layer_dim=[64,64]
run_benchmark_algorithms "tabula_muris" $fcnet_name $fcnet_target $fcnet_layer_dim
run_bioMON_simple_classifiers "tabula_muris" $fcnet_name $fcnet_target $fcnet_layer_dim
run_bioMON_KNN "tabula_muris" $fcnet_name $fcnet_target $fcnet_layer_dim
run_bioMON_RF "tabula_muris" $fcnet_name $fcnet_target $fcnet_layer_dim
run_bioMON_MLP "tabula_muris" $fcnet_name $fcnet_target $fcnet_layer_dim # Pending
run_benchmark_algorithms "tabula_muris" $r2d2_name $r2d2_target $r2d2_layer_dim
run_bioMON_simple_classifiers "tabula_muris" $r2d2_name $r2d2_target $r2d2_layer_dim
run_bioMON_KNN "tabula_muris" $r2d2_name $r2d2_target $r2d2_layer_dim
run_bioMON_RF "tabula_muris" $r2d2_name $r2d2_target $r2d2_layer_dim
run_bioMON_MLP "tabula_muris" $r2d2_name $r2d2_target $r2d2_layer_dim
echo ""
echo ""
echo "========= Script completed. Reporting. ========="
echo ">> The results of all experiments are placed under ./results/final/"
echo ">> To generate the graphs, run the notebook bioMON.ipynb"