generateAndTrain_maxwell.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 metric information"
  12. exit 1
  13. fi
  14. VECTOR_SIZE=200
  15. size=$1
  16. metric=$2
  17. # selection of four scenes (only maxwell)
  18. scenes="A, D, G, H"
  19. half=$(($size/2))
  20. start=-$half
  21. for counter in {0..4}; do
  22. end=$(($start+$size))
  23. if [ "$end" -gt "$VECTOR_SIZE" ]; then
  24. start=$(($VECTOR_SIZE-$size))
  25. end=$(($VECTOR_SIZE))
  26. fi
  27. if [ "$start" -lt "0" ]; then
  28. start=$((0))
  29. end=$(($size))
  30. fi
  31. for nb_zones in {6,8,10,12,16}; do
  32. echo $start $end
  33. for mode in {"svd","svdn","svdne"}; do
  34. for model in {"svm_model","ensemble_model","ensemble_model_v2"}; do
  35. FILENAME="data/data_maxwell_N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${metric}_${mode}"
  36. MODEL_NAME="${model}_N${size}_B${start}_E${end}_nb_zones_${nb_zones}_${metric}_${mode}"
  37. echo $FILENAME
  38. python generate_data_model_random.py --output ${FILENAME} --interval "${start},${end}" --kind ${mode} --metric ${metric} --scenes "${scenes}" --nb_zones "${nb_zones}" --percent 1 --sep ';' --rowindex '0'
  39. python models/${model}_train.py --data ${FILENAME}.train --output ${MODEL_NAME}
  40. python predict_seuil_expe_maxwell.py --interval "${start},${end}" --model "saved_models/${MODEL_NAME}.joblib" --mode "${mode}" --metric ${metric} --limit_detection '2'
  41. python save_model_result_in_md_maxwell.py --interval "${start},${end}" --model "saved_models/${MODEL_NAME}.joblib" --mode "${mode}" --metric ${metric}
  42. done
  43. done
  44. done
  45. if [ "$counter" -eq "0" ]; then
  46. start=$(($start+50-$half))
  47. else
  48. start=$(($start+50))
  49. fi
  50. done