diff --git a/lib/decisiontree/id3_tree.rb b/lib/decisiontree/id3_tree.rb index 9097ebf..8df1483 100755 --- a/lib/decisiontree/id3_tree.rb +++ b/lib/decisiontree/id3_tree.rb @@ -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