Commit 4a691a3d4e543139083b308c6ca74509be8af7bd

Authored by Mathias Quillot
1 parent c9e40ab8ea
Exists in master

Few changes. Repair a condition

Showing 1 changed file with 1 additions and 1 deletions Inline Diff

1 1
2 #OUTDIR="exp/test/pvector-2" 2 #OUTDIR="exp/test/pvector-2"
3 #DATADIR="data" 3 #DATADIR="data"
4 #NEW_LSTDIR="${OUTDIR}/lst" 4 #NEW_LSTDIR="${OUTDIR}/lst"
5 5
6 #VECTOR_FILES_BEGIN="${DATADIR}/pvectors_1rst/pvectors_teacher" 6 #VECTOR_FILES_BEGIN="${DATADIR}/pvectors_1rst/pvectors_teacher"
7 #VECTOR_FILES_END=".txt" 7 #VECTOR_FILES_END=".txt"
8 #VECTOR_FILE="" # To specify if there's only one 8 #VECTOR_FILE="" # To specify if there's only one
9 #VECTOR_FILES_ONE=false # Specify there's only one file 9 #VECTOR_FILES_ONE=false # Specify there's only one file
10 10
11 #KMIN=2 11 #KMIN=2
12 #KMAX=100 12 #KMAX=100
13 13
14 # -- LOAD CONFIG FILE 14 # -- LOAD CONFIG FILE
15 CONFIG_FILE="config.sh" 15 CONFIG_FILE="config.sh"
16 16
17 if [ $# -eq 1 ] 17 if [ $# -eq 1 ]
18 then 18 then
19 CONFIG_FILE="$1" 19 CONFIG_FILE="$1"
20 else 20 else
21 echo "Need to have one and only one argument" 21 echo "Need to have one and only one argument"
22 exit -1 22 exit -1
23 fi 23 fi
24 24
25 source $CONFIG_FILE 25 source $CONFIG_FILE
26 26
27 # -- DEFAULTS VALUES CONFIGURATION 27 # -- DEFAULTS VALUES CONFIGURATION
28 if [ -z "$VECTOR_FILES_ONE" ] 28 if [ -z "$VECTOR_FILES_ONE" ]
29 then 29 then
30 VECTOR_FILES_ONE=false 30 VECTOR_FILES_ONE=false
31 fi 31 fi
32 32
33 33
34 34
35 # -- MAKE DIRECTORIES 35 # -- MAKE DIRECTORIES
36 if [ ! -d "$OUTDIR" ]; 36 if [ ! -d "$OUTDIR" ];
37 then 37 then
38 mkdir -p $OUTDIR 38 mkdir -p $OUTDIR
39 fi 39 fi
40 40
41 if [ ! -d "${NEW_LSTDIR}" ]; 41 if [ ! -d "${NEW_LSTDIR}" ];
42 then 42 then
43 mkdir -p ${NEW_LSTDIR} 43 mkdir -p ${NEW_LSTDIR}
44 fi 44 fi
45 45
46 46
47 # -- BEGIN BY KFOLD 47 # -- BEGIN BY KFOLD
48 for kfold in {1..4} 48 for kfold in {1..4}
49 do 49 do
50 # Some usefull variable 50 # Some usefull variable
51 CHAR_INFO="${DATADIR}/character_information.csv" 51 CHAR_INFO="${DATADIR}/character_information.csv"
52 TRAIN_TYPE_LST="${NEW_LSTDIR}/train_${kfold}_type.lst" 52 TRAIN_TYPE_LST="${NEW_LSTDIR}/train_${kfold}_type.lst"
53 VAL_TYPE_LST="${NEW_LSTDIR}/val_${kfold}_type.lst" 53 VAL_TYPE_LST="${NEW_LSTDIR}/val_${kfold}_type.lst"
54 54
55 # Configuration for the run clustering file 55 # Configuration for the run clustering file
56 if [ ! ${VECTOR_FILES_ONE} ] 56 if [ ${VECTOR_FILES_ONE} == false ]
57 then 57 then
58 VECTOR_FILE="${VECTOR_FILES_BEGIN}_${kfold}${VECTOR_FILES_END}" 58 VECTOR_FILE="${VECTOR_FILES_BEGIN}_${kfold}${VECTOR_FILES_END}"
59 fi 59 fi
60 60
61 TRAIN_LST="${DATADIR}/pvectors_1rst/lst/train_${kfold}.lst" 61 TRAIN_LST="${DATADIR}/pvectors_1rst/lst/train_${kfold}.lst"
62 VAL_LST="${DATADIR}/pvectors_1rst/lst/val_${kfold}.lst" 62 VAL_LST="${DATADIR}/pvectors_1rst/lst/val_${kfold}.lst"
63 EXP_DIR="${OUTDIR}/${kfold}" 63 EXP_DIR="${OUTDIR}/${kfold}"
64 METAS_TYPE="${NEW_LSTDIR}/metas_${kfold}_type.lst" #* 64 METAS_TYPE="${NEW_LSTDIR}/metas_${kfold}_type.lst" #*
65 METAS_CHARACTER="${DATADIR}/masseffect.lst" 65 METAS_CHARACTER="${DATADIR}/masseffect.lst"
66 66
67 67
68 68
69 if [ ! -d "${EXP_DIR}" ]; 69 if [ ! -d "${EXP_DIR}" ];
70 then 70 then
71 mkdir -p ${EXP_DIR} 71 mkdir -p ${EXP_DIR}
72 fi 72 fi
73 73
74 74
75 # Extract character information 75 # Extract character information
76 echo "Extracting character information" 76 echo "Extracting character information"
77 python3 "bin/replace_label.py" \ 77 python3 "bin/replace_label.py" \
78 "${METAS_CHARACTER}" \ 78 "${METAS_CHARACTER}" \
79 "${CHAR_INFO}" \ 79 "${CHAR_INFO}" \
80 --field "type" \ 80 --field "type" \
81 --lst "${TRAIN_LST}" \ 81 --lst "${TRAIN_LST}" \
82 --outfile "${TRAIN_TYPE_LST}" 82 --outfile "${TRAIN_TYPE_LST}"
83 83
84 python3 "bin/replace_label.py" \ 84 python3 "bin/replace_label.py" \
85 "${METAS_CHARACTER}" \ 85 "${METAS_CHARACTER}" \
86 "${CHAR_INFO}" \ 86 "${CHAR_INFO}" \
87 --field "type" \ 87 --field "type" \
88 --lst "${VAL_LST}" \ 88 --lst "${VAL_LST}" \
89 --outfile "${VAL_TYPE_LST}" 89 --outfile "${VAL_TYPE_LST}"
90 90
91 cat "${TRAIN_TYPE_LST}" "${VAL_TYPE_LST}" > "${METAS_TYPE}" 91 cat "${TRAIN_TYPE_LST}" "${VAL_TYPE_LST}" > "${METAS_TYPE}"
92 92
93 source "run-clustering.sh" 93 source "run-clustering.sh"
94 done 94 done
95 95
96 # Regroup measures with respect to character classes 96 # Regroup measures with respect to character classes
97 echo "Regrouping measures with respect to character classes" 97 echo "Regrouping measures with respect to character classes"
98 python3 "bin/regroup-measures.py" ${OUTDIR} 98 python3 "bin/regroup-measures.py" ${OUTDIR}
99 99
100 # Regroup measures with respect to type classes 100 # Regroup measures with respect to type classes
101 echo "Regrouping measures with respect to type classes" 101 echo "Regrouping measures with respect to type classes"
102 python3 "bin/regroup-measures.py" ${OUTDIR} --suffix "_type" --measurefile "measures_type.json" 102 python3 "bin/regroup-measures.py" ${OUTDIR} --suffix "_type" --measurefile "measures_type.json"
103 103
104 104
105 105