def train_svm(X, y, k): if k == 'linear': svm = SVC(C=1.0, kernel='linear') elif k =='rbf': svm = SVC(C=1.0, kernel='rbf') svm.fit(X, y) return svm