generateAndTrainSVM_random.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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="saved_models/${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 svm_model_train.py --data ${FILENAME}.train --output ${MODEL_NAME} &
  33. # add computation of scenes score and LaTeX display of its
  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