generateAndTrain_maxwell.sh 1.5 KB

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