lunedì 8 novembre 2010

Since I got the chance to access to both Google Storage for Developers and Google Prediction API (more details here and here), I decided to create a simple wrapper (just 4 basic functions until now) to be capable to play with the Google Prediction API from R.Here you can find the github repository for the project and below few lines of code reproducing an example you can find on the Google Prediction API website.

library(predictionapirwrapper)## The first stage of using the API is to acquire an authorization token. This can be done via this command:
token <- GetAuthToken(email="user@gmail.com", passwd="mypassword")## This command begins training on data that has been previously uploaded to Google Storage.
GoogleTrain(auth_token=token$Auth, mybucket="data_languages", mydata="language_id.txt")## Once training has started, this command checks the status of the training job and gets meta-information on the model (if available).
GoogleTrainCheck(auth_token=token$Auth, mybucket="data_languages", mydata="language_id.txt")## When training has finished, this command issues a request for a new prediction from the model.
GooglePredict(auth_token=token$Auth, mybucket="data_languages", mydata="language_id.txt", myinput="La idioma mas fina")