Svm implementation