In a previous post, I was using Google’s prediction API to predict what game was streaming based on the color histogram of an image. The API worked pretty well and was fairly accurate. The main downside was that is was slow and inconsistent. Many of the requests would just time out and give a generic 503 error. This lead me to looking into alternatives, ideally one that is fast, free, and I could easily do myself.
With these issues I started looking for an alternative, possibly an existing library out there that I could run locally. Then I came across the liblinear library which is a linear classification library that supports a bunch of different classifiers and has bindings for pretty much every language. I ended up using the liblinear-ruby gem.
In the previous post, we have already put together our training set. Now we just need to train our new liblinear model.
Now we have our trained model in the file
games.model and can start querying it.
So how does this compare with Google’s prediction API?
As you can see, aside from Starcraft 2, all games had either the same correctly predicted results or better. Combining the accuracy and speed of this model, we could next start predicting on screens from live video streams.
You can find the code for this in github: https://github.com/abronte/GamePredict