Skip to content

Commit b7f249f

Browse files
authored
Update NaiveBayes.py
support for python >=3.6
1 parent 02a3ae6 commit b7f249f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

NaiveBayes/NaiveBayes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def NaiveBayes(Py, Px_y, x):
7373
return P.index(max(P))
7474

7575

76-
def test(Py, Px_y, testDataArr, testLabelArr):
76+
def model_test(Py, Px_y, testDataArr, testLabelArr):
7777
'''
7878
对测试集进行测试
7979
:param Py: 先验概率分布
@@ -188,9 +188,9 @@ def getAllProbability(trainDataArr, trainLabelArr):
188188

189189
#使用习得的先验概率分布和条件概率分布对测试集进行测试
190190
print('start to test')
191-
accuracy = test(Py, Px_y, testDataArr, testLabelArr)
191+
accuracy = model_test(Py, Px_y, testDataArr, testLabelArr)
192192

193193
#打印准确率
194194
print('the accuracy is:', accuracy)
195195
#打印时间
196-
print('time span:', time.time() -start)
196+
print('time span:', time.time() -start)

0 commit comments

Comments
 (0)