Python SVM implementation