generateAndTrain_maxwell_custom_optimization.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #! bin/bash
  2. if [ -z "$1" ]
  3. then
  4. echo "No argument supplied"
  5. echo "Need of vector size"
  6. exit 1
  7. fi
  8. if [ -z "$2" ]
  9. then
  10. echo "No argument supplied"
  11. echo "Need of feature information"
  12. exit 1
  13. fi
  14. if [ -z "$3" ]
  15. then
  16. echo "No argument supplied"
  17. echo "Need of kind of data to use"
  18. exit 1
  19. fi
  20. if [ -z "$4" ]
  21. then
  22. echo "No argument supplied"
  23. echo "Use of filters or attributes"
  24. exit 1
  25. fi
  26. size=$1
  27. feature=$2
  28. data=$3
  29. filter=$4
  30. # selection of four scenes (only maxwell)
  31. scenes="A, D, G, H"
  32. result_filename="results/optimization_comparisons_${filter}.csv"
  33. start=0
  34. end=$size
  35. #for nb_zones in {4,6,8,10,12}; do
  36. for nb_zones in {10,12}; do
  37. for mode in {"svd","svdn","svdne"}; do
  38. #for model in {"svm_model","ensemble_model",""}; do
  39. model="svm_model"
  40. FILENAME="data/${model}_N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${feature}_${mode}_${data}_${filter}"
  41. MODEL_NAME="${model}_N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${feature}_${mode}_${data}_${filter}"
  42. CUSTOM_MIN_MAX_FILENAME="N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${feature}_${mode}_${data}_${filter}_min_max"
  43. echo $FILENAME
  44. # only compute if necessary (perhaps server will fall.. Just in case)
  45. if grep -q "${MODEL_NAME}" "${result_filename}"; then
  46. echo "${MODEL_NAME} results already generated..."
  47. else
  48. python generate/generate_data_model_random_${data}.py --output ${FILENAME} --interval "${start},${end}" --kind ${mode} --feature ${feature} --scenes "${scenes}" --nb_zones "${nb_zones}" --percent 1 --renderer "maxwell" --step 40 --random 1 --custom ${CUSTOM_MIN_MAX_FILENAME}
  49. echo "Train ${MODEL_NAME}"
  50. python find_best_${filter}.py --data ${FILENAME} --choice ${model}
  51. fi
  52. #done
  53. done
  54. done