* pull more stuff into temps to clarify long equations
This commit is contained in:
swaits committed 2011-12-19 17:39:28 -08:00
1 parent 26d92ea617
commit 6d99d00885
1 file changed
+4 -2
+4 -2
View File
@@ -183,11 +183,13 @@ class Glicko2
sum + g_i**2.0 * e_i * (1.0 - e_i)
end
# Step 4. Compute the quantity delta, the estimated improvement in rating
# Step 4. Compute the quantity 'delta', the estimated improvement in rating
# by comparing the pre-period rating to the performance rating based only
# on game outcomes.
delta = variance * @results.inject(0.0) do |sum,r|
sum + Glicko2.g(r.opponent.g2deviation) * (r.result - Glicko2.E(@g2rating, r.opponent.g2rating, r.opponent.g2deviation))
g_i = Glicko2.g(r.opponent.g2deviation)
e_i = Glicko2.E(@g2rating, r.opponent.g2rating, r.opponent.g2deviation)
sum + g_i * (r.result - e_i)
end
# Step 5. Determine the new value of the volatility.