Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ELO rating system #35

Open
rottenpen opened this issue Jul 21, 2021 · 0 comments
Open

ELO rating system #35

rottenpen opened this issue Jul 21, 2021 · 0 comments

Comments

@rottenpen
Copy link
Owner

rottenpen commented Jul 21, 2021

背景

刷 leetcode 的时候突发奇想,leetcode 是怎么算空间复杂度跟时间复杂度的(大概有想法,监听进程内存消耗变化就好)但是它是怎么定最后的百分比的呢。于是搜到了 ELO rating system 埃洛等级分系统。
image
以下复制粘贴自百度百科:

  • 假设棋手A和B的当前等级分分别为RA和RB,则按Logistic distribution A对B的胜率期望值当为:
    image

  • 类似B对A的胜率为:
    image

  • 假如一位棋手在比赛中的真实得分(胜=1分,和=0.5分,负=0分)和他的胜率期望值不同,则他的等级分要作相应的调整。具体的数学公式为:
    image

  • 和分别为棋手调整前后的等级分。在大师级比赛中K通常为16。

  • 例如,棋手A等级分为1613,与等级分为1573的棋手B战平。若K取32,则A的胜率期望值为
    image

  • 因而A的新等级分为。
    image

Javascript

甚至,我找到了这个数学模型的包。只需要传入,Ra Rb 以及胜负(true / false),它就能返回最后两者的得分。

var EloRating = require('elo-rating');
 
var playerWin = false;
var result = EloRating.calculate(1750, 1535, playerWin);
 
console.log(result.playerRating) // Output: 1735
console.log(result.opponentRating) // Output: 1550
 
result = EloRating.calculate(1750, 1535);
 
console.log(result.playerRating) // Output: 1754
console.log(result.opponentRating) // Output: 1531

尾声

由此得出猜测,百分比是根据最后 rank 积分的百分比分布来判断。

而像周赛这种,直接返回 rank 积分。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant