Bradley-Terry's Model This is a model for "strength". Simply put, the concept is that each "strength" can be quantified from the result of the match. The following papers were helpful, so please see here for details. Quantitative evaluation method for "strength" and its application
There are n elements (teams and individuals) and some kind of match is played. A match is a one-element to one-element match, and the result is only a victory or defeat against one element. The "strength" of each element is measured from the results of several battles. Here, assuming that the probability that element i wins element j is Pij, for all combinations, Pij = πi / πi + πj (1) Introduce πi. The relational expression of equation (1) is called the Bradley-Terry (BT) model. In the BT model, πi can be thought of as representing the strength of element i.
I refer to the lecture contents at Data mining study session based on statistical processing and machine learning # 03 that I attended the other day. Here is a Python implementation of Bradley-Terry's Model. (The numbers assigned to ws are a list of the total number of wins for the six Central League teams in 2014, excluding the results of the interleague game. For convenience, the draw is counted as 0.5.) The theta obtained here is the numerical value of the "strength" of each team.
import numpy as np
theta = np.ones(6)/6.0 # \theta initial value
t = np.zeros(6)
r = 24.0 #Number of matches
ws = np.array([66.5, 66.5, 66, 56.5, 55, 50.5]) #Total number of wins
for iloop in range(0, 100):
for i in range(0,6):
acc = 0 #Accumulator for summation
for j in range(0,6):
if (j == i):
pass
else:
acc += r / (theta[i]+theta[j])
t[i] = ws[i]/acc
s = sum(t)
for i in range(0, 6):
theta[i] = t[i] / s
With reference to the above Bradley-Terry's Model, I tried to graph the transition of the Central League over 5 years with matplotlib.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import os
theta = np.ones(6) / 6.0
t = np.zeros(6)
r = 24.0
teams = [u"Giant", u"Hanshin", u"Hiroshima", u"Chunichi", u"Yokohama", u"Yakult"]
colors = ["#f27b00", "#ffff00", "#ff0000", "#002468", "#044a90", "#111c3c"]
scores = [[67.5, 68, 48, 68.5, 42.5, 65.5], [66, 61, 57, 66, 43.5, 66.5], [76.5, 51.5, 55.5, 69, 43, 64.5], [74, 62.5, 58.5, 57.5, 55, 51.5], [66.5, 66.5, 66, 56.5, 55, 50.5]]
years = ["2010", "2011", "2012", "2013", "2014"]
points = [[], [], [], [], [], []]
def reset():
global theta
theta = np.ones(6) / 6.0
def bradley_terry(ws):
for iloop in range(0, 100):
for i in range(0, 6):
acc = 0
for j in range(0, 6):
if i == j:
pass
else:
acc += r / (theta[i] + theta[j])
t[i] = ws[i] / acc
s = sum(t)
for i in range(0, 6):
theta[i] = t[i] / s
if __name__ == '__main__':
for score in scores:
reset()
bradley_terry(score)
for i in range(0, 6):
points[i].append(theta[i])
for i in range(0, 6):
data = np.loadtxt(points[i])
plt.plot(
data,
linestyle="-",
color=colors[i],
label=teams[i],
linewidth=2
)
plt.ylim(0, 0.5)
X = np.arange(len(years))
plt.xticks(X, years)
plt.tick_params(labelleft="off")
plt.xlabel("Year")
plt.ylabel("BradleyTerry Rate")
plt.title("Central League")
plt.grid(True)
plt.legend(loc="best")
plt.rcParams.update({"font.size": 20})
os.chdir("graph/")
plt.savefig("central.eps")
plt.show()
It turned out to be something like this. ・ Stable strength of the giant ・ Chunichi, Yakult's right shoulder down ・ Hiroshima and Yokohama are rising I think you can read ...
If you try the same in the Pacific League, the graph will be as follows.
Compared to the Central League graph, it is characteristic that the six line charts are messed up. You can often express the "mixed pa" that happens when the AB class is completely replaced in 2013 and 2014!
Recommended Posts