Skip to content

Commit 92b9a86

Browse files
De-sum 2
1 parent 846448a commit 92b9a86

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/decisiontree/id3_tree.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def id3_discrete(data, attributes, attribute)
120120
index = attributes.index(attribute)
121121

122122
values = data.map { |row| row[index] }.uniq
123-
remainder = values.sort.sum do |val|
123+
remainder = values.sort.inject(0, :+) do |val|
124124
classification = data.each_with_object([]) do |row, result|
125125
result << row.last if row[index] == val
126126
end

0 commit comments

Comments
 (0)