rewrite svm margin part