generateAndTrain_maxwell_custom_filters.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 metric information"
  12. exit 1
  13. fi
  14. result_filename="models_info/models_comparisons.csv"
  15. VECTOR_SIZE=200
  16. size=$1
  17. metric=$2
  18. # selection of four scenes (only maxwell)
  19. scenes="A, D, G, H"
  20. for nb_zones in {4,6,8,10,12}; do
  21. for mode in {"svd","svdn","svdne"}; do
  22. for model in {"svm_model","ensemble_model","ensemble_model_v2"}; do
  23. FILENAME="data/${model}_N${size}_B0_E${size}_nb_zones_${nb_zones}_${metric}_${mode}"
  24. MODEL_NAME="${model}_N${size}_B0_E${size}_nb_zones_${nb_zones}_${metric}_${mode}"
  25. CUSTOM_MIN_MAX_FILENAME="N${size}_B0_E${size}_nb_zones_${nb_zones}_${metric}_${mode}_min_max"
  26. echo $FILENAME
  27. # only compute if necessary (perhaps server will fall.. Just in case)
  28. if grep -q "${MODEL_NAME}" "${result_filename}"; then
  29. echo "${MODEL_NAME} results already generated..."
  30. else
  31. python generate_data_model_random.py --output ${FILENAME} --interval "0,${size}" --kind ${mode} --metric ${metric} --scenes "${scenes}" --nb_zones "${nb_zones}" --percent 1 --renderer "maxwell" --step 40 --random 1 --custom ${CUSTOM_MIN_MAX_FILENAME}
  32. python train_model.py --data ${FILENAME} --output ${MODEL_NAME} --choice ${model}
  33. python save_model_result_in_md_maxwell.py --interval "0,${size}" --model "saved_models/${MODEL_NAME}.joblib" --mode "${mode}" --metric ${metric}
  34. fi
  35. done
  36. done
  37. done