Blame view

run.sh 1.24 KB
14d6e0cb3   Mathias Quillot   Basic run.sh for ...
1
2
3
  # Pour le moment, le run ne fait qu'executer
  # quelques petites commandes que l'on souhaite
  # tester.
b3371498c   Mathias Quillot   Run script update...
4
5
6
7
8
  OUTDIR="exp/kmeans_teacher_1/pvector-1"
  DATADIR="data"
  
  kmin=2
  kmax=100
14d6e0cb3   Mathias Quillot   Basic run.sh for ...
9
10
11
12
  if [ ! -d "$OUTDIR" ];
  then
      mkdir -p $OUTDIR
  fi
b3371498c   Mathias Quillot   Run script update...
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
  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
14d6e0cb3   Mathias Quillot   Basic run.sh for ...
42