hello,

I came across the below piece somewhere where they have used Elo rating for predicting IPL winner.

I want to know how such a thing can be implemented in R/Python??

Can someone help me on this??

hello,

I came across the below piece somewhere where they have used Elo rating for predicting IPL winner.

I want to know how such a thing can be implemented in R/Python??

Can someone help me on this??

I never came across Elo ratings before but looked it up. Its a very old method which was traditionally used for rating chess players. I found some links which can guide you better:

- http://gobase.org/studying/articles/elo/
- https://metinmediamath.wordpress.com/2013/11/27/how-to-calculate-the-elo-rating-including-example/
- http://fivethirtyeight.com/features/how-we-calculate-nba-elo-ratings/

Do you wish to apply it on the same problem or a different one? I’ll be glad to discuss further in detail if required.

Cheers!

You could try the PlayerRatings package in R. (https://cran.r-project.org/web/packages/PlayerRatings/PlayerRatings.pdf). It has implementations of Elo & Glicko rating systems.

In fact, you should join the March Machine Learning Madness competition currently running on Kaggle, where you need to predict the outcomes of college basketball matches. Some participants have shared scripts that make use of Elo for this.

This can definitely be implemented in R @hackers

Do you have the data points for the same

Regards,

Anant

I wrote a code snippet for calculating the ELO rakings

```
# Elo Ratings
# ELO ratings cannot be updated on a transaction basis. The entire win lose data has to be fed and elo rankings will get updated
teams <- data.frame(name=c('team1','team2','team3'),elo=c(0,0,0))
teams$name <- as.character(teams$name)
matches <- data.frame(matchNo <- c(1,2,3),winteam=c('team1','team1','team2'),loseteam=c('team2','team3','team3'))
matches$winteam <- as.character(matches$winteam)
matches$loseteam <- as.character(matches$loseteam)
# Call the function to update the ELo rankings
teams <- updateElo(teams, matches)
# Function to update ELO rakings
updateElo <- function(teams,matches)
{
teams$updatedElo <- 0
for(team in teams$name)
{
# Denominator
matchCount <- nrow(matches[matches$winteam==team | matches$loseteam==team,])
# Numerator
numerator <- 0
curteamMatches <- matches[matches$winteam==team | matches$loseteam==team,]
for(i in 1:nrow(curteamMatches))
{
if(curteamMatches[i,2]==team) numerator <- numerator + 400 + teams[teams$name==curteamMatches[i,3],2]
if(curteamMatches[i,3]==team) numerator <- numerator - 400 + teams[teams$name==curteamMatches[i,2],2]
}
teams[teams$name==team,3] <- numerator / matchCount
}
teams$elo <- teams$updatedElo
teams$updatedElo <- NULL
return(teams)
}
```

**Next Step **

I am trying to find out if the ELO ranking methodology has a mean. I am trying to experiment with random match results

Regards,

Anant