From c90ec1a9352898213af737932e61730a0b7d6f23 Mon Sep 17 00:00:00 2001 From: falsycat Date: Tue, 6 Sep 2022 18:15:15 +0900 Subject: [PATCH] add fprob_calc.sh --- exp/bidx_random.sh | 15 +++++++++++++ exp/fprob_calc.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100755 exp/bidx_random.sh create mode 100755 exp/fprob_calc.sh diff --git a/exp/bidx_random.sh b/exp/bidx_random.sh new file mode 100755 index 0000000..3ce45b7 --- /dev/null +++ b/exp/bidx_random.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# generate random block indices + +row=$1 +col=$2 +max=$3 + +for ((y = 0; y < row; ++y)); do + n=$((RANDOM%col + 1)) + for ((x = 0; x < n; ++x)); do + printf "$((RANDOM%max)) " + done + printf "\n" +done diff --git a/exp/fprob_calc.sh b/exp/fprob_calc.sh new file mode 100755 index 0000000..35a2e2f --- /dev/null +++ b/exp/fprob_calc.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +# calculate fprob from indices and fprob matrix +# output: average feature's feature probability and average non-feature's feature probability + +bidx=$1 +fprob=$2 +n=$3 + +script=$(cat - <