-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_figures.sh
executable file
·239 lines (219 loc) · 11.6 KB
/
generate_figures.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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# exit when any command fails
set -e
# keep track of the last executed command
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
# First argument is the figure number
figure_number="$1"
dataset="$2"
mode="$3" # s for stochastic and d for deterministic
cost_matrix_type="$4" # sn for small network and 'ed' for naive Euclidean distance based
if [[ $figure_number = "4b" ]] || [[ -z $figure_number ]]; then
echo "-------------Generating data and plots for R^2 grid search estimation-------------"
if [[ $dataset = "synthetic" ]] || [[ -z $dataset ]]; then
echo "$dataset = synthetic"
if [[ $mode = "d" ]] || [[ -z $mode ]]; then
echo "mode = deterministic"
if [[ $cost_matrix_type = "eu" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Euclidean"
python inference/rsquared_analysis.py -data synthetic -d 0 -bmax 1400000 -n 100 -hide
fi
if [[ $cost_matrix_type = "sn" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Transportation network"
python inference/rsquared_analysis.py -data synthetic -d 0 -bmax 1400000 -n 100 -cm sn -hide
fi
fi
if [[ $mode = "s" ]] || [[ -z $mode ]]; then
echo "mode = stochastic"
if [[ $cost_matrix_type = "eu" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Euclidean"
python inference/rsquared_analysis.py -data synthetic -d 0.00617494255748621 -bmax 1400000 -n 100 -hide
fi
if [[ $cost_matrix_type = "sn" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Transportation network"
python inference/rsquared_analysis.py -data synthetic -d 0.00617494255748621 -bmax 1400000 -n 100 -cm sn -hide
fi
fi
fi
if [[ $dataset = "retail" ]] || [[ -z $dataset ]]; then
echo "$dataset = retail"
if [[ $mode = "d" ]] || [[ -z $mode ]]; then
echo "mode = deterministic"
if [[ $cost_matrix_type = "eu" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Euclidean"
python inference/rsquared_analysis.py -data retail -d 0 -bmax 1400000 -n 1000 -hide
fi
if [[ $cost_matrix_type = "sn" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Transportation network"
python inference/rsquared_analysis.py -data retail -d 0 -bmax 1400000 -n 1000 -cm sn -hide
fi
fi
if [[ $mode = "s" ]] || [[ -z $mode ]]; then
echo "mode = stochastic"
if [[ $cost_matrix_type = "eu" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Euclidean"
python inference/rsquared_analysis.py -data retail -d 0.00617494255748621 -bmax 1400000 -n 1000 -hide
fi
if [[ $cost_matrix_type = "sn" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Transportation network"
python inference/rsquared_analysis.py -data retail -d 0.00617494255748621 -bmax 1400000 -n 1000 -cm sn -hide
fi
fi
fi
if [[ $dataset = "commuter_ward" ]] || [[ -z $dataset ]]; then
echo "$dataset = commuter_ward"
if [[ $mode = "d" ]] || [[ -z $mode ]]; then
echo "mode = deterministic"
if [[ $cost_matrix_type = "eu" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Euclidean"
python inference/rsquared_analysis.py -data commuter_ward -d 0 -bmax 1000000 -n 1000 -hide
fi
if [[ $cost_matrix_type = "sn" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Transportation network"
python inference/rsquared_analysis.py -data commuter_ward -d 0 -bmax 1000000 -n 1000 -cm sn -hide
fi
fi
if [[ $mode = "s" ]] || [[ -z $mode ]]; then
echo "mode = stochastic"
if [[ $cost_matrix_type = "eu" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Euclidean"
python inference/rsquared_analysis.py -data commuter_ward -d 0.01178781925343811 -bmax 1000000 -n 1000 -hide
fi
if [[ $cost_matrix_type = "sn" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Transportation network"
python inference/rsquared_analysis.py -data commuter_ward -d 0.01178781925343811 -bmax 1000000 -n 1000 -cm sn -hide
fi
fi
fi
if [[ $dataset = "commuter_borough" ]] || [[ -z $dataset ]]; then
echo "$dataset = commuter_borough"
if [[ $mode = "d" ]] || [[ -z $mode ]]; then
echo "mode = deterministic"
if [[ $cost_matrix_type = "eu" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Euclidean"
python inference/rsquared_analysis.py -data commuter_borough -d 0 -bmax 1000000 -n 1000 -hide
fi
if [[ $cost_matrix_type = "sn" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Transportation network"
python inference/rsquared_analysis.py -data commuter_borough -d 0 -bmax 1000000 -n 1000 -cm sn -hide
fi
fi
if [[ $mode = "s" ]] || [[ -z $mode ]]; then
echo "mode = stochastic"
if [[ $cost_matrix_type = "eu" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Euclidean"
python inference/rsquared_analysis.py -data commuter_borough -d 0.01178781925343811 -bmax 1000000 -n 1000 -hide
fi
if [[ $cost_matrix_type = "sn" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Transportation network"
python inference/rsquared_analysis.py -data commuter_borough -d 0.01178781925343811 -bmax 1000000 -n 1000 -cm sn -hide
fi
fi
fi
echo "----------------------------------------------------------------------------------------------------"
printf "\n"
fi
if [[ $figure_number = "4c" ]] || [[ -z $figure_number ]]; then
echo "-------------Generating data and plots for log-likelihood grid search estimation using Laplace approximation-------------"
if [[ $dataset = "retail" ]] || [[ -z $dataset ]]; then
echo "$dataset = retail"
if [[ $mode = "d" ]] || [[ -z $mode ]]; then
echo "mode = deterministic"
if [[ $cost_matrix_type = "eu" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Euclidean"
python inference/laplace_analysis.py -data retail -d 0.00617494255748621 -bmax 1400000 -g 100 -hide
fi
if [[ $cost_matrix_type = "sn" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Transportation network"
python inference/laplace_analysis.py -data retail -d 0.00617494255748621 -bmax 1400000 -g 100 -cm sn -hide
fi
fi
if [[ $mode = "s" ]] || [[ -z $mode ]]; then
echo "mode = stochastic"
if [[ $cost_matrix_type = "eu" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Euclidean"
python inference/laplace_analysis.py -data retail -d 0.00617494255748621 -bmax 1400000 -g 10000 -hide
fi
if [[ $cost_matrix_type = "sn" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Transportation network"
python inference/laplace_analysis.py -data retail -d 0.00617494255748621 -bmax 1400000 -g 10000 -cm sn -hide
fi
fi
fi
if [[ $dataset = "commuter_ward" ]] || [[ -z $dataset ]]; then
echo "$dataset = commuter_ward"
if [[ $mode = "d" ]] || [[ -z $mode ]]; then
echo "mode = deterministic"
if [[ $cost_matrix_type = "eu" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Euclidean"
python inference/laplace_analysis.py -data commuter_ward -d 0.01178781925343811 -bmax 1400000 -g 10000 -hide # or bmax 71260
fi
if [[ $cost_matrix_type = "sn" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Transportation network"
python inference/laplace_analysis.py -data commuter_ward -d 0.01178781925343811 -bmax 1400000 -g 10000 -cm sn -hide # or bmax 71260
fi
fi
if [[ $mode = "s" ]] || [[ -z $mode ]]; then
echo "mode = stochastic"
if [[ $cost_matrix_type = "eu" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Euclidean"
python inference/laplace_analysis.py -data commuter_ward -d 0.01178781925343811 -bmax 1400000 -g 100 -hide# or bmax 71260
fi
if [[ $cost_matrix_type = "sn" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Transportation network"
python inference/laplace_analysis.py -data commuter_ward -d 0.01178781925343811 -bmax 1400000 -g 100 -hide# or bmax 71260
fi
fi
fi
if [[ $dataset = "commuter_borough" ]] || [[ -z $dataset ]]; then
echo "$dataset = commuter_borough"
if [[ $mode = "d" ]] || [[ -z $mode ]]; then
echo "mode = deterministic"
if [[ $cost_matrix_type = "eu" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Euclidean"
python inference/laplace_analysis.py -data commuter_borough -d 0.01178781925343811 -bmax 1400000 -g 10000 -hide # or bmax 71260
fi
if [[ $cost_matrix_type = "sn" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Transportation network"
python inference/laplace_analysis.py -data commuter_borough -d 0.01178781925343811 -bmax 1400000 -g 10000 -hide # or bmax 71260
fi
fi
if [[ $mode = "s" ]] || [[ -z $mode ]]; then
echo "mode = stochastic"
if [[ $cost_matrix_type = "eu" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Euclidean"
python inference/laplace_analysis.py -data commuter_borough -d 0.01178781925343811 -bmax 1400000 -g 100 -hide # or bmax 71260
fi
if [[ $cost_matrix_type = "sn" ]] || [[ -z $cost_matrix_type ]]; then
echo "cost matrix = Transportation network"
python inference/laplace_analysis.py -data commuter_borough -d 0.01178781925343811 -bmax 1400000 -g 100 -hide # or bmax 71260
fi
fi
fi
echo "----------------------------------------------------------------------------------------------------"
printf "\n"
fi
if [[ $figure_number = "6" ]] || [[ -z $figure_number ]]; then
echo "-------------Generating data for latent posterior optimisation-------------"
if [[ $dataset = "retail" ]] || [[ -z $dataset ]]; then
echo "$dataset = retail"
python inference/optimise_latent_posterior.py -data retail -d 0.00617494255748621 -a 0.5 -b 210000 -g 10000 -hide
python inference/optimise_latent_posterior.py -data retail -d 0.00617494255748621 -a 1.0 -b 210000 -g 10000 -hide
python inference/optimise_latent_posterior.py -data retail -d 0.00617494255748621 -a 1.5 -b 210000 -g 10000 -hide
python inference/optimise_latent_posterior.py -data retail -d 0.00617494255748621 -a 2.0 -b 210000 -g 10000 -hide
fi
if [[ $dataset = "commuter_ward" ]] || [[ -z $dataset ]]; then
echo "$dataset = commuter_ward"
python inference/optimise_latent_posterior.py -data commuter_ward -d 0.01178781925343811 -a 0.5 -b 210000 -g 10000 -hide
python inference/optimise_latent_posterior.py -data commuter_ward -d 0.01178781925343811 -a 1.0 -b 210000 -g 10000 -hide
python inference/optimise_latent_posterior.py -data commuter_ward -d 0.01178781925343811 -a 1.5 -b 210000 -g 10000 -hide
python inference/optimise_latent_posterior.py -data commuter_ward -d 0.01178781925343811 -a 2.0 -b 210000 -g 10000 -hide
fi
if [[ $dataset = "commuter_borough" ]] || [[ -z $dataset ]]; then
echo "$dataset = commuter_borough"
python inference/optimise_latent_posterior.py -data commuter_borough -d 0.01178781925343811 -a 0.5 -b 210000 -g 10000 -hide
python inference/optimise_latent_posterior.py -data commuter_borough -d 0.01178781925343811 -a 1.0 -b 210000 -g 10000 -hide
python inference/optimise_latent_posterior.py -data commuter_borough -d 0.01178781925343811 -a 1.5 -b 210000 -g 10000 -hide
python inference/optimise_latent_posterior.py -data commuter_borough -d 0.01178781925343811 -a 2.0 -b 210000 -g 10000 -hide
fi
echo "---------------------------------------------------------------------------"
fi