You are on page 1of 2

hm3jiq50d

May 11, 2023

[1]: import pandas as pd


dataset = pd.read_csv('studentdata1.csv')

[16]: x = dataset.drop('result',axis=1)

[7]: y = dataset['result']

[17]: x

[17]: Englis marks Hindi Marks Marathi Marks science Marks


0 17.99 89.09 68.98 67.90
1 34.00 99.90 70.00 9.00
2 37.89 87.98 90.00 89.00
3 67.89 76.11 67.00 67.00
4 67.09 86.02 86.09 58.00
5 54.89 54.00 78.56 67.09
6 89.12 78.67 81.68 67.98
7 89.78 56.09 89.08 78.54
8 56.09 67.90 67.09 67.86
9 54.90 68.09 67.00 78.78
10 56.89 79.09 78.30 58.09
11 78.67 80.00 67.09 47.78
12 56.56 91.09 75.00 69.80

[9]: y

[9]: 0 0
1 1
2 1
3 0
4 1
5 1
6 0
7 1
8 0
9 1
10 1

1
11 0
12 0
Name: result, dtype: int64

[18]: 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)

[20]: from sklearn.svm import SVC


SVClassifier=SVC(kernel='linear')
SVClassifier.fit(x_train,y_train)

[20]: SVC(kernel='linear')

[24]: y_pred = SVClassifier.predict(x_test)

[25]: from sklearn.metrics import classification_report,confusion_matrix


print (confusion_matrix(y_test,y_pred))
print(classification_report(y_test,y_pred))

[[1 1]
[0 1]]
precision recall f1-score support

0 1.00 0.50 0.67 2


1 0.50 1.00 0.67 1

accuracy 0.67 3
macro avg 0.75 0.75 0.67 3
weighted avg 0.83 0.67 0.67 3

[ ]:

You might also like