SVM training and prediction