هوش مصنوعی Knn & Svm

سوال

سلام
در این پروژه به ی ارور برمیخورم
ممنون میشم کمکم کنید
فایل دیتا گذاشتم cancer_b.csv

اسکرین ارور هم قرار دادم
import pandas as pd
# for reading our data
from sklearn.model_selection import train_test_split
# to set our train data
from sklearn.tree import DecisionTreeClassifier
# for Decisiontree modeling
from sklearn.neighbors import KNeighborsClassifier
# for KNN modeling
from sklearn.metrics import confusion_matrix , accuracy_score
# To determine the accuracy of our models
from sklearn.svm import SVC
# for SVC modeling
from sklearn.neural_network import MLPClassifier
# for neural network modeling
data = pd.read_csv(“C:/Users/PARVAZ/Desktop/cancer_b.csv”)
# read our CSV file as data
x = data.iloc[:,1:31]
y = data.iloc[:,0]
x_tr , x_ts , y_tr , y_ts = train_test_split(x,y)
# To determine our train and test data
knn = KNeighborsClassifier(n_neighbors=3)
knn.fit(x_tr,y_tr)
pred = knn.predict(x_ts)
print(confusion_matrix(pred,y_ts))
print(accuracy_score(pred,y_ts))

model = DecisionTreeClassifier()
model.fit(x_tr,y_tr)
pred = model.predict(x_ts)
print(confusion_matrix(pred,y_ts))
print(accuracy_score(pred,y_ts))

svm_model = SVC()
svm_model.fit(x_tr,y_tr)
pred = svm_model.predict(x_ts)
print(confusion_matrix(pred,y_ts))
print(accuracy_score(pred,y_ts))
(pred,y_ts))


ضمیمه ها

ضمیمه ها
0
ehsan.m.r 5 ماه 0 پاسخ ها 42 دیده شده 0

ارسال یک پاسخ