014. basic of scikit-learn, basic of svm # @ import sklearn import svm # I create svm classifier instance clf = svm.SVC() # And then, we will use fit() for training and predict() for predicting # 1 argument : data # 2 argument : label # We will deal with xor data clf.fit( [[0,0], [1,0], [0,1], [1,1]], [[0, 1, 1, 0]]) results = clf.predict([0,0], [1,0]) print(results) # output will be list of [0,1] # @ from sklearn import metrics datas = [[0,0], [1,0], [0,1], [1,1]] labels = [0, 1, 1, 0] examples = [[0,0], [1,0]] examples_label = [0,1] clf = svm.SVC() clf.fit(datas, labels) results = clf.predict(examples) print(results) score = metrics.accuracy_score(examples_label, results) print("accuracy : ", score)