-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathMakefile.rf
56 lines (42 loc) · 1.96 KB
/
Makefile.rf
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
include Makefile.feature.j1
N = 100
N_MIN = 10
SUBROW = 0.5
ALGO_NAME := rf
MODEL_NAME := $(ALGO_NAME)_$(FEATURE_NAME)
METRIC_VAL := $(DIR_METRIC)/$(MODEL_NAME).val.txt
PREDICT_VAL := $(DIR_VAL)/$(MODEL_NAME).val.yht
PREDICT_TST := $(DIR_TST)/$(MODEL_NAME).tst.yht
FEATURE_IMP := $(DIR_MODEL)/$(MODEL_NAME).imp.csv
SUBMISSION_TST := $(DIR_SUB)/$(MODEL_NAME).sub.csv
SUBMISSION_TST_GZ := $(DIR_SUB)/$(MODEL_NAME).sub.csv.gz
all: validation submission
validation: $(METRIC_VAL)
submission: $(SUBMISSION_TST)
retrain: clean_$(ALGO_NAME) submission
$(PREDICT_TST) $(PREDICT_VAL): $(FEATURE_TRN) $(FEATURE_TST) $(FEATURE_MAP) \
| $(DIR_VAL) $(DIR_TST) $(DIR_MODEL)
python ./src/train_predict_$(ALGO_NAME).py --train-file $< \
--test-file $(word 2, $^) \
--feature-map-file $(FEATURE_MAP) \
--predict-valid-file $(PREDICT_VAL) \
--predict-test-file $(PREDICT_TST) \
--feature-imp-file $(FEATURE_IMP) \
--n-est $(N) \
--n-min $(N_MIN) \
--subrow $(SUBROW)
$(SUBMISSION_TST_GZ): $(SUBMISSION_TST)
gzip $<
$(SUBMISSION_TST): $(PREDICT_TST) $(SAMPLE_SUBMISSION) | $(DIR_SUB)
python ./src/write_submission.py --predict-file $< \
--sample-file $(lastword $^) \
--output-file $@
$(METRIC_VAL): $(PREDICT_VAL) $(Y_TRN) | $(DIR_METRIC)
python ./src/evaluate.py --predict-file $< \
--target-file $(lastword $^) > $@
cat $@
clean:: clean_$(ALGO_NAME)
clean_$(ALGO_NAME):
-rm $(METRIC_VAL) $(PREDICT_VAL) $(PREDICT_TST) $(SUBMISSION_TST)
find . -name '*.pyc' -delete
.DEFAULT_GOAL := all