Blame view

run-measures.sh 2.42 KB
42b4edb5a   Mathias Quillot   This file aims to...
1
2
3
  # Pour le moment, le run ne fait qu'executer
  # quelques petites commandes que l'on souhaite
  # tester.
e63ab06fc   Mathias Quillot   New organisation ...
4
5
6
  set -e
  
  OUTDIR="exp/kmeans_euclidian/ivectors"
95142dfdc   Mathias Quillot   maj. No comment
7
  EXP_DIR=${OUTDIR}
42b4edb5a   Mathias Quillot   This file aims to...
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  DATADIR="data"
  NEW_LSTDIR="${OUTDIR}/lst"
  
  kmin=2
  kmax=100
  
  if [ ! -d "$OUTDIR" ];
  then
      mkdir -p $OUTDIR
  fi
  
  if [ ! -d "$NEW_LSTDIR" ];
  then
      mkdir -p $NEW_LSTDIR
  fi
  
  for kfold in {1..4}
  do
e63ab06fc   Mathias Quillot   New organisation ...
26
27
      #pvector_file="${DATADIR}/pvectors_1rst/pvectors_teacher_${kfold}.txt"
      VECTOR_FILE="${DATADIR}/ivectors.txt"
42b4edb5a   Mathias Quillot   This file aims to...
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
      lst_dir="${DATADIR}/pvectors_1rst/lst"
      output_kfold="${OUTDIR}/${kfold}"
      
      #python3 "bin/replace_label.py" \
      #    "${DATADIR}/masseffect.lst" \
      #    "${DATADIR}/character_information.csv" \
      #    --field "type" --lst "data/pvectors_1rst/lst/train_${kfold}.lst" \
      #    --outfile "${NEW_LSTDIR}/train_${kfold}_type.lst"
  
      #python3 "bin/replace_label.py" \
      #    "${DATADIR}/masseffect.lst" \
      #    "${DATADIR}/character_information.csv" \
      #    --field "type" --lst "data/pvectors_1rst/lst/val_${kfold}.lst" \
      #    --outfile "${NEW_LSTDIR}/val_${kfold}_type.lst"
     
151e596e3   Mathias Quillot   Some modification...
43
      #cat "${NEW_LSTDIR}/train_${kfold}_type.lst" "${NEW_LSTDIR}/val_${kfold}_type.lst" > "${NEW_LSTDIR}/metas_${kfold}_type.lst"
95142dfdc   Mathias Quillot   maj. No comment
44
45
46
47
48
49
50
51
52
53
54
55
56
57
      TRAIN_LST=${DATADIR}/pvectors_1rst/lst/train_${kfold}.lst
      VAL_LST=${DATADIR}/pvectors_1rst/lst/val_${kfold}.lst
      TRAIN_LANG_LST=${NEW_LSTDIR}/train_${kfold}_lang.lst
      VAL_LANG_LST=${NEW_LSTDIR}/val_${kfold}_lang.lst
      METAS_LANG=${NEW_LSTDIR}/metas_${kfold}_lang.lst
       
      # EXTRACT LANGUAGE INFORMATION
      awk '$2=$1' FS=, OFS=, ${TRAIN_LST} > ${TRAIN_LANG_LST}
      echo "VAL EXTRACT LANGUAGE INFO DONE"
      awk '$2=$1' FS=, OFS=, ${VAL_LST} > ${VAL_LANG_LST}
      echo "TRAIN EXTRACT LANGUAGE INFO DONE"
      cat "${TRAIN_LANG_LST}" "${VAL_LANG_LST}" > "${METAS_LANG}"
      echo "GLOBAL EXTRACT LANGUAGE INFO DONE"
    
42b4edb5a   Mathias Quillot   This file aims to...
58

42b4edb5a   Mathias Quillot   This file aims to...
59
60
61
62
63
      echo "Clustering - ${kfold}"
  
      for k in $(seq ${kmin} 1 ${kmax})
      do
          echo "Kmeans Measuring and ploting - ${k}"
95142dfdc   Mathias Quillot   maj. No comment
64

e63ab06fc   Mathias Quillot   New organisation ...
65
          SUB_EXP_DIR="${EXP_DIR}/${kfold}/${k}"
95142dfdc   Mathias Quillot   maj. No comment
66

e63ab06fc   Mathias Quillot   New organisation ...
67
68
69
70
          # -- EXTRACT CLUSTERING LABELS
          python3 bin/extract_kmeans.py "${SUB_EXP_DIR}/clustering_${k}.pkl" \
              "${VECTOR_FILE}" \
              --outfile "${SUB_EXP_DIR}/clustered_${k}.txt"
95142dfdc   Mathias Quillot   maj. No comment
71

e63ab06fc   Mathias Quillot   New organisation ...
72
73
74
75
          # -- MEASURES AND PLOT
          source steps/measure_clustering_char.sh
          source steps/measure_clustering_type.sh
          source steps/measure_clustering_lang.sh
95142dfdc   Mathias Quillot   maj. No comment
76

e63ab06fc   Mathias Quillot   New organisation ...
77
          rm ${SUB_EXP_DIR}/clustered_${k}.txt
42b4edb5a   Mathias Quillot   This file aims to...
78
79
      done
  done