-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy patheval-nemeftr-clustering.sh
executable file
·103 lines (81 loc) · 2.9 KB
/
eval-nemeftr-clustering.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
#!/usr/bin/env bash
#
# Calls the reference implementation of the field type clustering of segments on similarity without ground truth
# described in our DSN 2022 paper (NEMEFTR-full mode 1). The parameters in this script are the same as used
# in the paper's evaluation.
input="input/maxdiff-fromOrig/*-100*.pcap"
#input="input/maxdiff-fromOrig/ntp_SMIA-20111010_maxdiff-100.pcap"
segmenters="nemesys zeros"
# Nemesys options
# refines="original nemetyl PCA1 PCAmoco zerocharPCAmocoSF emzcPCAmocoSF"
# Zeros options
#refines="none PCA1 PCAmocoSF"
refines="nemetyl PCAmocoSF emzcPCAmocoSF"
L1PROTOS="input/ari_*"
L2PROTOS="input/awdl-* input/au-* input/wlan-beacons-*"
LEPROTOS="input/awdl-* input/au-* input/smb* input/*/smb* input/wlan-beacons-*"
prefix="cft"
cftnpad="352"
for f in reports/${prefix}-* ; do
if [ -e "$f" ] ; then
cftnext=$(expr 1 + $(ls -d reports/${prefix}-* | sed "s/^.*${prefix}-\([0-9]*\)-.*$/\1/" | sort | tail -1))
cftnpad=$(printf "%03d" ${cftnext})
fi
break
done
currcomm=$(git log -1 --format="%h")
report=reports/${prefix}-${cftnpad}-clustering-${currcomm}
mkdir ${report}
for seg in ${segmenters} ; do
for ref in ${refines} ; do
if [[ ${seg} == "zeros" ]] && [[ ! ${ref} =~ ^(none|PCA1|PCAmocoSF)$ ]] ; then
echo ${ref} not suited for zeros segmenter. Ignoring.
continue
fi
pids=()
for fn in ${input} ; do
optargs="-r"
for proto in ${L2PROTOS} ; do
if [[ "${fn}" == ${proto} ]] ; then
# replace
optargs="-l 2"
fi
done
for proto in ${L1PROTOS} ; do
if [[ "${fn}" == ${proto} ]] ; then
# replace
optargs="-l 1"
fi
done
for proto in ${LEPROTOS} ; do
if [[ "${fn}" == $proto ]] ; then
# append
optargs="${optargs} -e" # -e: little endian
fi
done
bn=$(basename -- ${fn})
strippedname="${bn%.*}"
# fixed sigma 1.2 (nemeftr-paper: "constant σ of 1.2") ### add -p for plots
python src/nemeftr_cluster-segments.py -t ${seg} -s 1.2 ${optargs} -f ${ref} ${fn} # >> "${report}/${strippedname}.log" &
pids+=( $! )
# python src/nemeftr_cluster-segments.py -t ${seg} -s 1.2 -p -e ${optargs} -f ${ref} ${fn}
# dynamic sigma:
# python src/nemeftr_cluster-segments.py -p -f ${ref} ${fn}
done
# for pid in "${pids[@]}"; do
# printf 'Waiting for %d...' "$pid"
# wait $pid
# echo 'done.'
# done
mkdir ${report}-${seg}-${ref}
for fn in ${input};
do
bn=$(basename -- ${fn})
strippedname="${bn%.*}"
mv reports/${strippedname}* ${report}-${seg}-${ref}/
done
done
done
python src/transform_cluster-statistics.py
mv reports/*.csv ${report}/
spd-say "Bin fertig!"