Refactored train_model.py

2 jobs for master in 33 minutes and 21 seconds (queued for 2 seconds)