Skip to content

Commit cd9f8a9

Browse files
更新 size/D 的除法运算
1 parent 04a6e93 commit cd9f8a9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/python/7.RandomForest/randomForest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def gini_index(groups, class_values): # 个人理解:计算代价,分类
105105
if size == 0:
106106
continue
107107
proportion = [row[-1] for row in group].count(class_value) / float(size)
108-
gini += size/D * (proportion * (1.0 - proportion)) # 个人理解:计算代价,分类越准确,则 gini 越小
108+
gini += float(size)/D * (proportion * (1.0 - proportion)) # 个人理解:计算代价,分类越准确,则 gini 越小
109109
return gini
110110

111111

0 commit comments

Comments
 (0)