Skip to content

Commit

Permalink
De-sum 2
Browse files Browse the repository at this point in the history
  • Loading branch information
cheerfulstoic authored May 9, 2017
1 parent 846448a commit 92b9a86
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 92b9a86

Please sign in to comment.