generateAndTrain_maxwell.sh 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. result_filename="results/models_comparisons.csv"
  21. VECTOR_SIZE=200
  22. size=$1
  23. feature=$2
  24. data=$3
  25. # selection of four scenes (only maxwell)
  26. scenes="A, D, G, H"
  27. half=$(($size/2))
  28. start=-$half
  29. for counter in {0..4}; do
  30. end=$(($start+$size))
  31. if [ "$end" -gt "$VECTOR_SIZE" ]; then
  32. start=$(($VECTOR_SIZE-$size))
  33. end=$(($VECTOR_SIZE))
  34. fi
  35. if [ "$start" -lt "0" ]; then
  36. start=$((0))
  37. end=$(($size))
  38. fi
  39. for nb_zones in {4,6,8,10,12}; do
  40. echo $start $end
  41. for mode in {"svd","svdn","svdne"}; do
  42. for model in {"svm_model","ensemble_model","ensemble_model_v2"}; do
  43. FILENAME="data/${model}_N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${feature}_${mode}"
  44. MODEL_NAME="${model}_N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${feature}_${mode}"
  45. echo $FILENAME
  46. # only compute if necessary (perhaps server will fall.. Just in case)
  47. if grep -q "${MODEL_NAME}" "${result_filename}"; then
  48. echo "${MODEL_NAME} results already generated..."
  49. else
  50. python generate/generate_data_model_random_${data}.py --output ${FILENAME} --interval "${start},${end}" --kind ${mode} --feature ${feature} --scenes "${scenes}" --nb_zones "${nb_zones}" --renderer "maxwell" --step 40 --random 1 --percent 1
  51. python train_model.py --data ${FILENAME} --output ${MODEL_NAME} --choice ${model}
  52. #python prediction/predict_seuil_expe_maxwell.py --interval "${start},${end}" --model "saved_models/${MODEL_NAME}.joblib" --mode "${mode}" --feature ${feature} --limit_detection '2'
  53. python others/save_model_result_in_md_maxwell.py --interval "${start},${end}" --model "saved_models/${MODEL_NAME}.joblib" --mode "${mode}" --feature ${feature}
  54. fi
  55. done
  56. done
  57. done
  58. if [ "$counter" -eq "0" ]; then
  59. start=$(($start+50-$half))
  60. else
  61. start=$(($start+50))
  62. fi
  63. done