coding training from database instead of arff.