Skip to content

Commit

Permalink
Update Decision Tree.py
Browse files Browse the repository at this point in the history
Update Decision Tree.py
  • Loading branch information
Jack-Cherish committed Jul 18, 2018
1 parent 4a2d47d commit 357c2cd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Decision Tree/Decision Tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def calcShannonEnt(dataSet):
for featVec in dataSet: #对每组特征向量进行统计
currentLabel = featVec[-1] #提取标签(Label)信息
if currentLabel not in labelCounts.keys(): #如果标签(Label)没有放入统计次数的字典,添加进去
labelCounts[currentLabel] = 1
labelCounts[currentLabel] = 0
labelCounts[currentLabel] += 1 #Label计数
shannonEnt = 0.0 #经验熵(香农熵)
for key in labelCounts: #计算香农熵
Expand Down

0 comments on commit 357c2cd

Please sign in to comment.