{"id":51058715,"url":"https://github.com/cheeze2000/rank3","last_synced_at":"2026-06-22T23:31:12.001Z","repository":{"id":358893762,"uuid":"1134985291","full_name":"cheeze2000/rank3","owner":"cheeze2000","description":"A library for online ranking","archived":false,"fork":false,"pushed_at":"2026-01-15T13:37:58.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-19T15:57:36.056Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cheeze2000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-15T13:36:55.000Z","updated_at":"2026-01-15T13:38:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cheeze2000/rank3","commit_stats":null,"previous_names":["cheeze2000/rank3"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/cheeze2000/rank3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheeze2000%2Frank3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheeze2000%2Frank3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheeze2000%2Frank3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheeze2000%2Frank3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheeze2000","download_url":"https://codeload.github.com/cheeze2000/rank3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheeze2000%2Frank3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34669839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-22T23:31:10.890Z","updated_at":"2026-06-22T23:31:11.945Z","avatar_url":"https://github.com/cheeze2000.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rank3\nA library for online ranking from https://www.csie.ntu.edu.tw/~cjlin/papers/online_ranking/online_journal.pdf.\n\nThe library implements the Weng-Lin ranking algorithm based on the Bradley-Terry model.\n\n# Usage\n\nPlayers have mu = 25 and sigma = 25/3 by default.\nPlayers have their perceived skill, which is (mu - sigma * 3).\n\n```ts\n// p1 has the default mu = 25, sigma = 25/3, pretty much still unrated.\nconst p1 = new Player(\"Player 1\");\n\np1.skill\n// 0\n\n// p2 is a much stronger player, with mu = 30 and sigma = 0.5\nconst p2 = new Player(\"Player 2\", 30, 0.5);\n\np2.skill\n// 28.5\n```\n\nGroup players in teams.\n\n```ts\nconst team1 = new Team([p1, p2]);\nconst team2 = new Team([p3, p4]);\nconst team3 = new Team([p5, p6]);\n```\n\nCreate a game where the teams are against one another.\nGame outcomes are either ranks or scores.\n\n```ts\n// a game where team 1 is in 3rd place, team 2 is in 1st place and team 3 is in 2nd place.\nconst game = new Game(\n\t[team1, team2, team3],\n\t[3, 1, 2],\n\t\"ranks\",\n);\n\n// a game where teams have their respective scores\nconst game = new Game(\n\t[team1, team2, team3],\n\t[5, -3, 2],\n\t\"scores\",\n);\n```\n\nCreate a Bradley-Terry model.\nOptionally customise the rank function or score function.\nRank and score functions take in 2 ranks or scores and return a real number between 0 and 1.\n\n```ts\nconst bt = new BradleyTerry({\n\tscoreFunction: (score0, score1) =\u003e {\n\t\treturn 1 / (1 + Math.exp(-0.1 * (score0 - score1)))\n\t}\n});\n\nconst updatedPlayers: Record\u003cstring, Player\u003e = bt.apply(game);\n```\n\nApplying the model to a game immutably returns an updated set of players indexed by their names.\n\n```ts\nconst bt = new BradleyTerry();\nconst game = new Game(\n\t[team2, team3],\n\t[1, 2],\n\t\"ranks\",\n);\n\nfor (const player of Object.values(bt.apply(game))) {\n\tconsole.log([player.name, player.mu, player.sigma]);\n}\n\n// [ \"Player 3\", 27.63523138347365, 8.065506316323548 ]\n// [ \"Player 4\", 27.63523138347365, 8.065506316323548 ]\n// [ \"Player 5\", 22.36476861652635, 8.065506316323548 ]\n// [ \"Player 6\", 22.36476861652635, 8.065506316323548 ]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheeze2000%2Frank3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheeze2000%2Frank3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheeze2000%2Frank3/lists"}