-
Notifications
You must be signed in to change notification settings - Fork 1
/
summary.sh
executable file
·128 lines (110 loc) · 2.31 KB
/
summary.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
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
#!/usr/bin/env bash
#usage ./summary.sh -m [metric] -d [directory of results]
metric="lr_smape"
directory="."
basedir=`pwd`
while getopts ":m:d:" opt;do
case ${opt} in
m )
metric=$OPTARG
;;
d )
directory=$OPTARG
;;
\? )
echo "Invalid usage"
echo "usage: ./summary.sh -m [metric] -d [directoryname]"
exit 1
;;
: )
echo "missing option"
echo "usage: ./summary.sh -m [metric] -d [directoryname]"
exit 1
;;
esac
done
cd $directory
printf "Program,Stan_Crash,Stan_Num,Stan_Acc,Pyro_Crash,Pyro_Num,Pyro_Acc,Edward_Crash,Edward_Num,Edward_Acc\n"
for x in */; do
printf "$x,"
if [ -e $x/pplout* ]; then
crash=`grep -ir "se_mean" $x/pplout* -L | wc -l`
inf=`grep -ir "se_mean" $x/pplout* -A100 | grep -iw "inf\|nan" -l | wc -l`
if [ $crash -eq 1 ];
then
printf "*,"
else
printf -- '-,'
fi
if [ $inf -ge 1 ];
then
printf "*,"
else
printf -- '-,'
fi
# acc check
if [[ $crash -eq 0 && $inf -eq 0 ]]; then
res=`$basedir/metrics/$metric.sh $x stan`
if [[ $res = *"True"* ]]; then
printf -- '-,'
else
printf "*,"
fi
else
printf -- "-,"
fi
fi
if [ -e $x/pyroout* ]; then
pyro_crash=`grep -ir "_mean" $x/pyroout* -L | wc -l`
pyro_inf=`cat $x/pyroout* | grep -iw "inf\|nan" -l | wc -l`
if [ $pyro_crash -eq 1 ];
then
printf "*,"
else
printf -- '-,'
fi
if [ $pyro_inf -ge 1 ];
then
printf "*,"
else
printf -- '-,'
fi
if [[ $pyro_crash -eq 0 && $pyro_inf -eq 0 ]]; then
res=`$basedir/metrics/$metric.sh $x pyro`
if [[ $res = *"True"* ]]; then
printf -- '-,'
else
printf "*,"
fi
else
printf -- "-,"
fi
fi
if [ -e $x/edwardout* ]; then
edward_crash=`cat $x/edwardout* | tail -3 | grep -io "[0-9]\+[\.]\?[0-9]\+" | wc -l`
edward_inf=`cat $x/edwardout* | tail -3 | grep -iw "inf\|nan" -l | wc -l`
if [ $edward_crash -lt 3 ];
then
printf "*,"
else
printf -- '-,'
fi
if [ $edward_inf -ge 1 ];
then
printf "*,"
else
printf -- '-,'
fi
if [[ $edward_crash -eq 0 && $edward_inf -eq 0 ]]; then
res=`$basedir/metrics/$metric.sh $x edward`
if [[ $res = *"True"* ]]; then
printf -- '-'
else
printf "*"
fi
else
printf -- "-"
fi
fi
printf "\n"
done