run.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # erase "models_info/models_comparisons.csv" file and write new header
  2. file_path='models_info/models_comparisons.csv'
  3. erased=$1
  4. if [ "${erased}" == "Y" ]; then
  5. echo "Previous data file erased..."
  6. rm ${file_path}
  7. mkdir -p models_info
  8. touch ${file_path}
  9. # add of header
  10. echo 'model_name; number_of_approximations; coeff_of_determination;' >> ${file_path}
  11. fi
  12. for n in {3,4,5,6,7,8,9,10,15,20,25,30}; do
  13. for model in {"SGD","Ridge","SVR"}; do
  14. for row in {2,3,4,5,6,7,8,9,10}; do
  15. for column in {2,3,4,5,6,7,8,9,10}; do
  16. # Run creation of dataset and train model
  17. DATASET_NAME="data/dataset_${n}_column_${column}_row_${row}.csv"
  18. MODEL_NAME="${n}_column_${column}_row_${row}_${model}"
  19. if ! grep -q "${MODEL_NAME}" "${file_path}"; then
  20. echo "Run computation for model ${MODEL_NAME}"
  21. python make_dataset.py --n ${n} --each_row ${row} --each_column ${column}
  22. python train_model.py --data ${DATASET_NAME} --model ${model}
  23. else
  24. echo "${MODEL_NAME} results already computed.."
  25. fi
  26. done
  27. done
  28. done
  29. done