From b451b321506d6b289f40d30b5eb85b303e4e8688 Mon Sep 17 00:00:00 2001 From: Rusty Klophaus Date: Tue, 15 Jan 2013 15:03:28 -0500 Subject: [PATCH] Only compare scores. --- lib/decisiontree/id3_tree.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/decisiontree/id3_tree.rb b/lib/decisiontree/id3_tree.rb index 0f8ea2f..43926e3 100755 --- a/lib/decisiontree/id3_tree.rb +++ b/lib/decisiontree/id3_tree.rb @@ -76,7 +76,7 @@ module DecisionTree performance = attributes.collect { |attribute| fitness_for(attribute).call(data, attributes, attribute) } max = performance.max { |a,b| a[0] <=> b[0] } min = performance.min { |a,b| a[0] <=> b[0] } - max = performance.shuffle.first if max == min + max = performance.shuffle.first if max[0] == min[0] best = Node.new(attributes[performance.index(max)], max[1], max[0]) best.threshold = nil if @type == :discrete @used.has_key?(best.attribute) ? @used[best.attribute] += [best.threshold] : @used[best.attribute] = [best.threshold]