-
Notifications
You must be signed in to change notification settings - Fork 26
/
Makefile.lgb1
66 lines (52 loc) · 1.98 KB
/
Makefile.lgb1
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
include Makefile.feature.j1
N = 10000
N_LEAF = 200
LRATE = 0.1
N_MIN = 10
SUBCOL = 0.8
SUBROW = 0.7
SUBROW_FREQ = 1
N_STOP = 20
ALGO_NAME := lgb1
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
submit: $(SUBMISSION_TST)
kaggle competitions submit -c $(COMPETITION) -f $< -m $(MODEL_NAME)
$(PREDICT_TST) $(PREDICT_VAL): $(FEATURE_TRN) $(FEATURE_TST) \
| $(DIR_VAL) $(DIR_TST)
./src/train_predict_lgb1.py --train-file $< \
--test-file $(word 2, $^) \
--predict-valid-file $(PREDICT_VAL) \
--predict-test-file $(PREDICT_TST) \
--n-est $(N) \
--n-leaf $(N_LEAF) \
--lrate $(LRATE) \
--n-min $(N_MIN) \
--subcol $(SUBCOL) \
--subrow $(SUBROW) \
--subrow-freq $(SUBROW_FREQ) \
--early-stop $(N_STOP)
$(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