run_maxwell_simulation.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. if grep -q "${MODEL_NAME}" "${simulate_models}"; then
  27. echo "Run simulation for model ${MODEL_NAME}"
  28. # by default regenerate model
  29. python generate_data_model_random_maxwell.py --output ${FILENAME} --interval "${start},${end}" --kind ${mode} --metric ${metric} --scenes "${scenes}" --nb_zones "${nb_zones}" --percent 1 --sep ';' --rowindex '0'
  30. python train_model.py --data ${FILENAME} --output ${MODEL_NAME} --choice ${model}
  31. python predict_seuil_expe_maxwell_curve.py --interval "${start},${end}" --model "saved_models/${MODEL_NAME}.joblib" --mode "${mode}" --metric ${metric} --limit_detection '2'
  32. python save_model_result_in_md_maxwell.py --interval "${start},${end}" --model "saved_models/${MODEL_NAME}.joblib" --mode "${mode}" --metric ${metric}
  33. fi
  34. done
  35. done
  36. done
  37. if [ "$counter" -eq "0" ]; then
  38. start=$(($start+50-$half))
  39. else
  40. start=$(($start+50))
  41. fi
  42. done
  43. done
  44. done