Blame view

run-clustering.sh 3.21 KB
fee5922c3   Mathias Quillot   New way to exec t...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  #
  # This script aims to compute clustering
  # 
  
  
  # -- CONFIGURATION
  # THIS SCRIPT NEEDS THESE VARIABLES
  # Vector file
  #VECTOR_FILE=""
  # Train list
  #TRAIN_LST==""
  # Val list
  #VAL_LST=""
  # Exp directory
  #EXP_DIR=""
  # Metas file with type values
  #METAS_TYPE=""
  # Metas file with character values
  #METAS_CHARACTER=""
  
  
  #echo "VECTOR FILE: $VECTOR_FILE"
  #echo "TRAIN LIST: $TRAIN_LST"
  #echo "VAL LIST: $VAL_LST"
  #echo "EXP DIR: $EXP_DIR"
  #echo "METAS TYPE: $METAS_TYPE"
  #echo "METAS_CHARACTER: $METAS_CHARACTER"
  
  
  
  # -- TRAIN KMEANS 
e63ab06fc   Mathias Quillot   New organisation ...
32
  echo "Clustering - ${kfold}"sss
fee5922c3   Mathias Quillot   New way to exec t...
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  python3 bin/cluster_kmeans.py "${VECTOR_FILE}" \
      "${TRAIN_LST}" \
      "${EXP_DIR}" --kmin ${KMIN} --kmax ${KMAX}
  
  
  
  for k in $(seq ${KMIN} 1 ${KMAX})
  do
      SUB_EXP_DIR="${EXP_DIR}/${k}"
      
      # -- EXTRACT KMEANS VALUES
      echo "Kmeans Measuring and extraction - ${k}"
      python3 bin/extract_kmeans.py "${SUB_EXP_DIR}/clustering_${k}.pkl" \
          "${VECTOR_FILE}" \
          --outfile "${SUB_EXP_DIR}/clustered_${k}.txt"
      # -- MEASURES AND PLOT WITH RESPECT TO CHARACTER VAR
      # Measures
      python3 bin/measure_clustering.py "${SUB_EXP_DIR}/clustered_${k}.txt" \
          "${METAS_CHARACTER}" \
          "${TRAIN_LST}" \
          "${VAL_LST}" \
          --outfile "${SUB_EXP_DIR}/measures.json"
      
      # Plot count matrix for train
      python3 bin/plot-count-matrix.py "${SUB_EXP_DIR}/clustered_${k}.txt" \
          ${VECTOR_FILE} \
          ${TRAIN_LST} \
          --outfile "${SUB_EXP_DIR}/train_count_matrix.pdf"
          
      # Plot count matrix for val
      python3 bin/plot-count-matrix.py "${SUB_EXP_DIR}/clustered_${k}.txt" \
          ${VECTOR_FILE} \
          ${VAL_LST} \
          --outfile "${SUB_EXP_DIR}/val_count_matrix.pdf"
  
      # -- MEASURES AND PLOT WITH RESPECT TO TYPE VAR
      # Measures
      python3 bin/measure_clustering.py "${SUB_EXP_DIR}/clustered_${k}.txt" \
          "${METAS_TYPE}" \
          "${TRAIN_LST}" \
          "${VAL_LST}" \
          --outfile "${SUB_EXP_DIR}/measures_type.json"
          
      # This script plot the count matrix of the train set
      python3 bin/plot-count-matrix.py "${SUB_EXP_DIR}/clustered_${k}.txt" \
          "${METAS_TYPE}" \
          "${TRAIN_LST}" \
          --outfile "${SUB_EXP_DIR}/train_count_matrix_type.pdf"
          
      # This script plot the count matrix of the validation set
      python3 bin/plot-count-matrix.py "${SUB_EXP_DIR}/clustered_${k}.txt" \
          "${METAS_TYPE}" \
          "${VAL_LST}" \
          --outfile "${SUB_EXP_DIR}/val_count_matrix_type.pdf"
95142dfdc   Mathias Quillot   maj. No comment
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
     
   
      # -- MEASURES AND PLOT WITH RESPECT TO LANG VAR
      # Measures
      python3 bin/measure_clustering.py "${SUB_EXP_DIR}/clustered_${k}.txt" \
          "${METAS_LANG}" \
          "${TRAIN_LST}" \
          "${VAL_LST}" \
          --outfile "${SUB_EXP_DIR}/measures_lang.json"
          
      # This script plot the count matrix of the train set
      python3 bin/plot-count-matrix.py "${SUB_EXP_DIR}/clustered_${k}.txt" \
          "${METAS_LANG}" \
          "${TRAIN_LST}" \
          --outfile "${SUB_EXP_DIR}/train_count_matrix_lang.pdf"
          
      # This script plot the count matrix of the validation set
      python3 bin/plot-count-matrix.py "${SUB_EXP_DIR}/clustered_${k}.txt" \
          "${METAS_LANG}" \
          "${VAL_LST}" \
          --outfile "${SUB_EXP_DIR}/val_count_matrix_lang.pdf"
      
fee5922c3   Mathias Quillot   New way to exec t...
109
  done