-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
238 lines (200 loc) · 6.28 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
TRAIN ?= sp14
TEST ?= fa15
DATA ?= op+type+size
MODEL ?= hidden
LAYERS ?= 500
LEARN_RATE ?= 0.001
REG_RATE ?= 0.001
#REG_LIN_RATE ?= 0.01
BATCH_SIZE ?= 200
EPOCHS ?= 20
SEED ?= 0
PRUNE ?= NoPrune
DATAS = op+context+type op+context+type+size
DATAS_BENCH = op+context+type
DATAS_CROSS = op op+slice op+context op+size op+type
DATAS_CROSS += op+context+size op+context+type op+type+size
DATAS_CROSS += op+context+type+size
#HIDDEN = 10 25 50 100 250 500
HIDDEN = 10 500
define HIDDEN_PREDICTIONS
python learning/learn.py \
--data data/$(3)/$(1) \
--learn_rate=$(LEARN_RATE) \
--reg_rate=$(REG_RATE) \
--model=hidden \
--hidden_layers=$(2) \
--batch_size=$(BATCH_SIZE) \
--n_epochs=$(EPOCHS) \
--test_data data/$(4)/$(1) \
--seed $(SEED) \
--store_predictions
endef
define LINEAR_PREDICTIONS
python learning/learn.py \
--data data/$(2)/$(1) \
--learn_rate=$(LEARN_RATE) \
--reg_rate=$(REG_RATE) \
--model=linear \
--batch_size=$(BATCH_SIZE) \
--n_epochs=$(EPOCHS) \
--test_data data/$(3)/$(1) \
--seed $(SEED) \
--store_predictions
endef
define TREE_PREDICTIONS
python learning/trees.py $(1) data/$(3)/$(2) data/$(4)/$(2)
endef
define linear_template
.PHONY: $(1)-linear
$(1)-linear:
+$(call LINEAR_PREDICTIONS,$(1),sp14,fa15)
+$(call LINEAR_PREDICTIONS,$(1),fa15,sp14)
ALL_LINEAR += $(1)-linear
$(1)-linear-results:
+stack exec evaluate -- evaluate $(1)/linear data/sp14 $(PRUNE)
+stack exec evaluate -- evaluate $(1)/linear data/fa15 $(PRUNE)
ALL_LINEAR_RESULTS += $(1)-linear-results
endef
define tree_template
.PHONY: $(1)-$(2)
$(1)-$(2):
+$(call TREE_PREDICTIONS,$(2),$(1),sp14,fa15)
+$(call TREE_PREDICTIONS,$(2),$(1),fa15,sp14)
ALL_TREE += $(1)-$(2)
$(1)-$(2)-results:
+stack exec evaluate -- evaluate $(1)/$(2) data/sp14 $(PRUNE)
+stack exec evaluate -- evaluate $(1)/$(2) data/fa15 $(PRUNE)
ALL_TREE_RESULTS += $(1)-$(2)-results
endef
define hidden_template
.PHONY: $(1)-hidden-$(2)
$(1)-hidden-$(2):
+$(call HIDDEN_PREDICTIONS,$(1),$(2),sp14,fa15)
+$(call HIDDEN_PREDICTIONS,$(1),$(2),fa15,sp14)
ALL_HIDDEN += $(1)-hidden-$(2)
$(1)-hidden-$(2)-results:
+stack exec evaluate -- evaluate $(1)/hidden-$(2) data/sp14 $(PRUNE)
+stack exec evaluate -- evaluate $(1)/hidden-$(2) data/fa15 $(PRUNE)
ALL_HIDDEN_RESULTS += $(1)-hidden-$(2)-results
endef
define csv_template
.PHONY: $(1)-$(2)-csvs
$(1)-$(2)-csvs:
+stack exec generate-features -- --source=features/data/ucsd/data/derived/$(1)/pairs.json --features=$(2) --out=data/$(1)
ALL_CSVS += $(1)-$(2)-csvs
endef
define HIDDEN_CROSS
python learning/learn.py \
--data data/fa15/$(1):data/sp14/$(1) \
--learn_rate=$(LEARN_RATE) \
--reg_rate=$(REG_RATE) \
--model=hidden \
--hidden_layers=$(2) \
--batch_size=$(BATCH_SIZE) \
--n_epochs=$(3) \
--n_folds=10 \
--seed $(SEED)
endef
define LINEAR_CROSS
python learning/learn.py \
--data data/fa15/$(1):data/sp14/$(1) \
--learn_rate=$(LEARN_RATE) \
--reg_rate=$(REG_RATE) \
--model=linear \
--batch_size=$(BATCH_SIZE) \
--n_epochs=$(2) \
--n_folds=10 \
--seed $(SEED)
endef
$(foreach data,$(DATAS),\
$(eval $(call linear_template,$(data))))
$(foreach data,$(DATAS),\
$(eval $(call tree_template,$(data),decision-tree)))
$(foreach data,$(DATAS),\
$(eval $(call tree_template,$(data),random-forest)))
$(foreach data,$(DATAS),\
$(foreach hidden,$(HIDDEN),\
$(eval $(call hidden_template,$(data),$(hidden)))))
$(foreach data,$(DATAS_CROSS),\
$(eval $(call csv_template,sp14,$(data))))
$(foreach data,$(DATAS_CROSS),\
$(eval $(call csv_template,fa15,$(data))))
.PHONY: all
all: linear tree hidden
.PHONY: csvs
csvs: $(ALL_CSVS)
.PHONY: results
results: linear-results tree-results hidden-results
.PHONY: linear
linear: $(ALL_LINEAR)
.PHONY: linear-results
linear-results: $(ALL_LINEAR_RESULTS)
.PHONY: tree
tree: $(ALL_TREE)
.PHONY: tree-results
tree-results: $(ALL_TREE_RESULTS)
.PHONY: hidden
hidden: $(ALL_HIDDEN)
.PHONY: hidden-results
hidden-results: $(ALL_HIDDEN_RESULTS)
.PHONY: feature-cross
feature-cross:
+$(call LINEAR_CROSS,op+slice,1) --no_slice
+$(call LINEAR_CROSS,op+slice,1)
+$(call LINEAR_CROSS,op+slice,8) --only_slice
+$(call HIDDEN_CROSS,op+slice,500,1) --no_slice
+$(call HIDDEN_CROSS,op+slice,500,1)
+$(call HIDDEN_CROSS,op+slice,500,8) --only_slice
+$(call LINEAR_CROSS,op,20)
+$(call LINEAR_CROSS,op+context,20)
+$(call LINEAR_CROSS,op+size,20)
+$(call LINEAR_CROSS,op+type,20)
+$(call LINEAR_CROSS,op+context+size,20)
+$(call LINEAR_CROSS,op+context+type,20)
+$(call LINEAR_CROSS,op+type+size,20)
+$(call LINEAR_CROSS,op+context+type+size,20)
+$(call HIDDEN_CROSS,op,500,20)
+$(call HIDDEN_CROSS,op+context,500,20)
+$(call HIDDEN_CROSS,op+size,500,20)
+$(call HIDDEN_CROSS,op+type,500,20)
+$(call HIDDEN_CROSS,op+context+size,500,20)
+$(call HIDDEN_CROSS,op+context+type,500,20)
+$(call HIDDEN_CROSS,op+type+size,500,20)
+$(call HIDDEN_CROSS,op+context+type+size,500,20)
.PHONY: ocaml ocaml-sp14 ocaml-fa15
ocaml: ocaml-sp14 ocaml-fa15
ocaml-sp14:
@stack exec -- evaluate gather Ocaml data/sp14
ocaml-fa15:
@stack exec -- evaluate gather Ocaml data/fa15
.PHONY: mycroft mycroft-sp14 mycroft-fa15
mycroft: mycroft-sp14 mycroft-fa15
mycroft-sp14:
@stack exec -- evaluate gather Mycroft data/sp14
mycroft-fa15:
@stack exec -- evaluate gather Mycroft data/fa15
.PHONY: sherrloc sherrloc-sp14 sherrloc-fa15
sherrloc: sherrloc-sp14 sherrloc-fa15
sherrloc-sp14:
@stack exec -- evaluate gather Sherrloc data/sp14
sherrloc-fa15:
@stack exec -- evaluate gather Sherrloc data/fa15
.PHONY: ocaml-results ocaml-sp14-results ocaml-fa15-results
ocaml-results: ocaml-sp14-results ocaml-fa15-results
ocaml-sp14-results:
@stack exec evaluate -- evaluate ocaml data/sp14 $(PRUNE)
ocaml-fa15-results:
@stack exec evaluate -- evaluate ocaml data/fa15 $(PRUNE)
.PHONY: mycroft-results mycroft-sp14-results mycroft-fa15-results
mycroft-results: mycroft-sp14-results mycroft-fa15-results
mycroft-sp14-results:
@stack exec evaluate -- evaluate mycroft data/sp14 $(PRUNE)
mycroft-fa15-results:
@stack exec evaluate -- evaluate mycroft data/fa15 $(PRUNE)
.PHONY: sherrloc-results sherrloc-sp14-results sherrloc-fa15-results
sherrloc-results: sherrloc-sp14-results sherrloc-fa15-results
sherrloc-sp14-results:
@stack exec evaluate -- evaluate sherrloc data/sp14 $(PRUNE)
sherrloc-fa15-results:
@stack exec evaluate -- evaluate sherrloc data/fa15 $(PRUNE)