Playoff Predictor, Round 3 2008

Well the second round of the playoffs is over, and it's time to give my simulator another spin. First, let's look at the results from Round 2:

Montreal_Canadiens 0.616 0.348 0.147
Detroit_Red_Wings0.772 0.530 0.380
Philadelphia_Flyers 0.384 0.174 0.056
Colorado_Avalanche 0.228 0.091 0.039

Pittsburgh_Penguins 0.568 0.289 0.114
San_Jose_Sharks 0.483 0.180 0.094
New_York_Rangers 0.432 0.189 0.064
Dallas_Stars 0.517 0.199 0.107

The simulator goes 3 for 4 this round with the only one not going its way being the Montreal-Philly series. Overall, the simulator's predictions have been 11 for 12. Not too shabby huh?

Here are the predictions of my simulator for the conference finals:

Pittsburgh_Penguins 0.579 0.204
Philadelphia_Flyers 0.421 0.119

Detroit_Red_Wings 0.681 0.498
Dallas_Stars 0.319 0.178

So according to the program, Detroit has just shy of a 50% chance to win the whole thing, and their likely opponents is the Pittsburgh Penguins. Dallas and Pittsburgh are very close for 2nd place and Philly is not liked as much by the program.

See Round 2 and Round 1 for more information.

Heraldk

Playoff Predictions, Round 2, 2008

I posted before the first round playoffs started to present some output from my NHL playoff simulator. How'd it do at predicting the results? Well let's have a look. I removed the later round predictions from the last post just to clean this up and make it easier to read. Correct predictions are in bold.

Montreal_Canadiens 0.720
Detroit_Red_Wings 0.811
Boston_Bruins 0.280
Nashville_Predators 0.189
Pittsburgh_Penguins 0.590
San_Jose_Sharks 0.634
Ottawa_Senators 0.410
Calgary_Flames 0.366

Washington_Capitals 0.481
Minnesota_Wild 0.468
Philadelphia_Flyers 0.519
Colorado_Avalanche 0.532
New_Jersey_Devils 0.477
Anaheim_Ducks 0.414
New_York_Rangers 0.523
Dallas_Stars 0.586

Not bad huh? In every case, the favourite team of each match was the one that won. Three of the series went right down to the wire though, and I honestly thought Washington was going to beat Philly in game 7. They were a feel good story this year, along with the Oilers late season push to the playoffs that fell *just* short. San Jose and Montreal almost choked in the first round on series leads, but managed to pull through in the end.

So what does the simulator say for the next round? Once again the first column is the probability of winning that round. The second column is the probability of winning the conference final, and the third column is the probability of taking home the cup. This run is one million playoff simulations seeded with the results of the first playoff round.

Montreal_Canadiens 0.616 0.348 0.147
Pittsburgh_Penguins 0.568 0.289 0.114
New_York_Rangers 0.432 0.189 0.064
Philadelphia_Flyers 0.384 0.174 0.056

Detroit_Red_Wings 0.772 0.530 0.380
San_Jose_Sharks 0.483 0.180 0.094
Dallas_Stars 0.517 0.199 0.107
Colorado_Avalanche 0.228 0.091 0.039

Detroit, Dallas, Montreal, and Pittsburgh are the favourites according to the simulator. The only selection that is a bit surprising for this round is Dallas - but I'm not too surprised by that considering some of the numbers they put up this year. If they can shut down Thornton, they've got a pretty good shot at the conference finals.

Overall Detroit still has the highest probability of winning the cup, up to 38% now. Montreal and Pittsburgh are neck and neck for second place in probability of winning the cup. Dallas and San Jose are next and the last three have a 6% or less chance.

Now that the first round is out, the last remaining Canadian team is my second favourite team in the league: the Montreal Canadiens. So since the Oil are down and out, I'm cheering for them. Push that 14.7% edge boys!

Heraldk

Predicting the NHL Playoffs 07/08

I've become increasingly interested in computer solutions and simulations for domains where you might not expect something can be done. One domain that I've been more and more interested in is NHL hockey -- a sport that I'm a fan of. So before the 2007/2008 playoffs started, I decided to write a simulator that figured out how likely it was that each team won the stanley cup based on their regular season statistics. The results are below, with each team's probability of making it past each round the numbers in the columns. So the Montreal Canadiens have a 72% chance of beating the bruins, and a 12.2% chance of winning the cup.

Montreal_Canadiens 0.720 0.446 0.264 0.122
Pittsburgh_Penguins 0.590 0.362 0.193 0.083
Washington_Capitals 0.481 0.224 0.097 0.033
New_Jersey_Devils 0.477 0.217 0.096 0.034
New_York_Rangers 0.523 0.250 0.116 0.043
Philadelphia_Flyers 0.519 0.236 0.110 0.039
Ottawa_Senators 0.410 0.167 0.086 0.030
Boston_Bruins 0.280 0.098 0.039 0.010

Detroit_Red_Wings 0.811 0.622 0.449 0.330
San_Jose_Sharks 0.634 0.368 0.150 0.082
Minnesota_Wild 0.468 0.187 0.056 0.024
Anaheim_Ducks 0.414 0.182 0.069 0.033
Dallas_Stars 0.586 0.306 0.141 0.079
Colorado_Avalanche 0.532 0.178 0.068 0.031
Calgary_Flames 0.366 0.086 0.037 0.015
Nashville_Predators 0.189 0.072 0.030 0.012

What's startling is Detroit's enormous 33% chance of winning the whole thing. A couple of other surprises include Dallas' relatively high probability of winning the cup (7.9%). It's much higher than the Ducks or Avs which are next to them in the standings.

How does this work? I basically calculate the average goals a team is expected to score against their opposing team by using the season goals-for and goals-against numbers. I use this to simulate games between teams and run entire playoff simulations. The probabilities above are simply the number of times that team reaches the next round divided by the number of simulations.

I don't have very many features added in that I would like to add. One particular one is a recency statistic that increases the relevance of the last 20 games of the season. I expect that such a statistic will greatly increase San Jose and Washington's chances of winning the cup and probably dampen Dallas' chances.

Credit to Darse for giving me some hints and tips on how to create my simulator. Hopefully I'll get a chance to work on it a bit more so that I can build in some more statistics to help it make a more informed decision.

Heraldk

Vancouver Day 1

I'm in Vancouver! Today is day 1 of several, and I'll be trying to keep up with the blogging over the next few days. We'll have to see how well that works ... My day started really early. I couldn't sleep for some reason so I spent some time working on the man-machine website starting at 5:00 in the morning. My parents came to get me around 7:00 and they dropped me off at the airport with plenty of time to get through security and wait for my flight to board. En route, I picked up a copy of the new harry potter book at the airport bookstore. No lineup!

The flight was pretty painless -- I was on a flight with Maria, Duane, and Neil which was cool. We ended up hanging out for most of the morning and afternoon. For lunch we stopped at a place called the "Bellagio Cafe" ... which I thought was fitting since the Bellagio is only a huge casino in Vegas, and we were here to compete in a poker match!

After lunch we went to go visit the Planetarium, which was pretty neat. I was a little disappointed with most of the displays, but it was a good way to kill some time that's for sure. There was one of the motion simulators though which was pretty fun. We also went to two shows in the planetarium dome itself. Both weren't that great and I found myself drifting off to sleep which wasn't very good. That might have had something to do with my being awake at 5:00! We also attended two live demos. They were pretty neat, but the second was particularly fun because the second potentially good omen was that the presenter gave particular emphasis to the north star ... Polaris. Which just happens to be the name of our bot.

We ran into Nolan, Mike, Josh, and Andrew at the planetarium which was cool. We separated early though since we had been there for a few hours already and we needed to get back (I needed to meetup with Darse whom I am sharing a condo apartment with).

It took a little while to get organized, but finally we confirmed that we'd be going out to dinner with Ali. It was pretty cool -- Ali seems like a pretty smart guy. Phil should have arrived by now, but I haven't had a chance to meet him yet. Dinner was a pretty fancy restaurant called Cin Cin. It was pretty good, but certainly more expensive than I'd eat on a regular basis. I mean, $11.50 for dessert? COME ON! (Arrested Development anyone?)

Tomorrow there will be a press conference with both Ali and Phil. I'll try and get some photos during that to post to the website. Afterwords there'll be a players meeting where we confirm all the rules ... and we get to test all our equipment (again) to make sure everything runs smoothly. The match runs on Monday!!!! That's just 2 sleeps!

Hope everyone is doing well. I'm having fun! Heraldk

Robocup Soccer

I was talking to Michael Bowling yesterday on the train and somehow the topic of his experience in robocup competitions came up. He's got lots of great stories about the odd things that happen at these competitions, and it's always really cool to talk to him about his experiences. In this conversation, I had my own experience to talk about. You see, in CMPUT 366 a few years ago, our introductory course on AI held a robocup simulation tournament. For those who don't know, robocup is the robot soccer competition, and it has many tournaments from a simulation based league to actual robots. Since this was an AI course, we were concentrating on the AI side of things and thus robots didn't come into play. I figured that since it's an interesting subject, I'd talk a bit about how I approached the problem and maybe give you an idea of what it is like to work in AI. Robocup Simulation

First of all, AI research is a whole lot more glitzy on the outside than it is internally. From the outside, game playing programs like Chinook and Deep Blue were able to make intelligent looking moves. On the inside though, the programs were unintelligently exploring millions of game states looking for the best move. So while I describe my approach to the soccer playing program, keep this in mind.

The tournament was run using a copy of the actual robocup simulation program. The simulation runs as follows: A server is started up that keeps track of where each player is, where the ball is, what the score is, etc. It enforces rules such as offside, and returns players to their half of the field after someone scores a goal. The server communicates with the programs that we, the students, wrote for the players taking in the actions that each player on the field makes at each timestep. One of the things that made this project a little difficult was that the actions the players were allowed to do were not very well documented and each student had to spend some time getting used to the interface to build their soccer playing program.

Each student was provided with a sample program that played elementary student style -- all players run towards the ball and kick it towards the opponent goal. My expectation was that many students would not build programs that were much more complicated than this style. So my goal was to be able to beat that program reliably first.

I spent a great deal of time examining the documentation that did exist for the simulator, and stumbled across a very interesting piece of information about how goaltenders had a special ability. Apparently, the simulator allowed the goalie to 'catch' the ball, and then teleport to another spot in the crease area. I spent several hours figuring out just how to get this to work, and succeeded after not too long. This was the biggest step I made in beating the "swarm the ball" type teams. Since the goaltender was now capable of teleporting to the other side of the goal and kick it down field, I had an easy way of getting the ball away from a large number of players in a concentrated space.

Now that I had my defensive position setup, I had to figure out a good way to generate some offense. Due to time constraints, and my doubts on getting a slick system working with no bugs, I decided to avoid complicated and potentially dangerous attempts to getting real communication and passing between players. Instead, I decided to try building in a heuristic-like system where players would tend to stay in their parts of the field unless the ball came near by. I had a set number of "forward", "defense", and "midfield" players who each had a home location. Next, to simulate passing, I had the defensemen kick the ball upfield at an angle towards the sides of the field (and incidentally where a player's "home base" was). Kicking to the sides of the field meant that the opponent players who clogged up the center of the field wouldn't intercept my "pass".

After I had this system working, my team looked strikingly intelligent. They'd clear the ball upfield down the sides (a lesson I learned from floor hockey), players looked very much like they were passing to one another, despite the lack of real communication. The players were blindly kicking the ball towards a place where another player tended to be. But most of the time that player had no reason to be elsewhere so he was there to retrieve the ball! Probably the least intelligent looking part of my end product was the finishing touch: kicking the ball into the net. At that point, my forwards behaved almost identically to the "swarm-the-ball" type players ... except that there wasn't nearly as many of them. So if my opponent had a good defensive position, I had trouble scoring on them. Unfortunately, I didn't have time to figure out how to improve that before the tournament started.

I did quite well in the tournament. The tournament was organized into 2 parts: a round robin seeding and then a bracketed finals system. I won my pool fairly handily which meant that I got a decent starting placement in the brackets. My program reached the quarterfinals before getting knocked out - which was a pretty happy result for me considering the size of the class. I think if my program's offense was tweaked a little more, I would've gone a little further.

The winning program? His strategy was almost a purely defensive strategy. He had a goalie and at least one other player sitting around the goal protecting it. Teams had a really hard time scoring on this program. The games were low scoring affairs, since this program had less players to form an offensive attack. Still, since players lacked offensive prowess, the defensive strategy was the right way to go for this tournament.

So ... that's what it is like to work on a program's AI. At least, that has been my experience with it. The later projects I've worked on, such as the Hex project and the Poker project have introduced much more complexity ... but underneath the bright shiny hood of AI is an ugly mess of hacks and unintelligent heuristics. Still, you can't argue with results, can you?

Heraldk