by Ryan Walker

Google Prediction API First Looks

Sitting around on a Sunday night, decided to finally take a little dive on something that’s had my eye for a while, the Google Prediction API.

Signup

  1. Visited the Google APIs console and turned on the Google Prediction API.
  2. Needed to sign up for Google Storage account - this seemed discouraging, since it was a Google Docs waiting list, and I figured I’d be dead in the water tonight, maybe waiting forever. I wrote as persuasive an application as I could :)
  3. I noticed that they metioned they were going to turn on billing in early 2011, pricing was only $10/month. From the console, there was a “billing” link that I could enable. So I decided to enable billing, hoping that would help with Google Storage account issue.
  4. Checking my email, I had already been emailed a Google Storage invite. Not sure if it was automatic or my application caught their eye (I suspect the former) but the hurdle was jumped. Woot!

Hello Prediction

I followed the hello world tutorial that Google provides. I won’t cut-and-paste all the steps, since the tutorial is well-written, but here are some notes from the process.

  1. I needed to install gsutil - pretty easy; instructions here.
  2. I needed to create a Google Storage access key.
  3. Can’t use bucket ‘examplebucket’. I used ‘play-prediction’ and it allowed me to create bucket and then I copied the file up using gsutil cp ./language_id.txt gs://play-prediction/prediction_models/languages.
  4. Save your Google API Access Key (found on the API Console through the “API Access” link on the left, at the bottom of the page “Simple API Access”, to file googlekey.
  5. I copied oauth-train.sh, oauth-check-training.sh, and oauth-predict.sh to my local project folder, and chmod 755 on the to make them executable.
  6. I was able to train using ./oauth-train.sh play-prediction/prediction_models/languages command.
  7. ./oauth-check-training.sh play-prediction/prediction_models/languages yielded the expected result, training accuracy was 0.95.
  8. ./oauth-predict.sh play-prediction/prediction_models/languages "\"Sitting around on a Sunday night, decided to finally take a little dive on something that’s had my eye for a while, the Google Prediction API.\"" was interpreted as English correctly.
  9. ./oauth-predict.sh play-prediction/prediction_models/languages "\"El sol se levantará mañana y quién sabe lo que traerá la marea?\"" was interpreted as Spanish correctly.
  10. ./oauth-predict.sh play-prediction/prediction_models/languages "\"La gloire est éphémère, mais l'obscurité est éternelle.\"" was interpreted as French correctly.

I noticed the engine didn’t perform as well on short phrases, to be expected.

Closing

Very cool system, took me about an hour to get through the tutorial.

Mission accomplished, Google Prediction API is much less abstract in my mind now.