-
Notifications
You must be signed in to change notification settings - Fork 1
/
completeMakefile
59 lines (42 loc) · 1.71 KB
/
completeMakefile
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
SHELL=/bin/bash
PYTHON=pyenv/bin/python
# global variable for directories
LOG=log
TRAIN_LOG_MSG=tlog_msg
TRAIN_LOG_NET=tlog_net
GRID_N={3,4}
# UNARY_STD={0.1,1.0}
UNARY_STD={1.0,2.0}
PENALTY={1,3,5}
# STRUCTURE should be: grid | full_connected
STRUCTURE=full_connected
EXP=train_${STRUCTURE}
RESULTS=${EXP}_score
#experiment argument
DEVICE=cpu
EXP_ITERS=20
ALGORITHM_MSG={ve,mf,lbp,dbp,gbp}
ALGORITHM_NET={bethe,kikuchi}
SLEEP=10
TRAIN_ITERS=60
LR=0.0005
# data set
DATA_DIR=data
TRAIN_SIZE=2000
TEST_SIZE=1000
BATCH_SIZE=500
init:
mkdir -p ${LOG} ${TRAIN_LOG_MSG} ${TRAIN_LOG_NET} ${DATA_DIR}
ising_infer: $(shell echo ${LOG}/${RESULTS}_n${GRID_N}_std${UNARY_STD}_pen${PENALTY}.txt)
${LOG}/${RESULTS}%.txt: init
${PYTHON} infer_ising_marginals.py --structure ${STRUCTURE} --sleep ${SLEEP} --device ${DEVICE} --exp_iters ${EXP_ITERS} --task $@ > $@
# training with inference method
ising_train: $(shell echo ${TRAIN_LOG_NET}/${RESULTS}_n${GRID_N}_std${UNARY_STD}_pen${PENALTY}_algo.${ALGORITHM_NET}.txt) $(shell echo ${TRAIN_LOG_MSG}/${RESULTS}_n${GRID_N}_std${UNARY_STD}_pen0_algo.${ALGORITHM_MSG}.txt)
# training with massage passing algorithms
${TRAIN_LOG_MSG}/${RESULTS}%.txt: init
${PYTHON} train_ising.py --structure ${STRUCTURE} --sleep ${SLEEP} --device ${DEVICE} --train_size ${TRAIN_SIZE} --test_size ${TEST_SIZE} --batch_size ${BATCH_SIZE} --train_iters ${TRAIN_ITERS} --lr ${LR} --task $@ > $@
# training with renn or bethe inference net
${TRAIN_LOG_NET}/${RESULTS}%.txt: init
${PYTHON} train_ising.py --structure ${STRUCTURE} --sleep ${SLEEP} --device ${DEVICE} --train_size ${TRAIN_SIZE} --test_size ${TEST_SIZE} --batch_size ${BATCH_SIZE} --train_iters ${TRAIN_ITERS} --lr ${LR} --task $@ > $@
.SECONDARY:
.PRECIOUS: