Permalink
Browse files

Only compare scores.

  • Loading branch information...
rustyio committed Jan 15, 2013
1 parent dafd3ea commit b451b321506d6b289f40d30b5eb85b303e4e8688
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/decisiontree/id3_tree.rb
@@ -76,7 +76,7 @@ def id3_train(data, attributes, default, used={})
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]

0 comments on commit b451b32

Please sign in to comment.