From 42b4edb5a6041c50dc1f321f04f4abb7665135df Mon Sep 17 00:00:00 2001 From: Mathias Quillot Date: Mon, 22 Jul 2019 12:16:22 +0200 Subject: [PATCH] This file aims to change a lot. Is a way to test something without modifying run.sh --- run-measures.sh | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 run-measures.sh diff --git a/run-measures.sh b/run-measures.sh new file mode 100755 index 0000000..c0dc9f8 --- /dev/null +++ b/run-measures.sh @@ -0,0 +1,78 @@ +# Pour le moment, le run ne fait qu'executer +# quelques petites commandes que l'on souhaite +# tester. + +OUTDIR="exp/kmeans_teacher_1/pvector-1" +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 + pvector_file="${DATADIR}/pvectors_1rst/pvectors_teacher_${kfold}.txt" + 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" + + cat "${NEW_LSTDIR}/train_${kfold}_type.lst" "${NEW_LSTDIR}/val_${kfold}_type.lst" > "${NEW_LSTDIR}/metas_${kfold}_type.lst" + + + echo "Clustering - ${kfold}" + + for k in $(seq ${kmin} 1 ${kmax}) + do + echo "Kmeans Measuring and ploting - ${k}" + + # This script compute measures from clustering + #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" + + python3 bin/measure_clustering.py "${output_kfold}/${k}/clustered_${k}.txt" \ + "${NEW_LSTDIR}/metas_${kfold}_type.lst" "${lst_dir}/train_${kfold}.lst" \ + "${lst_dir}/val_${kfold}.lst" \ + --outfile "${output_kfold}/${k}/measures_type.json" + + # This script plot the count matrix of the train set + python3 bin/plot-count-matrix.py ${output_kfold}/${k}/clustered_${k}.txt \ + ${NEW_LSTDIR}/metas_${kfold}_type.lst ${lst_dir}/train_${kfold}.lst \ + --outfile ${output_kfold}/${k}/train_count_matrix_type.pdf + + # This script plot the count matrix of the validation set + python3 bin/plot-count-matrix.py ${output_kfold}/${k}/clustered_${k}.txt \ + ${NEW_LSTDIR}/metas_${kfold}_type.lst ${lst_dir}/val_${kfold}.lst \ + --outfile ${output_kfold}/${k}/val_count_matrix_type.pdf + + # This script plot the count matrix of the train set + #python3 bin/plot-count-matrix.py ${output_kfold}/${k}/clustered_${k}.txt \ + #${pvector_file} ${lst_dir}/train_${kfold}.lst \ + #--outfile ${output_kfold}/${k}/train_count_matrix.pdf + + # This script plot the count matrix of the validation set + #python3 bin/plot-count-matrix.py ${output_kfold}/${k}/clustered_${k}.txt \ + #${pvector_file} ${lst_dir}/val_${kfold}.lst \ + #--outfile ${output_kfold}/${k}/val_count_matrix.pdf + done +done + -- 1.8.2.3