generated from jeongyoonlee/kaggler-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.krs1
51 lines (37 loc) · 1.52 KB
/
Makefile.krs1
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
include Makefile.feature.n1
N = 55
ALGO_NAME := krs1
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
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
submit: $(SUBMISSION_TST)
kaggle competitions submit -c $(COMPETITION) -f $< -m $(MODEL_NAME)
$(PREDICT_TST) $(PREDICT_VAL): $(FEATURE_TRN) $(FEATURE_TST) \
| $(DIR_VAL) $(DIR_TST)
python ./src/train_predict_krs1.py --train-file $< \
--test-file $(word 2, $^) \
--predict-valid-file $(PREDICT_VAL) \
--predict-test-file $(PREDICT_TST) \
--n-est $(N)
$(SUBMISSION_TST_GZ): $(SUBMISSION_TST)
gzip $<
$(SUBMISSION_TST): $(PREDICT_TST) $(HEADER) $(ID_TST) | $(DIR_SUB)
paste -d, $(lastword $^) $< > $@.tmp
cat $(word 2, $^) $@.tmp > $@
rm $@.tmp
$(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