{"id":17279526,"url":"https://github.com/reagentx/glicko2","last_synced_at":"2025-04-14T09:23:37.826Z","repository":{"id":43383399,"uuid":"287168036","full_name":"ReagentX/glicko2","owner":"ReagentX","description":"A Rust implementation of  the Glicko2 iterative ranking algorithm.","archived":false,"fork":false,"pushed_at":"2025-02-24T01:10:01.000Z","size":116,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-04-12T12:16:21.551Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ReagentX.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-13T03:03:57.000Z","updated_at":"2025-02-24T01:10:03.000Z","dependencies_parsed_at":"2022-09-14T11:01:02.643Z","dependency_job_id":null,"html_url":"https://github.com/ReagentX/glicko2","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReagentX%2Fglicko2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReagentX%2Fglicko2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReagentX%2Fglicko2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReagentX%2Fglicko2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ReagentX","download_url":"https://codeload.github.com/ReagentX/glicko2/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248852557,"owners_count":21171921,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-10-15T09:17:54.478Z","updated_at":"2025-04-14T09:23:37.793Z","avatar_url":"https://github.com/ReagentX.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Glicko2 (Rust Edition)\n\nGlicko2 is an iterative algorithm for ranking opponents or teams in 1v1 games. This is a zero-dependency Rust library implementing this algorithm.\n\n## Installation\n\nAdd the following to your `Cargo.toml`:\n\n```toml\n[dependencies]\nglicko_2 = \"1.1.0\"\n```\n\n## Sample Usage\n\nThe most common usage is to update a series of matches for each team, but this library provides many other convenience methods.\n\n### To update a series of matchups\n\n```rust\nuse glicko_2::{Rating, Tuning, game::Outcome, algorithm};\n\n/// Tune the rating values, here we use the default\nlet tuning = Tuning::default();\n\n/// Create a Rating struct for each team\nlet mut team_to_update = Rating::new(\u0026tuning);\nlet mut opponent_1 = Rating::new(\u0026tuning);\nlet mut opponent_2 = Rating::new(\u0026tuning);\nlet mut opponent_3 = Rating::new(\u0026tuning);\nlet mut opponent_4 = Rating::new(\u0026tuning);\n\n/// Rate our team against a vector of matchup results\nalgorithm::rate(\n    \u0026mut team_to_update,\n    \u0026mut [(Outcome::Win, \u0026mut opponent_1),\n         (Outcome::Loss, \u0026mut opponent_2),\n         (Outcome::Draw, \u0026mut opponent_3),\n    ]\n);\n\n/// Opponent 4 did not play, so their rating must be decayed\nopponent_4.decay();\n\n/// Print our updated rating\nprintln!(\"{:?}\", team_to_update); // Rating(μ=1500.0, φ=255.40, σ=0.0059)\n```\n\n### To get the odds one team will beat another\n\n```rust\nuse glicko_2::{Rating, Tuning, game};\n\n/// Tune the rating values, here we use the default\nlet tuning = Tuning::default();\n\n/// Create a Rating struct for each team\nlet mut rating_1 = Rating::new(\u0026tuning);\nlet mut rating_2 = Rating::new(\u0026tuning);\n\n/// Get odds (percent chance team_1 beats team_2)\nlet odds = game::odds(\u0026mut rating_1, \u0026mut rating_2);\nprintln!(\"{odds}\"); // 0.5, perfect odds since both teams have the same rating\n```\n\n### To determine the quality of a matchup\n\n```rust\nuse glicko_2::{Rating, Tuning, game};\n\n/// Tune the rating values, here we use the defaults\nlet tuning = Tuning::default();\n\n/// Create a Rating struct for each team\nlet mut rating_1 = Rating::new(\u0026tuning);\nlet mut rating_2 = Rating::new(\u0026tuning);\n\n/// Get odds (the advantage team 1 has over team 2)\nlet quality = game::quality(\u0026mut rating_1, \u0026mut rating_2);\nprintln!(\"{quality}\"); // 1.0, perfect matchup since both teams have the same rating\n```\n\n### To update both team's ratings for a single matchup\n\n```rust\nuse glicko_2::{Rating, Tuning, game};\n\n/// Tune the rating values, here we use the defaults\nlet tuning = Tuning::default();\n\n/// Create a Rating struct for each team\nlet mut rating_1 = Rating::new(\u0026tuning);\nlet mut rating_2 = Rating::new(\u0026tuning);\n\n/// Update ratings for team_1 beating team_2\ngame::compete(\u0026mut rating_1, \u0026mut rating_2, false);\n\n/// Print our updated ratings\nprintln!(\"{rating_1}\"); // Rating(μ=1646.47, φ=307.84, σ=0.0059)\nprintln!(\"{rating_2}\"); // Rating(μ=1383.42, φ=306.83, σ=0.0059)\n```\n\n## Rating\n\nEach side of a 1v1 competition is assigned a rating and a rating deviation. The rating represents the skill of a player or team, and the rating deviation measures confidence in the rating value.\n\n### Rating Deviation\n\nA team or player's rating deviation decreases with results and increases during periods of inactivity. Rating deviation also depends on volatility, or how consistent a player or team's performance is.\n\nThus, a confidence interval represents a team's or player's skill: a player with a rating of `1300` and a rating deviation of `25` means the player's real strength lies between `1350` and `1250` with 95% confidence.\n\n### Match Timing Caveat\n\nSince time is a factor in rating deviation, the algorithm assumes all matches within a rating period were played concurrently and use the same values for uncertainty.\n\n## Tuning Parameters\n\n- Rating period length and quantity impact decay in rating deviation\n  - Should generally be `{10..15}` matches per team per period\n- Initial mu and phi values affect how much teams or players can change\n  - Defaults are `1500` and `350` respectively\n- Sigma is the base volatility\n  - Default to `0.06`\n- Tau is the base change constraint; higher means increased weight given to upsets\n  - Should be `{0.3..1.2}`\n\n## Problems\n\n- Difficult to determine the impact of an individual match\n- No ratings available in the middle of a rating period\n- Ratings are only valid at compute time\n\n## Paper\n\nMark Glickman developed the Glicko2 algorithm. His paper is available [here](http://www.glicko.net/glicko/glicko2.pdf).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freagentx%2Fglicko2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freagentx%2Fglicko2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freagentx%2Fglicko2/lists"}