run.sh 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #!/bin/bash
  2. erased=$1
  3. # file which contains model names we want to use for simulation
  4. file_path="models_info/models_comparisons.csv"
  5. if [ "${erased}" == "Y" ]; then
  6. echo "Previous data file erased..."
  7. rm ${file_path}
  8. mkdir -p models_info
  9. touch ${file_path}
  10. # add of header
  11. echo 'model_name; global_train_size; global_test_size; filtered_train_size; filtered_test_size; f1_train; f1_test; recall_train; recall_test; presicion_train; precision_test; acc_train; acc_test; roc_auc_train; roc_auc_test;' >> ${file_path}
  12. fi
  13. renderer="all"
  14. scenes="A, B, C, D, E, F, G, H, I"
  15. svd_metric="svd_reconstruction"
  16. ipca_metric="ipca_reconstruction"
  17. fast_ica_metric="fast_ica_reconstruction"
  18. all_metrics="${svd_metric},${ipca_metric},${fast_ica_metric}"
  19. # First compute svd_reconstruction
  20. for begin in {80,85,90,95,100,105,110}; do
  21. for end in {150,160,170,180,190,200}; do
  22. python generate_reconstructed_data.py --metric ${svd_metric} --param "${begin}, ${end}"
  23. for zone in {6,8,10,12}; do
  24. OUTPUT_DATA_FILE="${svd_metric}_nb_zones_${zone}_B${begin}_E${end}"
  25. if grep -xq "${OUTPUT_DATA_FILE}" "${file_path}"; then
  26. echo "SVD model ${OUTPUT_DATA_FILE} already generated"
  27. else
  28. echo "Run computation for SVD model ${OUTPUT_DATA_FILE}"
  29. python generate_dataset.py --output data/${OUTPUT_DATA_FILE} --metrics ${svd_metric} --renderer ${renderer} --scenes ${scenes} --params "${begin}, ${end}" --nb_zones ${zone} --random 1
  30. python train_model.py --data data/${OUTPUT_DATA_FILE} --output ${OUTPUT_DATA_FILE} &
  31. fi
  32. done
  33. done
  34. done
  35. # computation of ipca_reconstruction
  36. ipca_batch_size=55
  37. for component in {10,15,20,25,30,35,45,50}; do
  38. python generate_reconstructed_data.py --metric ${ipca_metric} --param "${component},${ipca_batch_size}"
  39. for zone in {6,8,10,12}; do
  40. OUTPUT_DATA_FILE="${ipca_metric}_nb_zones_${zone}_N${component}_BS${ipca_batch_size}"
  41. if grep -xq "${OUTPUT_DATA_FILE}" "${file_path}"; then
  42. echo "IPCA model ${OUTPUT_DATA_FILE} already generated"
  43. else
  44. echo "Run computation for IPCA model ${OUTPUT_DATA_FILE}"
  45. python generate_dataset.py --output data/${OUTPUT_DATA_FILE} --metrics ${ipca_metric} --renderer ${renderer} --scenes ${scenes} --params "${component},${ipca_batch_size}" --nb_zones ${zone} --random 1
  46. python train_model.py --data data/${OUTPUT_DATA_FILE} --output ${OUTPUT_DATA_FILE} &
  47. fi
  48. done
  49. done
  50. # computation of fast_ica_reconstruction
  51. for component in {50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200}; do
  52. python generate_reconstructed_data.py --metric ${fast_ica_metric} --param "${component}"
  53. for zone in {6,8,10,12}; do
  54. OUTPUT_DATA_FILE="${fast_ica_metric}_nb_zones_${zone}_N${component}"
  55. if grep -xq "${OUTPUT_DATA_FILE}" "${file_path}"; then
  56. echo "Fast ICA model ${OUTPUT_DATA_FILE} already generated"
  57. else
  58. echo "Run computation for Fast ICA model ${OUTPUT_DATA_FILE}"
  59. python generate_dataset.py --output data/${OUTPUT_DATA_FILE} --metrics ${fast_ica_metric} --renderer ${renderer} --scenes ${scenes} --params "${component}" --nb_zones ${zone} --random 1
  60. python train_model.py --data data/${OUTPUT_DATA_FILE} --output ${OUTPUT_DATA_FILE} &
  61. fi
  62. done
  63. done
  64. # RUN LATER
  65. # compute using all transformation methods
  66. ipca_batch_size=55
  67. : '
  68. for begin in {80,85,90,95,100,105,110}; do
  69. for end in {150,160,170,180,190,200}; do
  70. for ipca_component in {10,15,20,25,30,35,45,50}; do
  71. for fast_ica_component in {50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200}; do
  72. for zone in {6,8,10,12}; do
  73. OUTPUT_DATA_FILE="${svd_metric}_B${begin}_E${end}_${ipca_metric}__N${ipca_component}_BS${ipca_batch_size}_${fast_ica_metric}_N${fast_ica_component}_nb_zones_${zone}"
  74. if grep -xq "${OUTPUT_DATA_FILE}" "${file_path}"; then
  75. echo "Transformation combination model ${OUTPUT_DATA_FILE} already generated"
  76. else
  77. echo "Run computation for Transformation combination model ${OUTPUT_DATA_FILE}"
  78. params="${begin}, ${end} :: ${ipca_component}, ${ipca_batch_size} :: ${fast_ica_component}"
  79. python generate_dataset.py --output data/${OUTPUT_DATA_FILE} --metric ${all_metrics} --renderer ${renderer} --scenes ${scenes} --params "${params}" --nb_zones ${zone} --random 1
  80. python train_model.py --data data/${OUTPUT_DATA_FILE} --output ${OUTPUT_DATA_FILE} &
  81. fi
  82. done
  83. done
  84. done
  85. done
  86. done
  87. '