Blame view
run.sh
3.06 KB
14d6e0cb3 Basic run.sh for ... |
1 |
|
fee5922c3 New way to exec t... |
2 3 4 |
#OUTDIR="exp/test/pvector-2" #DATADIR="data" #NEW_LSTDIR="${OUTDIR}/lst" |
b3371498c Run script update... |
5 |
|
fee5922c3 New way to exec t... |
6 7 8 9 |
#VECTOR_FILES_BEGIN="${DATADIR}/pvectors_1rst/pvectors_teacher" #VECTOR_FILES_END=".txt" #VECTOR_FILE="" # To specify if there's only one #VECTOR_FILES_ONE=false # Specify there's only one file |
b3371498c Run script update... |
10 |
|
fee5922c3 New way to exec t... |
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 |
#KMIN=2 #KMAX=100 # -- LOAD CONFIG FILE CONFIG_FILE="config.sh" if [ $# -eq 1 ] then CONFIG_FILE="$1" else echo "Need to have one and only one argument" exit -1 fi source $CONFIG_FILE # -- DEFAULTS VALUES CONFIGURATION if [ -z "$VECTOR_FILES_ONE" ] then VECTOR_FILES_ONE=false fi # -- MAKE DIRECTORIES |
14d6e0cb3 Basic run.sh for ... |
36 37 38 39 |
if [ ! -d "$OUTDIR" ]; then mkdir -p $OUTDIR fi |
29644ae6c New receip to bui... |
40 41 42 43 |
if [ ! -d "${NEW_LSTDIR}" ]; then mkdir -p ${NEW_LSTDIR} fi |
fee5922c3 New way to exec t... |
44 |
|
95142dfdc maj. No comment |
45 46 47 48 49 50 51 52 53 54 |
# -- KFOLD MIN and MAX if [ -z "$MIN_KFOLD" ] then MIN_KFOLD=1 fi if [ -z "$MAX_KFOLD" ] then MAX_KFOLD=4 fi |
fee5922c3 New way to exec t... |
55 |
# -- BEGIN BY KFOLD |
95142dfdc maj. No comment |
56 |
for kfold in $(seq ${MIN_KFOLD} ${MAX_KFOLD}) |
b3371498c Run script update... |
57 |
do |
fee5922c3 New way to exec t... |
58 59 60 61 |
# Some usefull variable CHAR_INFO="${DATADIR}/character_information.csv" TRAIN_TYPE_LST="${NEW_LSTDIR}/train_${kfold}_type.lst" VAL_TYPE_LST="${NEW_LSTDIR}/val_${kfold}_type.lst" |
95142dfdc maj. No comment |
62 63 |
TRAIN_LANG_LST="${NEW_LSTDIR}/train_${kfold}_lang.lst" VAL_LANG_LST="${NEW_LSTDIR}/val_${kfold}_lang.lst" |
b3371498c Run script update... |
64 |
|
fee5922c3 New way to exec t... |
65 |
# Configuration for the run clustering file |
4a691a3d4 Few changes. Repa... |
66 |
if [ ${VECTOR_FILES_ONE} == false ] |
b3371498c Run script update... |
67 |
then |
fee5922c3 New way to exec t... |
68 |
VECTOR_FILE="${VECTOR_FILES_BEGIN}_${kfold}${VECTOR_FILES_END}" |
b3371498c Run script update... |
69 |
fi |
29644ae6c New receip to bui... |
70 |
|
fee5922c3 New way to exec t... |
71 72 73 |
TRAIN_LST="${DATADIR}/pvectors_1rst/lst/train_${kfold}.lst" VAL_LST="${DATADIR}/pvectors_1rst/lst/val_${kfold}.lst" EXP_DIR="${OUTDIR}/${kfold}" |
95142dfdc maj. No comment |
74 |
METAS_TYPE="${NEW_LSTDIR}/metas_${kfold}_type.lst" |
fee5922c3 New way to exec t... |
75 |
METAS_CHARACTER="${DATADIR}/masseffect.lst" |
95142dfdc maj. No comment |
76 |
METAS_LANG="${NEW_LSTDIR}/metas_${kfold}_lang.lst" |
fee5922c3 New way to exec t... |
77 78 79 80 81 82 |
if [ ! -d "${EXP_DIR}" ]; then mkdir -p ${EXP_DIR} fi |
95142dfdc maj. No comment |
83 |
# EXTRACT TYPE INFORMATION |
29644ae6c New receip to bui... |
84 |
echo "Extracting character information" |
95142dfdc maj. No comment |
85 |
echo "Replace in train" |
29644ae6c New receip to bui... |
86 |
python3 "bin/replace_label.py" \ |
fee5922c3 New way to exec t... |
87 88 89 90 91 |
"${METAS_CHARACTER}" \ "${CHAR_INFO}" \ --field "type" \ --lst "${TRAIN_LST}" \ --outfile "${TRAIN_TYPE_LST}" |
95142dfdc maj. No comment |
92 |
echo "Replace in val" |
29644ae6c New receip to bui... |
93 |
python3 "bin/replace_label.py" \ |
fee5922c3 New way to exec t... |
94 95 96 97 98 |
"${METAS_CHARACTER}" \ "${CHAR_INFO}" \ --field "type" \ --lst "${VAL_LST}" \ --outfile "${VAL_TYPE_LST}" |
95142dfdc maj. No comment |
99 |
echo "Merge them" |
fee5922c3 New way to exec t... |
100 |
cat "${TRAIN_TYPE_LST}" "${VAL_TYPE_LST}" > "${METAS_TYPE}" |
95142dfdc maj. No comment |
101 102 103 104 105 106 107 108 109 110 111 |
# EXTRACT LANGUAGE INFORMATION echo "Language info for train" awk '$2=$1' FS=, OFS=, ${TRAIN_LST} > ${TRAIN_LANG_LST} echo "Language info for val" awk '$2=$1' FS=, OFS=, ${VAL_LST} > ${VAL_LANG_LST} echo "Merge them" cat "${TRAIN_LANG_LST}" "${VAL_LANG_LST}" > "${METAS_LANG}" echo "Then Run Clustering" |
fee5922c3 New way to exec t... |
112 |
source "run-clustering.sh" |
b3371498c Run script update... |
113 |
done |
14d6e0cb3 Basic run.sh for ... |
114 |
|
fee5922c3 New way to exec t... |
115 116 117 118 119 120 121 |
# Regroup measures with respect to character classes echo "Regrouping measures with respect to character classes" python3 "bin/regroup-measures.py" ${OUTDIR} # Regroup measures with respect to type classes echo "Regrouping measures with respect to type classes" python3 "bin/regroup-measures.py" ${OUTDIR} --suffix "_type" --measurefile "measures_type.json" |