Professional Documents
Culture Documents
Naive Bayes Matrix Evaluation
Naive Bayes Matrix Evaluation
February 9, 2022
[1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1]
[1, 1, 2, 3, 3, 3, 2, 1, 1, 3, 1, 2, 2, 3]
[7]: play=0
notplay=0
for i in range(len(label)):
if(label[i]==0):
1
play+=1
else:
notplay+=1
2
[16]: TN=0
TP=0
FP=0
FN=0
rowx = [[1,1],[2,0],[3,0],[3,1],[1,0]]
#actual data to make confusion matrixâŘč ind1=outllok ,ind2=actually played/
,→notplayed
for x in rowx:
# store predicted class
y=solution(x[0])
#store predicted class based on probablity
if(x[1]!=y):#compare actual data with predicted data
if(y>x[1]):
FP+=1
else:
FN+=1
else:
if(y==1):
TP+=1
else:
TN+=1
[17]: print("Accuracy",(TP+TN)/(TP+TN+FP+FN))
Accuracy 0.6
[ ]: