From b3371498cf9f2a5a6b2ab7cc4cdd4255d981ad74 Mon Sep 17 00:00:00 2001 From: Mathias Quillot Date: Mon, 15 Jul 2019 09:40:06 +0200 Subject: [PATCH] Run script update with extraction and measures --- run.sh | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/run.sh b/run.sh index e5d783d..40433b2 100755 --- a/run.sh +++ b/run.sh @@ -2,15 +2,44 @@ # quelques petites commandes que l'on souhaite # tester. -OUTDIR="test" +OUTDIR="exp/kmeans_teacher_1/pvector-1" +DATADIR="data" + +kmin=2 +kmax=100 + if [ ! -d "$OUTDIR" ]; then mkdir -p $OUTDIR fi -#python3 bin/cluster_kmeans.py data/pvectors_1rst/pvectors_1.txt \ -# data/pvectors_1rst/lst/train_1.lst \ -# ${OUTDIR} --kmin 5 --kmax 7 +for kfold in {1..4} +do + #echo "kfold = ${kfold}" + pvector_file="${DATADIR}/pvectors_1rst/pvectors_teacher_${kfold}.txt" + lst_dir="${DATADIR}/pvectors_1rst/lst" + output_kfold="${OUTDIR}/${kfold}" + + if [ ! -d "${output_kfold}" ]; + then + mkdir -p ${output_kfold} + fi + + + # Train kmeans + echo "Clustering - ${kfold}" + python3 bin/cluster_kmeans.py "${pvector_file}" \ + "${lst_dir}/train_${kfold}.lst" \ + "${output_kfold}" --kmin ${kmin} --kmax ${kmax} + + for k in $(seq ${kmin} 1 ${kmax}) + do + echo "Kmeans Measuring and extraction - ${k}" + # Extract kmean values + python3 bin/extract_kmeans.py "${output_kfold}/${k}/clustering_${k}.pkl" \ + "${pvector_file}" \ + --outfile "${output_kfold}/${k}/clustered_${k}.txt" + 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" + done +done -python3 bin/extract_kmeans.py test/clustering_5.pkl data/pvectors_1rst/pvectors_1.txt \ - data/pvectors_1rst/lst/val_1.lst #--outfile test.txt \ No newline at end of file -- 1.8.2.3