generateAndTrainEnsemble_random.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 model output name"
  12. exit 1
  13. fi
  14. VECTOR_SIZE=$1
  15. INPUT_MODEL_NAME=$2
  16. # selection of six scenes
  17. scenes="A, B, C, D, E, F, G, H, I"
  18. for size in {"4","8","16","26","32","40"}; do
  19. start=0
  20. for counter in {0..4}; do
  21. end=$(($start+$size))
  22. if [ "$end" -gt "$VECTOR_SIZE" ]; then
  23. start=$(($VECTOR_SIZE-$size))
  24. end=$(($VECTOR_SIZE))
  25. fi
  26. for nb_zones in {2,3,4,5,6,7,8,9,10}; do
  27. for mode in {"svd","svdn","svdne"}; do
  28. FILENAME="data_svm/data_${mode}_N${size}_B${start}_E${end}_nb_zones_${nb_zones}_random"
  29. MODEL_NAME="${INPUT_MODEL_NAME}_${mode}_N${size}_B${start}_E${end}_nb_zones_${nb_zones}"
  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 ensemble_model_train.py --data ${FILENAME}.train --output ${MODEL_NAME}
  33. bash testModelByScene.sh "${start}" "${end}" "./saved_models/${MODEL_NAME}.joblib" "${mode}" >> "./saved_models/${MODEL_NAME}.tex"
  34. done
  35. done
  36. if [ -z "$2" ]
  37. then
  38. echo "No argument supplied"
  39. echo "Need of model output name"
  40. exit 1
  41. fi
  42. VECTOR_SIZE=$1
  43. INPUT_MODEL_NAME=$2
  44. start=$(($start+50))
  45. done
  46. done