I’m trying to model a rating system for a competitive game that comprises of 2 parts: a match prediction network and a rating update network, each having several parameters.

Each team starts off with the same rating.

Iterating through the matches in ascending chronological order, a logistic regression predicts the match outcome based on a single predictor: the difference in the 2 team’s ratings, so that there is an intercept (**b0**) and a coefficient (**b1**) to be identified.

The predicted outcome from the logistic regression and the actual outcome are then used with a gain parameter (**alpha**) to detail how much rating should be assigned to the winner (and consequently removed from the loser).

Each team has their rating accordingly updated.

After several rounds of competition the ratings have steadied out.

i.e. for game i in 1…N:

team1 = games[i][‘team1’]

team2 = games[i][‘team2’]

logit(Pr(team1win)) = **b0** + **b1** * (rating[team1] - rating[team2])

rating_update = **alpha** * (outcome[i] - Pr(team1win))

ratings[team1] += rating_update

ratings[team2] -= rating_update

I’ve framed it as a general optimisation problem by using the total accuracy over the dataset as the fitness value and fitting the 3 parameters using a genetic algorithm works well, but I’d be interested in treating the parameters as random variables using PyMC.

However, I can’t work out how to parameterise it since the data inputs (ratings and Pr(team1win)) aren’t fixed in advance and are dependent upon the output of the 2 models at each timestep.