generateAndTrainSVM_random.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. done
  34. done
  35. if [ -z "$2" ]
  36. then
  37. echo "No argument supplied"
  38. echo "Need of model output name"
  39. exit 1
  40. fi
  41. VECTOR_SIZE=$1
  42. INPUT_MODEL_NAME=$2
  43. start=$(($start+50))
  44. done
  45. done