Skip to content

Commit

Permalink
RandomForest - replace sum with reduce +
Browse files Browse the repository at this point in the history
  • Loading branch information
asaf schers committed Oct 13, 2017
1 parent 5219290 commit 54d82f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/scoruby/models/random_forest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def predict(features)
decisions_count = decisions_count(features)
{
label: decisions_count.max_by {|_, v| v}[0],
score: decisions_count.max_by {|_, v| v}[1] / decisions_count.values.sum.to_f
score: decisions_count.max_by {|_, v| v}[1] / decisions_count.values.reduce(0, :+).to_f
}
end
end
Expand Down

0 comments on commit 54d82f2

Please sign in to comment.