由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第三方库


热门话题
java Thumbnailator库将图像转换为cmyk   Java反射从目录中的类运行测试   JavaEclipseJDT编译器说方法未定义,但EclipseIDE没有   重构如何重构一行重复的java代码   java Eclipse:使用删除线文本呈现自定义注释   java问题与ArrayList复制数据   java如何在swagger中传递访问令牌?   使用另一个java文件运行java文件时出错   java为什么谷歌云存储生成的上传链接在成功上传后不会失效?   java将我的客户端PC重定向到默认登录页面   java hibernate c3p0配置mysql问题   java和java之间的区别。尼奥。文件文件和java。伊奥。文件   列出java循环并向映射中添加值   java为什么OJ报告这段代码的运行时错误?