Commit b3371498cf9f2a5a6b2ab7cc4cdd4255d981ad74

Authored by Mathias Quillot
1 parent 993ea26cfe
Exists in master

Run script update with extraction and measures

Showing 1 changed file with 35 additions and 6 deletions Inline Diff

1 # Pour le moment, le run ne fait qu'executer 1 # Pour le moment, le run ne fait qu'executer
2 # quelques petites commandes que l'on souhaite 2 # quelques petites commandes que l'on souhaite
3 # tester. 3 # tester.
4 4
5 OUTDIR="test" 5 OUTDIR="exp/kmeans_teacher_1/pvector-1"
6 DATADIR="data"
7
8 kmin=2
9 kmax=100
10
6 if [ ! -d "$OUTDIR" ]; 11 if [ ! -d "$OUTDIR" ];
7 then 12 then
8 mkdir -p $OUTDIR 13 mkdir -p $OUTDIR
9 fi 14 fi
10 15
11 #python3 bin/cluster_kmeans.py data/pvectors_1rst/pvectors_1.txt \ 16 for kfold in {1..4}
12 # data/pvectors_1rst/lst/train_1.lst \ 17 do
13 # ${OUTDIR} --kmin 5 --kmax 7 18 #echo "kfold = ${kfold}"
19 pvector_file="${DATADIR}/pvectors_1rst/pvectors_teacher_${kfold}.txt"
20 lst_dir="${DATADIR}/pvectors_1rst/lst"
21 output_kfold="${OUTDIR}/${kfold}"
22
23 if [ ! -d "${output_kfold}" ];
24 then
25 mkdir -p ${output_kfold}
26 fi
14 27
15 python3 bin/extract_kmeans.py test/clustering_5.pkl data/pvectors_1rst/pvectors_1.txt \ 28
16 data/pvectors_1rst/lst/val_1.lst #--outfile test.txt 29 # Train kmeans
30 echo "Clustering - ${kfold}"
31 python3 bin/cluster_kmeans.py "${pvector_file}" \
32 "${lst_dir}/train_${kfold}.lst" \
33 "${output_kfold}" --kmin ${kmin} --kmax ${kmax}
34
35 for k in $(seq ${kmin} 1 ${kmax})
36 do
37 echo "Kmeans Measuring and extraction - ${k}"
38 # Extract kmean values
39 python3 bin/extract_kmeans.py "${output_kfold}/${k}/clustering_${k}.pkl" \
40 "${pvector_file}" \
41 --outfile "${output_kfold}/${k}/clustered_${k}.txt"
42 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"
43 done
44 done
45
46