mirror of
https://github.com/dkam/decisiontree.git
synced 2025-12-28 07:04:53 +00:00
@@ -120,7 +120,7 @@ module DecisionTree
|
|||||||
index = attributes.index(attribute)
|
index = attributes.index(attribute)
|
||||||
|
|
||||||
values = data.map { |row| row[index] }.uniq
|
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|
|
classification = data.each_with_object([]) do |row, result|
|
||||||
result << row.last if row[index] == val
|
result << row.last if row[index] == val
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user