Module skillratings::fifa

source ·
Expand description

The FIFA Men’s rating algorithm, officially called The FIFA/Coca-Cola World Ranking.
Used to rank men’s national football (or soccer) teams in FIFA-recognised competitions since 2018.

The algorithm is largely based on the Elo rating system, but with a few modifications specific to football (soccer).
The main differences being an importance factor, that rates the importance of a given match, and a penalty-shootout factor that accounts for the fact that penalty shootouts are often more random than regular play.

Please note that the FIFA Women’s ranking algorithm works in a very different way, and is not implemented in this crate. This is due to the way the outcome and score of the match is taken into account in the calculations.
For more information please see the Wikipedia Article on FIFA Women’s World Rankings.

Quickstart

use skillratings::{
    fifa::{fifa, FifaConfig, FifaRating},
    Outcomes,
};

// Initialise a new team rating with a rating of 1000.
let team_one = FifaRating::new();

// Or you can initialise it with your own values of course.
// Imagine these numbers being pulled from a database.
let some_rating = 1325.0;
let team_two = FifaRating {
    rating: some_rating,
};

// The outcome of the match is from the perspective of team one.
let outcome = Outcomes::WIN;

// The config allows you to specify certain values in the Fifa calculation.
// Here we set the importance factor to 50.0, and the knockout factor to false.
// Which corresponds to a World Cup Group Stage match.
// For more information on how to customise the config,
// please check out the FifaConfig struct.
let config = FifaConfig {
    importance: 50.0,
    knockout: false,
    ..Default::default()
};

// The fifa function will calculate the new ratings for both teams and return them.
let (new_team_one, new_team_two) = fifa(&team_one, &team_two, &outcome, &config);

More Information:

Structs

Functions

  • Calculates the expected score of two players based on their Fifa rating.
  • Calculates the expected outcome of a player in a rating period or tournament.
  • Calculates the FifaRatings of two teams based on their old ratings and the outcome of the game.
  • Calculates a FifaRating in a non-traditional way using a rating period, for compatibility with the other algorithms, and for ease of use in tournaments.