-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMakefile
311 lines (268 loc) · 8.83 KB
/
Makefile
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
.DEFAULT_GOAL := show-help
SHELL := /bin/bash
PATH := $(PWD)/thirdparty/miniconda/miniconda/bin:$(PATH)
################################################################################
# Utility
################################################################################
## Run the testsuite
test:
@source activate learna && \
pytest . -p no:warnings
## To clean project state
clean: clean-runtime clean-data clean-thirdparty clean-models clean-results clean-analysis
## Remove runtime files
clean-runtime:
find . -name '*.pyc' -exec rm --force {} +
find . -name '__pycache__' -exec rm -rf --force {} +
## Remove data files
clean-data:
rm -rf data/eterna/*.rna
rm -rf data/eterna/raw/*.txt
rm -rf data/eterna/interim/*.txt
rm -rf data/rfam_taneda
rm -rf data/rfam_learn*
## Remove model examples
clean-models:
rm -rf models/example
## Clean results directory
clean-results:
rm -rf results/
clean-plots:
rm -rf results/plots
## Clean analysis directory
clean-analysis:
rm -rf analysis/reproduce_iclr_2019/
## Remove thirdparty installs
clean-thirdparty:
rm -rf thirdparty/miniconda/miniconda
################################################################################
# Setup General
################################################################################
## Download and prepare all datasets
data: data-eterna data-rfam-taneda data-rfam-learn
## Download and make the Eterna100 dataset
data-eterna:
@source activate learna && \
python -m src.data.download_and_build_eterna
./src/data/secondaries_to_single_files.sh data/eterna data/eterna/interim/eterna.txt
## Download and build the Rfam-Taneda dataset
data-rfam-taneda:
@./src/data/download_and_build_rfam_taneda.sh
## Download and build the Rfam-Learn dataset
data-rfam-learn:
@./src/data/download_and_build_rfam_learn.sh
mv data/rfam_learn/test data/rfam_learn_test
mv data/rfam_learn/validation data/rfam_learn_validation
mv data/rfam_learn/train data/rfam_learn_train
rm -rf data/rfam_learn
################################################################################
# Setup LEARNA
################################################################################
## Install all dependencies
requirements:
./thirdparty/miniconda/make_miniconda.sh
conda env create -f environment.yml
################################################################################
# Test Experiment and Example
################################################################################
## Local experiment testing
experiment-test:
@source activate learna && \
python -m src.learna.design_rna \
--mutation_threshold 5 \
--batch_size 126 \
--conv_sizes 17 5 \
--conv_channels 7 18 \
--embedding_size 3 \
--entropy_regularization 6.762991409135427e-05 \
--fc_units 57 \
--learning_rate 0.0005991629320464973 \
--lstm_units 28 \
--num_fc_layers 1 \
--num_lstm_layers 1 \
--reward_exponent 9.33503385734547 \
--state_radius 32 \
--restart_timeout 1800 \
--target_structure_path data/eterna/2.rna \
--timeout 30
################################################################################
# Reproduce Results of LEARNA
################################################################################
## Reproduce LEARNA on <id> (1-100) of Eterna100
reproduce-LEARNA-Eterna-%:
@source activate learna && \
python utils/timed_execution.py \
--timeout 86400 \
--data_dir data/ \
--results_dir results/ \
--experiment_group reproduce_iclr_2019 \
--method LEARNA \
--dataset eterna \
--task_id $*
## Reproduce LEARNA on <id> (1-29) of Rfam-Taneda
reproduce-LEARNA-Rfam-Taneda-%:
@source activate learna && \
python utils/timed_execution.py \
--timeout 600 \
--data_dir data/ \
--results_dir results/ \
--experiment_group reproduce_iclr_2019 \
--method LEARNA \
--dataset rfam_taneda \
--task_id $*
## Reproduce LEARNA-30min on <id> (1-100) of Rfam-Learn-Test
reproduce-LEARNA-Rfam-Learn-Test-%:
@source activate learna && \
python utils/timed_execution.py \
--timeout 3600 \
--data_dir data/ \
--results_dir results/ \
--experiment_group reproduce_iclr_2019 \
--method LEARNA \
--dataset rfam_learn_test \
--task_id $*
################################################################################
# Reproduce Results of Meta-LEARNA
################################################################################
## Reproduce Meta-LEARNA on <id> (1-100) of Eterna100
reproduce-Meta-LEARNA-Eterna-%:
@source activate learna && \
python utils/timed_execution.py \
--timeout 86400 \
--data_dir data/ \
--results_dir results/ \
--experiment_group reproduce_iclr_2019 \
--method Meta-LEARNA \
--dataset eterna \
--task_id $*
## Reproduce Meta-LEARNA on <id> (1-29) of Rfam-Taneda
reproduce-Meta-LEARNA-Rfam-Taneda-%:
@source activate learna && \
python utils/timed_execution.py \
--timeout 600 \
--data_dir data/ \
--results_dir results/ \
--experiment_group reproduce_iclr_2019 \
--method Meta-LEARNA \
--dataset rfam_taneda \
--task_id $*
## Reproduce Meta-LEARNA on <id> (1-100) of Rfam-Learn-Test
reproduce-Meta-LEARNA-Rfam-Learn-Test-%:
@source activate learna && \
python utils/timed_execution.py \
--timeout 3600 \
--data_dir data/ \
--results_dir results/ \
--experiment_group reproduce_iclr_2019 \
--method Meta-LEARNA \
--dataset rfam_learn_test \
--task_id $*
################################################################################
# Reproduce Results of Meta-LEARNA-Adapt
################################################################################
## Reproduce Meta-LEARNA-Adapt on <id> (1-100) of Eterna100
reproduce-Meta-LEARNA-Adapt-Eterna-%:
@source activate learna && \
python utils/timed_execution.py \
--timeout 86400 \
--data_dir data/ \
--results_dir results/ \
--experiment_group reproduce_iclr_2019 \
--method Meta-LEARNA-Adapt \
--dataset eterna \
--task_id $*
## Reproduce Meta-LEARNA-Adapt on <id> (1-29) of Rfam-Taneda
reproduce-Meta-LEARNA-Adapt-Rfam-Taneda-%:
@source activate learna && \
python utils/timed_execution.py \
--timeout 600 \
--data_dir data/ \
--results_dir results/ \
--experiment_group reproduce_iclr_2019 \
--method Meta-LEARNA-Adapt \
--dataset rfam_taneda \
--task_id $*
## Reproduce Meta-LEARNA-Adapt on <id> (1-100) of Rfam-Learn-Test
reproduce-Meta-LEARNA-Adapt-Rfam-Learn-Test-%:
@source activate learna && \
python utils/timed_execution.py \
--timeout 3600 \
--data_dir data/ \
--results_dir results/ \
--experiment_group reproduce_iclr_2019 \
--method Meta-LEARNA-Adapt \
--dataset rfam_learn_test \
--task_id $*
################################################################################
# Joint Architecture and Hyperparameter Search
################################################################################
## Run an example for joint Hyperparameter and Architecture Search using BOHB
bohb-example:
@source activate learna && \
python -m src.optimization.bohb \
--min_budget 2 \
--max_budget 8 \
--n_iter 1 \
--n_cores 1 \
--run_id example \
--data_dir data \
--nic_name lo \
--shared_directory results/ \
--mode learna
################################################################################
# Analysis and Visualization
################################################################################
## Analyse experiment group %
analyse:
@source activate learna && \
python -m src.analyse.analyse_experiment_group --experiment_group results/reproduce_iclr_2019 --analysis_dir analysis/reproduce_iclr_2019 --root_sequences_dir data --ci_alpha 0.05
## Plot reproduced results using pgfplots
plots:
rm -rf results/plots/
@source activate learna && \
pdflatex -synctex=1 -interaction=nonstopmode -shell-escape results/plots.tex
mkdir -p results/plots/
mv pgfplots.pdf results/plots/
rm -f pgfplots*
################################################################################
# Help
################################################################################
# From https://drivendata.github.io/cookiecutter-data-science/
show-help:
@echo "$$(tput bold)Available rules:$$(tput sgr0)"
@echo
@sed -n -e "/^## / { \
h; \
s/.*//; \
:doc" \
-e "H; \
n; \
s/^## //; \
t doc" \
-e "s/:.*//; \
G; \
s/\\n## /---/; \
s/\\n/ /g; \
p; \
}" ${MAKEFILE_LIST} \
| LC_ALL='C' sort --ignore-case \
| awk -F '---' \
-v ncol=$$(tput cols) \
-v indent=22 \
-v col_on="$$(tput setaf 6)" \
-v col_off="$$(tput sgr0)" \
'{ \
printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
n = split($$2, words, " "); \
line_length = ncol - indent; \
for (i = 1; i <= n; i++) { \
line_length -= length(words[i]) + 1; \
if (line_length <= 0) { \
line_length = ncol - indent - length(words[i]) - 1; \
printf "\n%*s ", -indent, " "; \
} \
printf "%s ", words[i]; \
} \
printf "\n"; \
}' \
| more $(shell test $(shell uname) = Darwin && echo '--no-init --raw-control-chars')