generateAndTrainEnsemble_random.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 metric in {"lab","mscn"}; do
  28. for mode in {"svd","svdn","svdne"}; do
  29. FILENAME="data/data_${mode}_${metric}_N${size}_B${start}_E${end}_nb_zones_${nb_zones}_random"
  30. MODEL_NAME="${INPUT_MODEL_NAME}_${mode}_${metric}_N${size}_B${start}_E${end}_nb_zones_${nb_zones}"
  31. echo $FILENAME
  32. 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'
  33. python ensemble_model_train.py --data ${FILENAME}.train --output ${MODEL_NAME}
  34. bash testModelByScene.sh "${start}" "${end}" "saved_models/${MODEL_NAME}.joblib" "${mode}" "${metric}" >> "saved_models/${MODEL_NAME}.tex"
  35. done
  36. done
  37. done
  38. if [ -z "$2" ]
  39. then
  40. echo "No argument supplied"
  41. echo "Need of model output name"
  42. exit 1
  43. fi
  44. VECTOR_SIZE=$1
  45. INPUT_MODEL_NAME=$2
  46. start=$(($start+50))
  47. done
  48. done