极客教程 支持向量机

参考教程:https://geek-docs.com/machine-learning/classification-algorithms/svm.html

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

bankdata = pd.read_csv("D:/Datasets/bill_authentication.csv")

bankdata.shape

bankdata.head()

x = bankdata.drop('Class',axis=1)

y = bankdata['Class']

from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size = 0.20)

y_pred = svclassifier.predict(x_test)

y_test=np.array(y_test)
y_pred=np.array(y_pred)

np.mean(np.equal(y_test,y_pred))
上一篇:Numpy的简单运算


下一篇:使用Matplotlib、Pyplot和Numpy画图