Skip to content

Implement TrueSkill rating system for NHL players#1

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/develop-trueskill-rating-system
Draft

Implement TrueSkill rating system for NHL players#1
Copilot wants to merge 3 commits intomainfrom
copilot/develop-trueskill-rating-system

Conversation

Copy link

Copilot AI commented Jan 17, 2026

Adds a Bayesian skill rating system for NHL players based on Microsoft's TrueSkill algorithm, enabling skill-based player evaluation weighted by time-on-ice contributions.

Core Implementation

  • nhl_trueskill.py: TrueSkill rating engine with NHL-specific parameters (draw_probability=0.10 for OT/SO, TOI-weighted player contributions)
  • Database schema: player_trueskill_ratings (current μ/σ/skill_estimate) and player_trueskill_history (per-game rating evolution)
  • Season processing: Chronological game-by-game rating updates with team outcome propagation to individual players

Usage

from nhl_trueskill import NHLTrueSkillRatings

with NHLTrueSkillRatings() as ratings:
    # Process 2023-24 season
    ratings.process_season(season=2023, game_type=2)
    
    # Get top players (conservative estimate: μ - 3σ)
    top_players = ratings.get_top_players(limit=50, min_games=20)
    
    # Calculate team strength from lineup
    team_rating = ratings.calculate_team_rating(
        player_ids=[8478402, 8479318, 8477934],
        weights=[1200, 1150, 1100]  # TOI in seconds
    )

CLI Tools

  • calculate_trueskill_ratings.py: Batch process seasons with --season 2023 or --all-seasons
  • query_trueskill_ratings.py: Query top N players, search by name, view rating history, position rankings

Key Features

  • Uncertainty tracking (σ decreases with game count)
  • TOI-weighted contributions (more ice time = greater rating impact)
  • Position-agnostic ratings comparable across forwards/defense/goalies
  • JSON export for external analysis
  • Rating history for time-series analysis

Dependencies

  • trueskill>=0.4.5 (added to requirements.txt)
Original prompt

Look at the stats we are collecting and develop a TrueSkill type rating system for NHL Players. TrueSkill - Wikipedia https://share.google/AFxMNW8PwoxkMI6uN


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 17, 2026 21:04
Co-authored-by: MGPowerlytics <94648380+MGPowerlytics@users.noreply.github.com>
Co-authored-by: MGPowerlytics <94648380+MGPowerlytics@users.noreply.github.com>
Copilot AI changed the title [WIP] Develop TrueSkill type rating system for NHL players Implement TrueSkill rating system for NHL players Jan 17, 2026
Copilot AI requested a review from MGPowerlytics January 17, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants