This function implements the multidimensional ELO (mELO) rating system for performing pairwise comparisons. The mELO rating system has the desirable properties of being able to handle cyclic interactions and is better behaved in the presence of redundant copies of players/agents or tasks.
mELO( match_data, init_data = NULL, init_c_mat = NULL, init_rating = 2200, k = ifelse(!is.null(init_c_mat), ncol(as.matrix(init_c_mat)), 1), eta_1 = 27, eta_2 = 1, p1_advantage = 0, save_history = TRUE, sort = TRUE )
match_data | A data frame containing four columns: (1) a numeric vector denoting the time period in which the game took place (2) a numeric or character identifier for player one (3) a numeric or character identifier for player two and (4) the result of the game expressed as a number, typically equal to one for a player one win, zero for a player two win and one half for a draw. |
---|---|
init_data | Initialise a rating model with |
init_c_mat | Initialise a rating model with |
init_rating | The initial rating for players not appearing in
|
k | Integer defining the complexity of non-transitive interactions to model. |
eta_1 | Learning rate for the ratings vector. |
eta_2 | Learning rate for elements of the C matrix. |
p1_advantage | Player 1 advtange parameter. Either a single value or a
vector equal to the number of rows in |
save_history | If |
sort | If |
A list object of class "mELO_rating
" with the following
components:
A data frame of the results at the end of the final time period. The variables are self explanatory except for Lag, which represents the number of time periods since the player last played a game. This is equal to zero for players who played in the latest time period, and is also zero for players who have not yet played any games.
An array containing the ratings history for all players.
An estimate of the C matrix.
An array containing the history of the C matrix.
A single value or a vector values for the advantage Player 1 had.
Integer defining the complexity of non-transitive interactions to model.
Learning rate for the ratings vector.
Learning rate for elements of the C matrix.
The type of model. In this case, "mELO".
The player 1 success probabilities predicted prior to adjusting to the outcome of the match.
The outcome for player 1 for each match.
The mean logloss error for all predictions.
Balduzzi, David, et al. "Re-evaluating Evaluation." arXiv preprint arXiv:1806.02643 (2018).
#> # A tibble: 6 x 4 #> time_index throw_1 throw_2 outcome #> <int> <chr> <chr> <dbl> #> 1 1 PAPER ROCK 1 #> 2 2 ROCK SCISSORS 1 #> 3 3 SCISSORS PAPER 1 #> 4 4 ROCK PAPER 0 #> 5 5 SCISSORS ROCK 0 #> 6 6 PAPER SCISSORS 0#> #> ELO Ratings For 3 Players Playing 120 Games #> #> Player Rating Games Win Draw Loss Lag #> 1 SCISSORS 2204.6 80 40 0 40 0 #> 2 ROCK 2204.6 80 40 0 40 1 #> 3 PAPER 2190.7 80 40 0 40 0 #>#> time_index throw_1 throw_2 outcome ELO_preds #> 1 1 PAPER ROCK 1 0.4799619 #> 2 2 ROCK SCISSORS 1 0.4999898 #> 3 3 SCISSORS PAPER 1 0.5200482 #> 4 4 ROCK PAPER 0 0.5200381 #> 5 5 SCISSORS ROCK 0 0.5000102 #> 6 6 PAPER SCISSORS 0 0.4799518# Predictions are all ~0.5 # Fit a mELO model that can handle these types of interactions. rps_mELO <- mELO(rps_df, k=1) rps_mELO#> #> mELO Ratings For 3 Players Playing 120 Games #> #> k = 1. #> #> Player Rating Games Win Draw Loss Lag #> 1 PAPER 2203.1 80 40 0 40 0 #> 2 ROCK 2198.7 80 40 0 40 1 #> 3 SCISSORS 2198.2 80 40 0 40 0 #>#> PAPER ROCK SCISSORS #> PAPER 0.000 1130.431 -1140.229 #> ROCK -1130.431 0.000 1134.765 #> SCISSORS 1140.229 -1134.765 0.000#> time_index throw_1 throw_2 outcome mELO_preds #> 1 1 PAPER ROCK 1 0.998546265 #> 2 2 ROCK SCISSORS 1 0.998550921 #> 3 3 SCISSORS PAPER 1 0.998551335 #> 4 4 ROCK PAPER 0 0.001453735 #> 5 5 SCISSORS ROCK 0 0.001449079 #> 6 6 PAPER SCISSORS 0 0.001448665# Much better predictions!