add new experiment script pathfinder-plot

This commit is contained in:
falsycat 2022-06-25 19:37:28 +09:00
parent 920f69e4f0
commit a9763ed617

39
exp/pathfinder-plot.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash
set -e
BLKY_FLAGS="${BLKY_FLAGS}"
echo "this will take 4 hours" > /dev/stderr
function count_bits() {
err=$((0))
for i in $(seq 0 7); do
if [[ $(($1 & (1 << $i))) > 0 ]]; then
err=$((err + 1))
fi
done
echo $err
}
function proc() {
err=$((0))
for i in $(seq 0 255); do
v=$(printf "%02x" ${i} | \
${BLKY} ${BLKY_FLAGS} --from bytes --stdin-hex --to feature-probs --stdout \
--probgen-false-positive $(printf "0.%02d" ${1}) \
--probgen-false-negative $(printf "0.%02d" ${2}) | \
${BLKY} ${BLKY_FLAGS} --from feature-probs --stdin --to bytes --stdout-hex)
err=$((err + $(count_bits $(($i ^ 16#$v)))))
done
printf "0.%02d 0.%02d %d\n" ${fn} ${fp} ${err}
}
for fn in $(seq 0 50); do
for fp in $(seq 0 50); do
until [ "$( jobs -lr 2>&1 | wc -l)" -lt 4 ]; do
sleep 0.5
done
proc ${fp} ${fn} &
done
done