Using Microsoft’s TrueSkill to Rank Texas Six-Man Football Teams

People have always compared six-man football to a computer game. With its wild scores and fast-paced style, six-man football can be just as exciting, if not more so.

So what if you played the entire six-man season on your Xbox?

That’s why I decided to use the TrueSkill Ranking System created by Microsoft Research for Xbox Live games and apply it to the season.

Microsoft uses this algorithm to track the skill of gamers in order to place them in competitive matches. On the Microsoft Research website it explains that the ranking system is characterized by two attributes: a players average skill level (ranking) and the degree of uncertainty in the gamer’s skill (this would be the variation in the players level). If you would like to read more, it can be found at the Microsoft Research website, http://research.microsoft.com/en-us/projects/trueskill/

Heck, gamers love this thing. If you want to really know more about the math behind it, a guy named Jeff Moser has written a bunch on the subject.

Very nerdy links—→
Here http://www.moserware.com/assets/computing-your-skill/The%20Math%20Behind%20TrueSkill.pdf

And here
http://www.moserware.com/2010/03/computing-your-skill.html

As with any algorithm, there are several ways you could implement it. I decided in the first trial I would start of with no priors. This means all teams started the season with the base ranking. Since I also program primarily in Python, I decided to use the Trueskill package developed by a South Korean game developer named Heungsub Lee. It seems to be well-written and moderately documented.

Let’s take a quick look at the top-10.

1 Richland Springs 432
2 Borden County 425
3 Buena Vista 409
4 Austin Veritas 408
5 Happy 403
6 Gorman 403
7 Jonesboro 396
8 SA FEAST Homeschool 388
9 Crowell 381
10 Houston Emery-Weiner 381

Not bad, but not stellar. Let’s see the next 20

11 Calvert 379
12 Midland Trinity 377
13 Garden City 374
14 Valley 373
15 Dallas Inspired Vision 372
16 Follett 370
17 Zephyr 370
18 Abbott 369
19 Pasadena First Baptist 368
20 Gordon 366
21 Balmorhea 366
22 San Marcos Hill Country Christian 366
23 Bryan Christian Homeschool (BVCHEA) 366
24 Rochelle 364
25 Baytown Christian 364
26 Mt. Calm 363
27 Hermleigh 360
28 Nazareth 357
29 Chester 357
30 Sterling City 352

OK, but again, you can see some flaws.

One of the really cool things TrueSkill brings is a pretty good ability to predict the winners of games. In the version I ran, I allowed TrueSkill to predict all of the games, but throwing out the really close ones where it determined the probabilities of a team were between 47%-53%. One of the reasons to do this would be that during all of week one games, with probabilities at 50-50, we can just throw those out.

For the season, TrueSkill predicted 832 of 1108 (75.1%) games, which isn’t bad. For the playoffs, it is even better at 82-20 (80.4%).

It will be interesting to see how it does this week.

Matchup: Zephyr (11-2-0) at Abbott (11-2-0)
Rating Before: 370~28 / 369~29
Match Quality: 0.82
Zephyr odds winning: 50.9%
Prediction: TOSS-UP –> Zephyr

Matchup: Crowell (9-3-0) at Borden County (13-0-0)
Rating Before: 381~28 / 425~33
Match Quality: 0.68
Crowell odds winning: 27.6%
Prediction: Borden County

Matchup: Follett (12-1-0) at Buena Vista (13-0-0)
Rating Before: 370~31 / 409~37
Match Quality: 0.68
Follett odds winning: 30.2%
Prediction: Buena Vista

Matchup: Midland Trinity (11-2-0) at Houston Emery-Weiner (11-2-0)
Rating Before: 377~28 / 381~28
Match Quality: 0.83
Midland Trinity odds winning: 47.4% [predict: TOSS-UP]
Prediction: TOSS-UP –> Houston Emery-Weiner

Matchup: Guthrie (11-2-0) at Richland Springs (13-0-0)
Rating Before: 351~29 / 432~35
Match Quality: 0.44
Guthrie odds winning: 13.8%
Prediction: Richland Springs

Matchup: San Marcos Hill Country Christian (11-1-0) at WF Notre Dame (9-2-0)
Rating Before: 366~35 / 341~30
Match Quality: 0.75
San Marcos Hill Country Christian odds winning: 63.3%
Prediction: San Marcos Hill Country Christian (this one was played this morning-correct)

Matchup: Austin Veritas (12-0-0) at Waco Live Oak (10-2-0)
Rating Before: 408~37 / 339~32
Match Quality: 0.51
Austin Veritas odds winning: 81.7%
Prediction: Austin Veritas (this one just finished-correct)

I plan on making some adjustments to this and seeing what comes up. Stay tuned.

Just for fun, here’s the entire list

1 Richland Springs 432
2 Borden County 425
3 Buena Vista 409
4 Austin Veritas 408
5 Happy 403
6 Gorman 403
7 Jonesboro 396
8 SA FEAST Homeschool 388
9 Crowell 381
10 Houston Emery-Weiner 381
11 Calvert 379
12 Midland Trinity 377
13 Garden City 374
14 Valley 373
15 Dallas Inspired Vision 372
16 Follett 370
17 Zephyr 370
18 Abbott 369
19 Pasadena First Baptist 368
20 Gordon 366
21 Balmorhea 366
22 San Marcos Hill Country Christian 366
23 Bryan Christian Homeschool (BVCHEA) 366
24 Rochelle 364
25 Baytown Christian 364
26 Mt. Calm 363
27 Hermleigh 360
28 Nazareth 357
29 Chester 357
30 Sterling City 352
31 Guthrie 351
32 Cedar Park Summit 351
33 Watauga Harvest 349
34 Milford 347
35 Waco Methodist Childrens Home 347
36 Southland 346
37 Austin Hill Country 344
38 Granbury North Central Texas Academy 344
39 Rockwall Heritage 341
40 WF Notre Dame 341
41 Ira 339
42 Waco Live Oak 339
43 Newcastle 335
44 Stephenville Faith 334
45 Bastrop Tribe Consolidated 333
46 Fort Worth THESA 331
47 Walnut Springs 330
48 Fort Worth Nazarene 329
49 Motley County 328
50 Willow Park Trinity 328
51 Aspermont 323
52 Tioga 315
53 Blum 314
54 Coolidge 314
55 Longview Trinity 314
56 Conroe Covenant Christian 313
57 Savoy 311
58 Bryson 311
59 Klondike 308
60 Sugar Land HCYA Fort Bend 308
61 Austin NYOS 308
62 Decatur Victory Christian 308
63 Meadow 307
64 Seguin Lifegate 303
65 Houston Texas Christian 302
66 Capital City Christian Home School 300
67 Knox City 299
68 Sands 298
69 Giddings State School 298
70 Miami 297
71 Katy Faith West 297
72 Red Oak Ovilla Christian 297
73 Robert Lee 296
74 Union Hill 296
75 EP Faith 296
76 Santa Anna 295
77 Bronte 294
78 Spur 293
79 Rising Star 292
80 Evant 292
81 Dallas Academy 292
82 Marfa 290
83 Irving Faustina 290
84 Loraine 289
85 Marshall Christian Academy 288
86 Dallas Tyler Street 286
87 Weatherford Christian 286
88 Oglesby 283
89 Forestburg 281
90 SA Castle Hills 281
91 Williamson County Home School 281
92 Temple Centex Homeschool 280
93 Oakwood 279
94 Sugar Land Logos Prep 279
95 Huntsville Alpha Omega 279
96 Arlington St. Paul Prep 279
97 EP Immanuel Christian 278
98 Groom 277
99 Anton 274
100 Rankin 274
101 McLean 273
102 Gholson 273
103 Eden 272
104 Denton Calvary 272
105 Lucas Christian 272
106 Waco Vanguard College Prep 271
107 Whitharral 270
108 Westlake Academy 270
109 Corpus Christi WINGS 270
110 Bulverde Bracken Christian 268
111 Petersburg 267
112 Lefors 264
113 Corpus Christi Annapolis 263
114 Plano CHANT 263
115 Rule 262
116 Kress 261
117 WF Wichita Christian 261
118 May 259
119 Iredell 259
120 Fort Davis 259
121 Paint Rock 258
122 Sierra Blanca 257
123 Cotton Center 257
124 Fredericksburg Heritage 256
125 Athens Christian Prep 252
126 Westbrook 251
127 O’Donnell 251
128 Avalon 251
129 Water Valley 249
130 Paducah 249
131 Hart 249
132 High Island 249
133 Sidney 249
134 Blanket 248
135 Lubbock Home School 248
136 Dallas Lutheran 248
137 Dallas Lakehill 248
138 Campbell 246
139 Tyler HEAT 245
140 Wylie Preparatory 242
141 Abilene Christian 242
142 Azle Christian 241
143 Bellville Faith 241
144 Corpus Christi Abundant Life 240
145 Austin Brentwood Christian 239
146 Hedley 237
147 Houston Mount Carmel 237
148 SA The Winston 237
149 Amherst 234
150 Wellman-Union 233
151 Richardson Canyon Creek Christian 232
152 SA Lutheran 232
153 Strawn 231
154 Cherokee 231
155 Chillicothe 230
156 Orange Community Christian 230
157 Grandfalls-Royalty 229
158 Fannindel 228
159 Lorenzo 224
160 White Deer 223
161 Wilson 222
162 Lewisville Lakeland 221
163 Aquilla 219
164 Haslet Heritage Christian 219
165 McKinney Cornerstone 218
166 Higgins 217
167 Blackwell 216
168 Dawson 215
169 Spring Providence Classical 215
170 Pflugerville Concordia 215
171 Woodson 214
172 SA Great Hearts Monte Vista 214
173 New Home 212
174 Lueders-Avoca 212
175 Lingleville 211
176 Medina 211
177 Morgan 211
178 Covington 210
179 Apple Springs 208
180 Arlington Newman 208
181 Plainview Christian 207
182 Trinidad 204
183 Kerrville Our Lady of the Hills 203
184 Lockhart Lighthouse Christian 202
185 Victoria Home School 199
186 Silverton 198
187 Saint Jo 198
188 Crosby Victory and Praise 197
189 Ropes 196
190 Lewisville Founders Classical 196
191 Mullin 194
192 Lake Jackson Brazosport Christian 194
193 EP Jesus Chapel 192
194 Brownwood Victory Life 189
195 Amarillo Holy Cross 189
196 Jayton 188
197 Benjamin 187
198 Canton EXEL 187
199 Dell City 187
200 Throckmorton 186
201 Rotan 186
202 SA The Atonement 186
203 Johnson County Sports Association 185
204 Cranfills Gap 182
205 Carrollton Christian 182
206 Spring Branch Living Rock Academy 182
207 Waco Parkview 181
208 Alvin Living Stones 181
209 Odessa Latter Rain 180
210 Granbury Cornerstone 178
211 Dallas Fairhill 178
212 Grady 175
213 Fort Hancock 175
214 SA Sunnybrook 175
215 Veribest 172
216 Greenville Christian 171
217 New Braunfels Christian 171
218 Moran 169
219 EP Home School 165
220 Highland 163
221 Bryan Allen Academy 163
222 Sanderson 160
223 Lometa 159
224 Temple Holy Trinity Catholic 157
225 Kopperl 156
226 Arlington Flint Academy 156
227 Paint Creek 155
228 Midessa Homeschool 151
229 Panther Creek 149
230 Tyler King’s Academy 148
231 Fruitvale 148
232 Houston Sanchez Charter 148
233 Leverett’s Chapel 146
234 Bynum 145
235 Buckholts 144
236 Whiteface 143
237 Prairie Lea 143
238 West Columbia Charter 141
239 Gustine 140
240 Lohn 140
241 East Texas Home School 140
242 Northside 139
243 Irving Universal Academy 137
244 Brookesmith 136
245 Lazbuddie 132
246 Fayette County Sports Association 125
247 Fort Worth Hill 123
248 Round Rock Christian 122
249 Trent 119
250 Fort Elliott 119
251 Loop 116
252 Clear Lake Christian 113
253 Patton Springs 111
254 Conroe Lifestyle Christian 111
255 Penelope 108
256 Selma River City Believers 107
257 Gold-Burg 105
258 Killeen Memorial 101
259 SA River City 100
260 Harrold 97

100k Simulations of All Texas Private Six-Man Brackets

It was just time to get down to it. I had been delaying the inevitable, running 100,000 simulations of each and every private school six-man state bracket. For details on how I did this, please read the earlier posts I have written about the public school brackets and other Monte Carlo simulations I have written. This was very similar….

First build the start bracket using this week’s ratings from my website (www.sixmanfootball.com). Then calculate the probability of each first round game and simulate the result. After each round I update the ratings (not 100% like my formula, but a close enough estimation) and continue…. do this 100,000 times and see what happened.

Well, here’s what happened.

TAPPS D1          
TEAM FIRST QUARTERS SEMIS FINAL CHAMPION
Boerne Geneva 0 16679 33496 12466 37359
Midland Trinity 0 13728 45784 12329 28159
Baytown Christian 0 38588 25904 24432 11076
Watauga Harvest 25725 17419 26487 20469 9900
Rockwall Heritage 35535 37235 13252 10377 3601
Sugar Land Logos Prep 24633 61253 8646 2274 3194
Houston Emery-Weiner 74275 9537 10169 4741 1278
Pasadena First Baptist 64465 24177 6168 3917 1273
Abilene Christian 45374 38952 10399 4169 1106
Round Rock Christian 49480 43205 5492 864 959
Katy Faith West 50520 43067 4867 711 835
Austin Hill Country 54626 34092 7621 2879 782
Waco Vanguard 75367 22068 1715 372 478
TAPPS D2          
TEAM FIRST QUARTERS SEMIS FINAL CHAMPION
Waco Live Oak 0 9711 16354 17471 56464
Austin Veritas 0 20885 34691 29735 14689
Orange Community Christian 0 46910 27849 18231 7010
Dallas Tyler Street 36085 17714 34388 5019 6794
SA Castle Hills 22194 38296 19682 14086 5742
Cedar Park Summit 25660 66166 3416 2406 2352
Denton Calvary 0 69007 26428 2318 2247
Kerrville Our Lady of the Hills 63915 13279 18663 1980 2163
Bulverde Bracken Christian 36088 49169 9136 4452 1155
Dallas Lakehill 77806 14794 4581 2204 615
Conroe Covenant Christian 63912 29946 4061 1649 432
Lubbock Christ The King 74340 24123 751 449 337
TAPPS D3          
TEAM FIRST QUARTERS SEMIS FINAL CHAMPION
Longview Trinity 0 25590 27022 16279 31109
Fredericksburg Heritage 0 29268 21774 25772 23186
WF Notre Dame 0 36128 35968 11996 15908
Fort Worth Covenant Classical 11814 54054 22060 5912 6160
Granbury North Central Texas Academy 43834 15878 24039 10298 5951
Seguin Lifegate 15010 58039 11590 10003 5358
Richardson Canyon Creek Christian 41133 42480 8406 3951 4030
San Marcos Hill Country Christian 56166 14491 19126 6837 3380
Alvin Living Stones 0 69631 22245 5739 2385
WF Wichita Christian 58867 31930 5010 2152 2041
Brenham Christian 84990 12693 1226 805 286
Selma River City Believers 88186 9818 1534 256 206
TCAF D1          
TEAM SEMIS FINAL CHAMPION
Fort Worth Nazarene 25645 32238 42117
Wylie Preparatory 26385 35665 37950
Dallas Inspired Vision 74355 15287 10358
Waco Methodist Childrens Home 73615 16810 9575
TCAF D2          
TEAM SEMIS FINAL CHAMPION
Azle Christian 20861 16452 62687
Granbury Cornerstone 32698 49507 17795
Weatherford Christian 79139 7600 13261
Arlington St. Paul Prep 67302 26441 6257
TCAL D1          
TEAM QUARTERS SEMIS FINAL CHAMPION  
Bryan Allen Academy 1340 2173 2839 93648
SA The Atonement 47104 23154 28492 1250
Tyler King’s Academy 48830 49877 289 1004
Greenville Phoenix 44302 28918 25840 940
EP Faith 52896 22695 23532 877
Bryan Christian Homeschool (BVCHEA) 51170 47717 255 858
Houston Mount Carmel 98660 233 266 841
Clear Lake Christian 55698 25233 18487 582
TCAL D2          
TEAM QUARTERS SEMIS FINAL CHAMPION
Stephenville Faith 2150 4906 24891 68053
Sugar Land HCYA Fort Bend 4188 21572 49549 24691
Corpus Christi Annapolis 12883 64578 18001 4538
Killeen Memorial 37562 58609 2464 1365
SA Sunnybrook 62438 35860 1165 537
Corpus Christi Abundant Life 97850 625 1092 433
Corpus Christi WINGS 87117 11393 1290 200
Lockhart Lighthouse Christian 95812 2457 1548 183
TAIAO D1          
TEAM QUARTERS SEMIS FINAL CHAMPION
Tyler HEAT 9493 28388 28029 34090
SA FEAST Homeschool 23317 29535 20494 26654
Capital City Christian Home School 34148 35468 15424 14960
Temple Centex Homeschool 39095 38257 12965 9683
Fort Worth THESA 65852 22050 7102 4996
Crosby Victory and Praise 60905 27484 7228 4383
Bryan Aggieland Home School (BCAL) 76683 12947 6135 4235
Plano CHANT 90507 5871 2623 999
TAIAO D2          
TEAM QUARTERS SEMIS FINAL CHAMPION
Austin NYOS 0 18228 29436 52336
Bastrop Tribe Consolidated 0 29389 40156 30455
Waco Parkview 19490 54627 17568 8315
San Marcos Homeschool 21741 62559 8584 7116
Weatherford Home School 78259 19213 1626 902
Victoria Home School 80510 15984 2630 876

Obviously for TCAF, I am moving straight into this week since the first round was played last weekend.

Another thing to notice is that teams like Austin NYOS do not lose in the first round. Why? They got a bye.

The biggest shocker at first glance – the fact that Bryan Allen Academy is such a huge favorite. I expected it to be high, but 93.6% to win it all is a little obscene.

So I hope everyone enjoys this… and remember, no wagering.

Creating Maps on the Fly For UIL Realignment

This morning the high school football season officially started with the release of the much anticipated 2014-2016 UIL Football Alignments. This usually started with the UIL servers crashing due to the high volume of traffic (it did briefly, prior to release). This year the UIL was prepared and had a back-up plan to divert traffic off their site.

So at exactly 9:00 am, the Twitterverse was alive with the ramblings of everyone who cares about Texas high school football.

I downloaded the files and immediately started sorting the teams into an Excel spreadsheet I had prepared for the occasion. Once done, I placed the data into my main database online.

I had been modifying my map code I created and showed in a previous post to handle the different divisions, sort them by division and district and color code them. By recycling this code, I easily created three maps.

Here’s the one where I sort them by division (blue for d1, red for d2)
http://sixmanfootball.com/big_alignment_map.php

Here’s a look at it

2014 UIL Realignment

2014 UIL Realignment

Then here are the ones where I separate Division 1 and 2 and then split up the districts.
http://sixmanfootball.com/alignment_map.php?did=1
http://sixmanfootball.com/alignment_map.php?did=2

Here’s an example shot of what they look like

UIL Division 1 snapshot

UIL Division 1 snapshot

Using the new google maps API, it took less than an hour to get everything up and running. All that was left was a little formatting and fine-tuning. The conversion of the data to an XML file makes all of the debugging so much easier.

Creating Maps with MySQL, PHP and Google Maps API v3

It has been awhile since I started this and never really followed up. I created this blog to be a space where I can share data, news and concepts I am working with.

I have been feverishly working on a project that will be hosted here that just doesn’t seem to want to end. In the meantime, I decided I needed to catch up with a few projects that I have actually completed.

Over the past week, Google has been sending out reminders that their support for Google Maps API v2 was ending. They were going to provide a wrapper to try and support the old API. With the six-man football season in the middle of the playoffs, I was trying to put this off for at least a few more weeks. Unfortunately that all changed when my maps went blank a few days ago.

As usual, I hit the place where I tried to find a blog or post where combining MySQL, PHP and GM v3 all went together. I also just starred at the screen for what seemed to be an eternity.

I am here to tell you, Google Maps v3 is great. Converting the data points to XML, then plotting them is really quite simple.

The example I am going to post might seem a bit long, but it is a modified version of the explanation on the google developer site, retold in terms humans without too, too much experience can decipher.

First off, you need to create the XML file.

The example I am using is taken from my own website, sixmanfootball.com. This file is used to populate two maps, including the one on the index page and the weekly maps page. It is WAY more complex than many uses, but I thought it would be good to show the details.

Let’s call this file, makeXML.php

include('your_db_connection_file.inc');
// I like to use weird names like .inc files for hidden files
// this is something I was taught by someone somewhere
//who was wiser than me

header("Content-type: text/xml");

//function to help parse everything to XML
function parseToXML($htmlStr)
{
$xmlStr=str_replace('<','<',$htmlStr); $xmlStr=str_replace('>','>',$xmlStr);
$xmlStr=str_replace('"','"',$xmlStr);
$xmlStr=str_replace("'",''',$xmlStr);
$xmlStr=str_replace("&",'&',$xmlStr);
return $xmlStr;
}

//your actual db connection
$dblink = mysql_connect('localhost', $dbuser, $dbpass);
$dblinked = mysql_select_db($dbname, $dblink);

$key=13;

// Start XML file, echo parent node
echo '';

//my SQL command to get the game info
$q2 = "SELECT team_a, team_b, game_location, game_date, game_time FROM games WHERE game_time>0 AND game_week=$key ORDER BY game_location, game_time DESC";
$r2 = mysql_query($q2);

while($a2 = mysql_fetch_array($r2))
{
$team_a = $a2[team_a];
$team_b = $a2[team_b];
$game_site = $a2[game_location];
$game_date = $a2[game_date];
$game_time = $a2[game_time];
$game_date=date('D',$game_date);
$game_time=$game_time = date('g:i A', $game_time);

$site_search = mysql_real_escape_string($game_site);
If ($site_search==$last_site)
{$previous=$game_name."
";} else
{$previous="";}

//sub SQL command to get the longitude and latitude
$q3 = "SELECT * FROM teams WHERE team_name='$site_search' AND team_lat<>0";
$r3 = mysql_query($q3);
while($a3 = mysql_fetch_array($r3))
{
$game_lat = $a3[team_lat];
$game_long = $a3[team_long];
$game_name = $previous.$team_a." vs ".$team_b." in ".$game_site." (".$game_date.", ".$game_time.")";

echo '<marker ';
echo 'name="' . parseToXML($game_name) . '" ';
echo 'lat="' . $game_lat . '" ';
echo 'lng="' . $game_long . '" ';
echo 'type="stadium"';
echo '/>';
}
//this is used to see if there is more than one game at a particular site
//that way the second node for that site is a combo node including both games
$last_site=$game_site;
}
// End XML file
echo '';

OK, now that we have XML, you can check it by calling the page via a browser and make sure it is all working.

The next step is creating the page where you make the actual map. Honestly, I was scared. I hate trying to figure out what I really did 2-3 years ago. I will share some generic code that ties in with the weekly_maps page.

In a later post, I will share how to pass a variable to the XML page for a specific query that is not predetermined.

This is all javascript, but I wrap it within a PHP template page.

So the end result looks something like this.
scrnshot
Here’s a photo when someone clicks a map bubble.

scrnshot2