run_maxwell_simulation.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. # model choice
  7. model="rfe_svm_model"
  8. # check feature param
  9. if [ -z "$1" ]
  10. then
  11. echo "No argument supplied"
  12. echo "Need of feature information"
  13. exit 1
  14. fi
  15. if [[ "$1" =~ ^(filters_statistics|filters_statistics_sobel|svd|svd_sobel)$ ]]; then
  16. echo "$1 is in the list"
  17. else
  18. echo "$1 is not in the list"
  19. exit 1
  20. fi
  21. # accept feature param
  22. feature=$1
  23. declare -A featuresSize
  24. featuresSize=( ["filters_statistics"]="26" ["svd"]="200" ["filters_statistics_sobel"]="27" ["svd_sobel"]="201")
  25. size=${featuresSize[${feature}]}
  26. for nb_zones in {10,11,12}; do
  27. for mode in {"svd","svdn","svdne"}; do
  28. FILENAME="data/${model}_N${size}_B0_E${size}_nb_zones_${nb_zones}_${feature}_${mode}_all"
  29. MODEL_NAME="${model}_N${size}_B0_E${size}_nb_zones_${nb_zones}_${feature}_${mode}_all"
  30. CUSTOM_MIN_MAX_FILENAME="N${size}_B0_E${size}_nb_zones_${nb_zones}_${feature}_${mode}_all_min_max"
  31. # only compute if necessary (perhaps server will fall.. Just in case)
  32. if grep -xq "${MODEL_NAME}" "${simulate_models}"; then
  33. # Use of already generated model
  34. python generate/generate_data_model_random.py --output ${FILENAME} --interval "0,${size}" --kind ${mode} --feature ${feature} --scenes "${scenes}" --nb_zones "${nb_zones}" --percent 1 --renderer "maxwell" --step 40 --random 1 --custom ${CUSTOM_MIN_MAX_FILENAME}
  35. python train_model.py --data ${FILENAME} --output ${MODEL_NAME} --choice ${model}
  36. python prediction/predict_seuil_expe_maxwell_curve.py --interval "0,${size}" --model "saved_models/${MODEL_NAME}.joblib" --mode "${mode}" --feature ${feature} --custom ${CUSTOM_MIN_MAX_FILENAME}
  37. fi
  38. done
  39. done