generateAndTrain_maxwell_custom_center.sh 2.4 KB

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