Skip to content

Commit

Permalink
Merge pull request #34 from cheerfulstoic/patch-2
Browse files Browse the repository at this point in the history
De-sum
  • Loading branch information
igrigorik authored May 9, 2017
2 parents 846448a + 92b9a86 commit 169451e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/decisiontree/id3_tree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def id3_discrete(data, attributes, attribute)
index = attributes.index(attribute)

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

0 comments on commit 169451e

Please sign in to comment.