由rémi coulon实现的整个历史评级算法的python实现(基于https://github.com/goshrine/whole_history戋rating上的ruby实现)

whole-history-rating的Python项目详细描述


整体历史评分

从r_micoulon的全历史评级(whr)算法的ruby实现中进行的python转换。

原始代码可以找到here

安装

pip install whole_history_rating

用法

from whr import whole_history_rating

whr = whole_history_rating.Base()

# Base.create_game() arguments: black player name, white player name, winner, day number, handicap
# Handicap should generally be less than 500 elo
whr.create_game("shusaku", "shusai", "B", 1, 0)
whr.create_game("shusaku", "shusai", "W", 2, 0)
whr.create_game("shusaku", "shusai", "W", 3, 0)

# Iterate the WHR algorithm towards convergence with more players/games, more iterations are needed.
whr.iterate(50)

# Or let the module iterate until the elo is stable (precision by default 10E-3) with a time limit of 10 seconds by default
whr.auto_iterate(time_limit = 10, precision = 10E-3)

# Results are stored in one triplet for each day: [day_number, elo_rating, uncertainty]
whr.ratings_for_player("shusaku") => 
  [[1, -43, 84], 
   [2, -45, 84], 
   [3, -45, 84]]
whr.ratings_for_player("shusai") => 
  [[1, 43, 84], 
   [2, 45, 84], 
   [3, 45, 84]]

# You can print or get all ratings ordered
whr.print_ordered_ratings()
whr.get_ordered_ratings()

# You can get a prediction for a future game between two players (even non existing players)
# Base.probability_future_match() arguments: black player name, white player name, handicap
whr.probability_future_match("shusaku", "shusai",0) =>
  win probability: shusaku:37.24%; shusai:62.76%

# You can load several games all together using a file or a list of string representing the game
# all elements in list must be like: "black_name white_name winner time_step handicap extras" 
# you can exclude handicap (default=0) and extras (default={})
whr.load_games(["shusaku shusai B 1 0", "shusaku shusai W 2", "shusaku shusai W 3 0"])
whr.load_games(["firstname1 name1, firstname2 name2, W, 1"], separator=",")

# You can save and load a base (you don't have to redo all iterations)
whr.save_base(path)
whr2 = whole_history_rating.Base.load_base(path)

可选配置

whr的一个元参数是一个时间步长上的评分变化方差,:w2, 它决定了一个玩家的等级在一天内有多大的变化。数字越高,进步越快。 默认值为300,相当高。
r_mi coulon在他的论文中,用w2=14得到了他的results

whr = whole_history_rating.Base({'w2':14})

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
JavaEclipseMars没有保存首选项   java梯度同步失败:原因:启动失败:   java如何从嵌套的JSON获取数据?   java如何判断可观察对象中的任何对象满足一个条件?   java将字符串转换为保持相同值的byte[]数组   java有没有办法绕过AuditingEntityListener为测试设置数据?   从/usr/share/java中解析linux JAR依赖关系   安卓 My java函数抛出nullpointerexception?   java Gradle使用正确版本的依赖项   JBoss和Java6中带注释的WebService中的web服务ClassCastException   java如何修复codename one中的简单逻辑错误?   java如何迭代矩阵的索引?   java如何在JPanel不可见时将其保存为图像?   java HashMap如何在Kotlin中实现MutableMap接口?   javascript如何在单击后加载特定片段?   EclipseJava为纳什均衡获取所有玩家/策略组合   JavaSpring:Web服务REST在JSON上产生双反斜杠   java为什么ServletContext#getRealPath(“/”)返回相对路径?   java当我的游戏应该重新启动时,我应该如何处理重置SurfaceView和线程?