Class TrueSkill

Implements a TrueSkill environment. An environment could have customized constants. Every games have not same design and may need to customize TrueSkill constants.

For example, 60% of matches in your game have finished as draw then you should set draw_probability to 0.60

const env = new TrueSkill(undefined, undefined, undefined, undefined, 0.6);

For more details of the constants, see The Math Behind TrueSkill by Jeff Moser.

Constructors

  • Parameters

    • mu: number = 25

      initial mean of ratings

    • Optional sigma: number

      initial standard deviation of ratings

    • Optional beta: number

      distance that guarantees about 76% chance of winning

    • Optional tau: number

      dynamic factor

    • drawProbability: number = 0.1

      draw probability of the game

    • guassian: Gaussian = ...

      reuseable gaussian

    Returns TrueSkill

Properties

beta: number
drawProbability: number = 0.1

draw probability of the game

guassian: Gaussian = ...

reuseable gaussian

mu: number
sigma: number
tau: number

Methods

  • Initializes new Rating object, but it fixes default mu and sigma to the environment's. var env = TrueSkill(mu=0, sigma=1) var env.createRating() trueskill.Rating(mu=0.000, sigma=1.000)

    Parameters

    • mu: number = ...
    • sigma: number = ...

    Returns Rating

  • Returns the value of the rating exposure. It starts from 0 and converges to the mean. Use this as a sort key in a leaderboard

    Parameters

    Returns number

  • Calculates the match quality of the given rating groups. Result is the draw probability in the association::

    env = TrueSkill()
    if (env.quality([team1, team2, team3]) < 0.50) {
    console.log('This match seems to be not so fair')
    }

    Parameters

    • ratingGroups: Rating[][]
    • Optional weights: number[][]

    Returns number

  • Recalculates ratings by the ranking table

    Parameters

    • ratingGroups: any[] | Rating[][]
    • ranks: null | number[] = null
    • weights: null | number[][] = null
    • minDelta: number = 0.0001

    Returns any[] | Rating[][]