run_all.sh 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. #!/bin/bash
  2. erased=$1
  3. # file which contains model names we want to use for simulation
  4. file_path="results/models_comparisons.csv"
  5. if [ "${erased}" == "Y" ]; then
  6. echo "Previous data file erased..."
  7. rm ${file_path}
  8. mkdir -p results
  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. all_scenes="A,B,C,D,E,F,G,H,I"
  15. scenes="A,B,D,G,H,I"
  16. test_scene="E"
  17. min_diff_metric="min_diff_filter"
  18. svd_metric="svd_reconstruction"
  19. ipca_metric="ipca_reconstruction"
  20. fast_ica_metric="fast_ica_reconstruction"
  21. all_features="${svd_metric},${ipca_metric},${fast_ica_metric}"
  22. for window in {"3","5","7","9","11"}; do
  23. echo python generate/generate_reconstructed_data.py --features ${min_diff_metric} --params ${window},${window} --size 100,100 --scenes ${all_scenes}
  24. done
  25. # First compute svd_reconstruction
  26. for begin in {80,85,90,95,100,105,110}; do
  27. for end in {150,160,170,180,190,200}; do
  28. echo python generate/generate_reconstructed_data.py --features ${svd_metric} --params ${begin},${end} --size 100,100 --scenes ${all_scenes}
  29. OUTPUT_DATA_FILE_TEST="${svd_metric}_scene_E_nb_zones_16_B${begin}_E${end}_test"
  30. # echo python generate/generate_dataset.py --output data/${OUTPUT_DATA_FILE} --features ${svd_metric} --scenes ${test_scene} --params ${begin},${end} --nb_zones 16 --random 1 --size 100,100
  31. for zone in {10,11,12}; do
  32. for balancing in {0,1}; do
  33. OUTPUT_DATA_FILE="${svd_metric}_nb_zones_${zone}_B${begin}_E${end}_balancing${balancing}"
  34. if grep -xq "${OUTPUT_DATA_FILE}" "${file_path}"; then
  35. echo "SVD model ${OUTPUT_DATA_FILE} already generated"
  36. else
  37. echo "Run computation for SVD model ${OUTPUT_DATA_FILE}"
  38. # echo python generate/generate_dataset.py --output data/${OUTPUT_DATA_FILE} --features ${svd_metric} --scenes ${scenes} --params ${begin},${end} --nb_zones ${zone} --random 1 --size 100,100
  39. # echo python train_model.py --data data/${OUTPUT_DATA_FILE} --output ${OUTPUT_DATA_FILE} --balancing ${balancing}
  40. # echo python prediction_model.py --data data/${OUTPUT_DATA_FILE_TEST}.train --model saved_models/${OUTPUT_DATA_FILE}.json
  41. fi
  42. done
  43. done
  44. done
  45. done
  46. # computation of ipca_reconstruction
  47. ipca_batch_size=55
  48. for component in {10,15,20,25,30,35,45,50}; do
  49. echo python generate/generate_reconstructed_data.py --features ${ipca_metric} --params ${component},${ipca_batch_size} --size 100,100 --scenes ${all_scenes}
  50. OUTPUT_DATA_FILE_TEST="${ipca_metric}_scene_E_nb_zones_16_B${begin}_E${end}_test"
  51. # echo python generate/generate_dataset.py --output data/${OUTPUT_DATA_FILE} --features ${ipca_metric} --scenes ${test_scene} --params ${component},${ipca_batch_size} --nb_zones 16 --random 1 --size 100,100
  52. for zone in {10,11,12}; do
  53. for balancing in {0,1}; do
  54. OUTPUT_DATA_FILE="${ipca_metric}_nb_zones_${zone}_N${component}_BS${ipca_batch_size}_balancing${balancing}"
  55. if grep -xq "${OUTPUT_DATA_FILE}" "${file_path}"; then
  56. echo "IPCA model ${OUTPUT_DATA_FILE} already generated"
  57. else
  58. echo "Run computation for IPCA model ${OUTPUT_DATA_FILE}"
  59. # echo python generate/generate_dataset.py --output data/${OUTPUT_DATA_FILE} --features ${ipca_metric} --scenes ${scenes} --params ${component},${ipca_batch_size} --nb_zones ${zone} --random 1 --size 100,100
  60. # echo python train_model.py --data data/${OUTPUT_DATA_FILE} --output ${OUTPUT_DATA_FILE} --balancing ${balancing}
  61. # echo python prediction_model.py --data data/${OUTPUT_DATA_FILE_TEST}.train --model saved_models/${OUTPUT_DATA_FILE}.json
  62. fi
  63. done
  64. done
  65. done
  66. # computation of fast_ica_reconstruction
  67. for component in {50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200}; do
  68. echo python generate/generate_reconstructed_data.py --features ${fast_ica_metric} --params ${component} --size 100,100 --scenes ${all_scenes}
  69. OUTPUT_DATA_FILE_TEST="${fast_ica_metric}_scene_E_nb_zones_16_B${begin}_E${end}_test"
  70. # echo python generate/generate_dataset.py --output data/${OUTPUT_DATA_FILE} --features ${fast_ica_metric} --scenes ${test_scene} --params ${component} --nb_zones 16 --random 1 --size 100,100
  71. for zone in {10,11,12}; do
  72. OUTPUT_DATA_FILE="${fast_ica_metric}_nb_zones_${zone}_N${component}"
  73. if grep -xq "${OUTPUT_DATA_FILE}" "${file_path}"; then
  74. echo "Fast ICA model ${OUTPUT_DATA_FILE} already generated"
  75. else
  76. echo "Run computation for Fast ICA model ${OUTPUT_DATA_FILE}"
  77. # echo python generate/generate_dataset.py --output data/${OUTPUT_DATA_FILE} --features ${fast_ica_metric} --scenes ${scenes} --params ${component} --nb_zones ${zone} --random 1 --size 100,100
  78. # echo python train_model.py --data data/${OUTPUT_DATA_FILE} --output ${OUTPUT_DATA_FILE} --balancing ${balancing}
  79. # echo python prediction_model.py --data data/${OUTPUT_DATA_FILE_TEST}.train --model saved_models/${OUTPUT_DATA_FILE}.json
  80. fi
  81. done
  82. done
  83. # RUN LATER
  84. # compute using all transformation methods
  85. ipca_batch_size=55
  86. : '
  87. for begin in {80,85,90,95,100,105,110}; do
  88. for end in {150,160,170,180,190,200}; do
  89. for ipca_component in {10,15,20,25,30,35,45,50}; do
  90. for fast_ica_component in {50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200}; do
  91. for zone in {10,11,12}; do
  92. 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}"
  93. if grep -xq "${OUTPUT_DATA_FILE}" "${file_path}"; then
  94. echo "Transformation combination model ${OUTPUT_DATA_FILE} already generated"
  95. else
  96. echo "Run computation for Transformation combination model ${OUTPUT_DATA_FILE}"
  97. params="${begin}, ${end} :: ${ipca_component}, ${ipca_batch_size} :: ${fast_ica_component}"
  98. python generate/generate_dataset.py --output data/${OUTPUT_DATA_FILE} --metric ${all_features} --renderer ${renderer} --scenes ${scenes} --params "${params}" --nb_zones ${zone} --random 1 --size 100,100
  99. python train_model.py --data data/${OUTPUT_DATA_FILE} --output ${OUTPUT_DATA_FILE} &
  100. fi
  101. done
  102. done
  103. done
  104. done
  105. done
  106. '