mirror of
https://github.com/dkam/decisiontree.git
synced 2025-12-28 07:04:53 +00:00
Only compare scores.
This commit is contained in:
@@ -76,7 +76,7 @@ module DecisionTree
|
|||||||
performance = attributes.collect { |attribute| fitness_for(attribute).call(data, attributes, attribute) }
|
performance = attributes.collect { |attribute| fitness_for(attribute).call(data, attributes, attribute) }
|
||||||
max = performance.max { |a,b| a[0] <=> b[0] }
|
max = performance.max { |a,b| a[0] <=> b[0] }
|
||||||
min = performance.min { |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 = Node.new(attributes[performance.index(max)], max[1], max[0])
|
||||||
best.threshold = nil if @type == :discrete
|
best.threshold = nil if @type == :discrete
|
||||||
@used.has_key?(best.attribute) ? @used[best.attribute] += [best.threshold] : @used[best.attribute] = [best.threshold]
|
@used.has_key?(best.attribute) ? @used[best.attribute] += [best.threshold] : @used[best.attribute] = [best.threshold]
|
||||||
|
|||||||
Reference in New Issue
Block a user