-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
145 lines (123 loc) · 5.21 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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 | shuf | head)
.PHONY: view3 # View 3 predictions
view3:
@parallel --lb --jobs=100 \
"streamlit run ../ATL24_viewer/view_3_predictions.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
.PHONY: plot_profiles # Plot 3 predictions
plot_profiles:
python ./apps/plot_profiles.py --verbose ./predictions/ATL24_20200727124034_04910807_005_01_gt1l_0_classified.csv --segment-index=4
python ./apps/plot_profiles.py --verbose ./predictions/ATL24_20211129072752_10361307_005_01_gt2l_0_classified.csv --segment-index=5
python ./apps/plot_profiles.py --verbose ./predictions/ATL24_20220622132617_00101601_005_02_gt2r_1_classified.csv
python ./apps/plot_profiles.py --verbose ./predictions/ATL24_20190310163417_11030208_005_01_gt2l_0_classified.csv --segment-index=1
python ./apps/plot_profiles.py --verbose ./predictions/ATL24_20191015083439_02820501_006_02_gt2r_0_classified.csv
python ./apps/plot_profiles.py --verbose ./predictions/ATL24_20191027211532_04730506_005_01_gt3r_0_classified.csv --segment-index=0
python ./apps/plot_profiles.py --verbose ./predictions/ATL24_20190429055556_04730306_005_01_gt3l_2_classified.csv --segment-index=0
python ./apps/plot_profiles.py --verbose ./predictions/ATL24_20190429055556_04730306_005_01_gt2l_0_classified.csv --segment-index=0
##############################################################################
#
# 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