Blame view

run.sh 2.35 KB
14d6e0cb3   Mathias Quillot   Basic run.sh for ...
1

fee5922c3   Mathias Quillot   New way to exec t...
2
3
4
  #OUTDIR="exp/test/pvector-2"
  #DATADIR="data"
  #NEW_LSTDIR="${OUTDIR}/lst"
b3371498c   Mathias Quillot   Run script update...
5

fee5922c3   Mathias Quillot   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   Mathias Quillot   Run script update...
10

fee5922c3   Mathias Quillot   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   Mathias Quillot   Basic run.sh for ...
36
37
38
39
  if [ ! -d "$OUTDIR" ];
  then
      mkdir -p $OUTDIR
  fi
29644ae6c   Mathias Quillot   New receip to bui...
40
41
42
43
  if [ ! -d "${NEW_LSTDIR}" ];
  then
      mkdir -p ${NEW_LSTDIR}
  fi
fee5922c3   Mathias Quillot   New way to exec t...
44
45
46
  
  # -- BEGIN BY KFOLD
  for kfold in {1..4}
b3371498c   Mathias Quillot   Run script update...
47
  do
fee5922c3   Mathias Quillot   New way to exec t...
48
49
50
51
      # 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"
b3371498c   Mathias Quillot   Run script update...
52
      
fee5922c3   Mathias Quillot   New way to exec t...
53
      # Configuration for the run clustering file
4a691a3d4   Mathias Quillot   Few changes. Repa...
54
      if [ ${VECTOR_FILES_ONE} == false ]
b3371498c   Mathias Quillot   Run script update...
55
      then
fee5922c3   Mathias Quillot   New way to exec t...
56
          VECTOR_FILE="${VECTOR_FILES_BEGIN}_${kfold}${VECTOR_FILES_END}"
b3371498c   Mathias Quillot   Run script update...
57
      fi
29644ae6c   Mathias Quillot   New receip to bui...
58
      
fee5922c3   Mathias Quillot   New way to exec t...
59
60
61
62
63
64
65
66
67
68
69
70
      TRAIN_LST="${DATADIR}/pvectors_1rst/lst/train_${kfold}.lst"
      VAL_LST="${DATADIR}/pvectors_1rst/lst/val_${kfold}.lst"
      EXP_DIR="${OUTDIR}/${kfold}"
      METAS_TYPE="${NEW_LSTDIR}/metas_${kfold}_type.lst" #*
      METAS_CHARACTER="${DATADIR}/masseffect.lst"
  
      
      
      if [ ! -d "${EXP_DIR}" ];
      then
          mkdir -p ${EXP_DIR}
      fi
29644ae6c   Mathias Quillot   New receip to bui...
71
72
73
      # Extract character information
      echo "Extracting character information"
      python3 "bin/replace_label.py" \
fee5922c3   Mathias Quillot   New way to exec t...
74
75
76
77
78
          "${METAS_CHARACTER}" \
          "${CHAR_INFO}" \
          --field "type" \
          --lst "${TRAIN_LST}" \
          --outfile "${TRAIN_TYPE_LST}"
29644ae6c   Mathias Quillot   New receip to bui...
79
      python3 "bin/replace_label.py" \
fee5922c3   Mathias Quillot   New way to exec t...
80
81
82
83
84
85
86
87
88
          "${METAS_CHARACTER}" \
          "${CHAR_INFO}" \
          --field "type" \
          --lst "${VAL_LST}" \
          --outfile "${VAL_TYPE_LST}"
  
      cat "${TRAIN_TYPE_LST}" "${VAL_TYPE_LST}" > "${METAS_TYPE}"
  
      source "run-clustering.sh"
b3371498c   Mathias Quillot   Run script update...
89
  done
14d6e0cb3   Mathias Quillot   Basic run.sh for ...
90

fee5922c3   Mathias Quillot   New way to exec t...
91
92
93
94
95
96
97
  # 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"