![](/img/trans.png)
[英]Why using SVM in Python in these two different ways gives a very different accuracy scores?
[英]Why the accuracy of svm in python and Matlab are different?
我將svm應用於數據集,並且達到了100%的精度! 但是當我使用matlab分類器應用程序時,准確率達到了98.8%。 在他們兩個人的內核是RBF。 在python中,我使用20%的數據作為測試,並使用80%的數據作為訓練數據。 有人可以解釋嗎?
all_data = pd.read_csv('data.csv', header=0, lineterminator="\n")
all_data = shuffle(all_data,random_state= 20)
all_data = all_data.apply(LabelEncoder().fit_transform)
data = np.array(all_data.drop('g', axis=1), dtype=np.float32)
labels = np.array(all_data['g'])
train_data = data[:200]
train_lable = labels[:200]
test_data = data[200:]
test_lable = labels[200:]
class_names = [25]
clf = svm.SVC(gamma=0.001)
clf.fit(train_data, train_lable)
score = clf.score(test_data,test_lable)
print(score)
最好在數據科學論壇上提問。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.