Skip to content

Commit

Permalink
Update bayes.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Cherish committed Jan 29, 2018
1 parent 538bf52 commit b9df041
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Naive Bayes/bayes.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def setOfWords2Vec(vocabList, inputSet):
trainMatrix - 训练文档矩阵,即setOfWords2Vec返回的returnVec构成的矩阵
trainCategory - 训练类别标签向量,即loadDataSet返回的classVec
Returns:
p0Vect - 侮辱类的条件概率数组
p1Vect - 非侮辱类的条件概率数组
p0Vect - 非的条件概率数组
p1Vect - 侮辱类的条件概率数组
pAbusive - 文档属于侮辱类的概率
Author:
Jack Cui
Expand Down Expand Up @@ -110,8 +110,8 @@ def trainNB0(trainMatrix,trainCategory):
Parameters:
vec2Classify - 待分类的词条数组
p0Vec - 侮辱类的条件概率数组
p1Vec -非侮辱类的条件概率数组
p0Vec - 非侮辱类的条件概率数组
p1Vec -侮辱类的条件概率数组
pClass1 - 文档属于侮辱类的概率
Returns:
0 - 属于非侮辱类
Expand Down Expand Up @@ -169,4 +169,4 @@ def testingNB():
print(testEntry,'属于非侮辱类') #执行分类并打印分类结果

if __name__ == '__main__':
testingNB()
testingNB()

0 comments on commit b9df041

Please sign in to comment.