implement SVM training