Commit 42b4edb5a6041c50dc1f321f04f4abb7665135df

Authored by Mathias Quillot
1 parent 6ff538c4f1
Exists in master

This file aims to change a lot. Is a way to test something without modifying run.sh

Showing 1 changed file with 78 additions and 0 deletions Side-by-side Diff

  1 +# Pour le moment, le run ne fait qu'executer
  2 +# quelques petites commandes que l'on souhaite
  3 +# tester.
  4 +
  5 +OUTDIR="exp/kmeans_teacher_1/pvector-1"
  6 +DATADIR="data"
  7 +NEW_LSTDIR="${OUTDIR}/lst"
  8 +
  9 +kmin=2
  10 +kmax=100
  11 +
  12 +if [ ! -d "$OUTDIR" ];
  13 +then
  14 + mkdir -p $OUTDIR
  15 +fi
  16 +
  17 +if [ ! -d "$NEW_LSTDIR" ];
  18 +then
  19 + mkdir -p $NEW_LSTDIR
  20 +fi
  21 +
  22 +for kfold in {1..4}
  23 +do
  24 + pvector_file="${DATADIR}/pvectors_1rst/pvectors_teacher_${kfold}.txt"
  25 + lst_dir="${DATADIR}/pvectors_1rst/lst"
  26 + output_kfold="${OUTDIR}/${kfold}"
  27 +
  28 + #python3 "bin/replace_label.py" \
  29 + # "${DATADIR}/masseffect.lst" \
  30 + # "${DATADIR}/character_information.csv" \
  31 + # --field "type" --lst "data/pvectors_1rst/lst/train_${kfold}.lst" \
  32 + # --outfile "${NEW_LSTDIR}/train_${kfold}_type.lst"
  33 +
  34 + #python3 "bin/replace_label.py" \
  35 + # "${DATADIR}/masseffect.lst" \
  36 + # "${DATADIR}/character_information.csv" \
  37 + # --field "type" --lst "data/pvectors_1rst/lst/val_${kfold}.lst" \
  38 + # --outfile "${NEW_LSTDIR}/val_${kfold}_type.lst"
  39 +
  40 + cat "${NEW_LSTDIR}/train_${kfold}_type.lst" "${NEW_LSTDIR}/val_${kfold}_type.lst" > "${NEW_LSTDIR}/metas_${kfold}_type.lst"
  41 +
  42 +
  43 + echo "Clustering - ${kfold}"
  44 +
  45 + for k in $(seq ${kmin} 1 ${kmax})
  46 + do
  47 + echo "Kmeans Measuring and ploting - ${k}"
  48 +
  49 + # This script compute measures from clustering
  50 + #python3 bin/measure_clustering.py "${output_kfold}/${k}/clustered_${k}.txt" "${pvector_file}" "${lst_dir}/train_${kfold}.lst" "${lst_dir}/val_${kfold}.lst" --outfile "${output_kfold}/${k}/measures.json"
  51 +
  52 + python3 bin/measure_clustering.py "${output_kfold}/${k}/clustered_${k}.txt" \
  53 + "${NEW_LSTDIR}/metas_${kfold}_type.lst" "${lst_dir}/train_${kfold}.lst" \
  54 + "${lst_dir}/val_${kfold}.lst" \
  55 + --outfile "${output_kfold}/${k}/measures_type.json"
  56 +
  57 + # This script plot the count matrix of the train set
  58 + python3 bin/plot-count-matrix.py ${output_kfold}/${k}/clustered_${k}.txt \
  59 + ${NEW_LSTDIR}/metas_${kfold}_type.lst ${lst_dir}/train_${kfold}.lst \
  60 + --outfile ${output_kfold}/${k}/train_count_matrix_type.pdf
  61 +
  62 + # This script plot the count matrix of the validation set
  63 + python3 bin/plot-count-matrix.py ${output_kfold}/${k}/clustered_${k}.txt \
  64 + ${NEW_LSTDIR}/metas_${kfold}_type.lst ${lst_dir}/val_${kfold}.lst \
  65 + --outfile ${output_kfold}/${k}/val_count_matrix_type.pdf
  66 +
  67 + # This script plot the count matrix of the train set
  68 + #python3 bin/plot-count-matrix.py ${output_kfold}/${k}/clustered_${k}.txt \
  69 + #${pvector_file} ${lst_dir}/train_${kfold}.lst \
  70 + #--outfile ${output_kfold}/${k}/train_count_matrix.pdf
  71 +
  72 + # This script plot the count matrix of the validation set
  73 + #python3 bin/plot-count-matrix.py ${output_kfold}/${k}/clustered_${k}.txt \
  74 + #${pvector_file} ${lst_dir}/val_${kfold}.lst \
  75 + #--outfile ${output_kfold}/${k}/val_count_matrix.pdf
  76 + done
  77 +done