-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
128 lines (108 loc) · 3.96 KB
/
Makefile
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
SHELL:=/usr/bin/bash
default: help
##############################################################################
#
# Machine Learning
#
##############################################################################
INPUT=./data/remote/latest/*.csv
OUTPUT_DIR=./predictions
MODEL=./models/model.json
.PHONY: check_hashes # Check git local and remote repo hashs
check_hashes:
@bash ./scripts/check_git_hashes.bash
.PHONY: train # Train a model
train: check_hashes
@./apps/train.py \
--verbose \
--model-filename=$(MODEL) \
"$(INPUT)"
.PHONY: classify # Generate predictions
classify: check_hashes
@mkdir -p $(OUTPUT_DIR)
@ls -1 $(INPUT) \
| parallel --verbose --lb --jobs=16 --halt now,fail=1 \
"python apps/classify.py --verbose --model-filename=$(MODEL) --output-filename=$(OUTPUT_DIR)/{/.}_classified.csv {}"
.PHONY: score # Score predictions
score:
make --no-print-directory score_all | tee scores.all.txt
make --no-print-directory score_binary | tee scores.binary.txt
score_all:
@python apps/score.py --verbose --all "$(OUTPUT_DIR)/*.csv"
score_binary:
@python apps/score.py --verbose "$(OUTPUT_DIR)/*.csv"
.PHONY: cross_validate # Cross validate track stacker
cross_validate:
@python ./apps/generate_cross_val_commands.py \
--verbose \
--splits=5 \
"$(INPUT)" > ./cross_validate.bash
@bash ./cross_validate.bash
@rm ./cross_validate.bash
##############################################################################
#
# View results
#
##############################################################################
.PHONY: view # View predictions
view:
@parallel --lb --jobs=100 \
"streamlit run ../ATL24_viewer/view_ensemble.py -- --verbose {}" \
::: $$(find ./predictions/*.csv | head)
##############################################################################
#
# Show result plots
#
##############################################################################
.PHONY: plot_corr # Plot correlations between predictions
plot_corr:
@python apps/plot_corr.py \
--verbose \
"$(INPUT)"
@eog all_corr.png &
@eog surface_corr.png &
@eog bathy_corr.png &
.PHONY: plot_multi_class # Plot performance
plot_multi_class:
@python ./apps/plot_multi_class.py scores.all.txt
@python ./apps/plot_multi_class.py cross_val.all.0.txt
@python ./apps/plot_multi_class.py cross_val.all.1.txt
@python ./apps/plot_multi_class.py cross_val.all.2.txt
@python ./apps/plot_multi_class.py cross_val.all.3.txt
@python ./apps/plot_multi_class.py cross_val.all.4.txt
.PHONY: plot_binary # Plot performance
plot_binary:
@python ./apps/plot_binary.py scores.binary.txt
@python ./apps/plot_binary.py cross_val.binary.0.txt
@python ./apps/plot_binary.py cross_val.binary.1.txt
@python ./apps/plot_binary.py cross_val.binary.2.txt
@python ./apps/plot_binary.py cross_val.binary.3.txt
@python ./apps/plot_binary.py cross_val.binary.4.txt
.PHONY: plot_f1 # Plot performance
plot_f1:
@python ./apps/plot_f1.py scores.binary.txt
@python ./apps/plot_f1.py cross_val.binary.0.txt
@python ./apps/plot_f1.py cross_val.binary.1.txt
@python ./apps/plot_f1.py cross_val.binary.2.txt
@python ./apps/plot_f1.py cross_val.binary.3.txt
@python ./apps/plot_f1.py cross_val.binary.4.txt
.PHONY: plot # Plot performance
plot:
@python ./apps/plot_multi_class.py scores.all.txt
@python ./apps/plot_surface_bathy.py scores.binary.txt
@python ./apps/plot_surface_bathy.py cross_val.binary.?.txt
.PHONY: plot3 # Plot performance of three selected algorithms
plot3:
@python ./apps/plot_multi_class3.py --verbose scores.all.txt
@python ./apps/plot_surface_bathy3.py --verbose scores.binary.txt
@python ./apps/plot_surface_bathy3.py --verbose cross_val.binary.?.txt
##############################################################################
#
# Get help by running
#
# $ make help
#
##############################################################################
.PHONY: help # Generate list of targets with descriptions
help:
@grep '^.PHONY: .* #' Makefile | sed 's/\.PHONY: \(.*\) # \(.*\)/\1 \2/' | expand -t25