Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions decision_tree/decision_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def calc_ent(x):
calculate shanno ent of x
"""

x_value_list = set([x[i] for i in range(x.shape[0])])
x_value_list = set(x)
ent = 0.0
for x_value in x_value_list:
p = float(x[x == x_value].shape[0]) / x.shape[0]
Expand All @@ -87,7 +87,7 @@ def calc_condition_ent(x, y):
"""

# calc ent(y|x)
x_value_list = set([x[i] for i in range(x.shape[0])])
x_value_list = set(x)
ent = 0.0
for x_value in x_value_list:
sub_y = y[x == x_value]
Expand Down