run_maxwell_simulation_custom.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #! bin/bash
  2. # file which contains model names we want to use for simulation
  3. simulate_models="simulate_models.csv"
  4. # selection of four scenes (only maxwell)
  5. scenes="A, D, G, H"
  6. VECTOR_SIZE=200
  7. for size in {"4","8","16","26","32","40"}; do
  8. for metric in {"lab","mscn","mscn_revisited","low_bits_2","low_bits_3","low_bits_4","low_bits_5","low_bits_6","low_bits_4_shifted_2"}; do
  9. half=$(($size/2))
  10. start=-$half
  11. for counter in {0..4}; do
  12. end=$(($start+$size))
  13. if [ "$end" -gt "$VECTOR_SIZE" ]; then
  14. start=$(($VECTOR_SIZE-$size))
  15. end=$(($VECTOR_SIZE))
  16. fi
  17. if [ "$start" -lt "0" ]; then
  18. start=$((0))
  19. end=$(($size))
  20. fi
  21. for nb_zones in {4,6,8,10,12,14}; do
  22. for mode in {"svd","svdn","svdne"}; do
  23. for model in {"svm_model","ensemble_model","ensemble_model_v2"}; do
  24. FILENAME="data/data_maxwell_N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${metric}_${mode}"
  25. MODEL_NAME="${model}_N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${metric}_${mode}"
  26. CUSTOM_MIN_MAX_FILENAME="N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${metric}_${mode}_min_max"
  27. if grep -xq "${MODEL_NAME}" "${simulate_models}"; then
  28. echo "Run simulation for model ${MODEL_NAME}"
  29. # by default regenerate model
  30. python generate_data_model_random.py --output ${FILENAME} --interval "${start},${end}" --kind ${mode} --metric ${metric} --scenes "${scenes}" --nb_zones "${nb_zones}" --percent 1 --renderer "maxwell" --step 40 --random 1 --custom ${CUSTOM_MIN_MAX_FILENAME}
  31. python train_model.py --data ${FILENAME} --output ${MODEL_NAME} --choice ${model}
  32. python predict_seuil_expe_maxwell_curve.py --interval "${start},${end}" --model "saved_models/${MODEL_NAME}.joblib" --mode "${mode}" --metric ${metric} --limit_detection '2' --custom ${CUSTOM_MIN_MAX_FILENAME}
  33. python save_model_result_in_md_maxwell.py --interval "${start},${end}" --model "saved_models/${MODEL_NAME}.joblib" --mode "${mode}" --metric ${metric}
  34. fi
  35. done
  36. done
  37. done
  38. if [ "$counter" -eq "0" ]; then
  39. start=$(($start+50-$half))
  40. else
  41. start=$(($start+50))
  42. fi
  43. done
  44. done
  45. done