-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathtrain.sh
executable file
·92 lines (80 loc) · 1.66 KB
/
train.sh
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
#!/usr/bin/env bash
# Trains DeepCpG models separately.
# Source dependencies.
source "./lib.sh"
# Change the following glob patterns depending on how to you want to split the
# data into training, validation, and optionally test set. The training set
# should contain at least 3 million CpG sites. Use `dcpg_data_stats.py` to count
# the number of CpG sites (see `data.sh` script).
# Training set
train_files="$data_dir/c{1,3,5,7,9}*.h5"
# Validation set
val_files="$data_dir/c{13,14,15,16}*.h5"
# Set to 1 for testing and 0 for real run.
test_mode=1
if [[ $test_mode -eq 1 ]]; then
val_files="$train_files"
fi
# Train DNA model.
cmd="dcpg_train.py
$train_files
--val_files $val_files
--out_dir $models_dir/dna
--dna_model CnnL2h128
"
if [[ $test_mode -eq 1 ]]; then
cmd="$cmd
--val_files $train_files
--nb_train_sample 500
--nb_val_sample 500
--nb_epoch 1
"
else
cmd="$cmd
--nb_epoch 30
"
fi
run $cmd
# Train CpG model.
cmd="dcpg_train.py
$train_files
--val_files $val_files
--out_dir $models_dir/cpg
--cpg_model RnnL1
"
if [[ $test_mode -eq 1 ]]; then
cmd="$cmd
--val_files $train_files
--nb_train_sample 500
--nb_val_sample 500
--nb_epoch 1
"
else
cmd="$cmd
--nb_epoch 20
"
fi
run $cmd
# Train Joint model.
cmd="dcpg_train.py
$train_files
--val_files $val_files
--out_dir ./models/joint
--dna_model ./models/dna
--cpg_model ./models/cpg
--joint_model JointL2h512
--train_models joint
"
if [[ $test_mode -eq 1 ]]; then
cmd="$cmd
--val_files $train_files
--nb_train_sample 500
--nb_val_sample 500
--nb_epoch 1
"
else
cmd="$cmd
--nb_epoch 10
"
fi
run $cmd