Google Prediction API

Libraries and Sample Code

This page lists helper libraries that you can use to access the Prediction API in various languages, and two complete sample applications that use the API for common scenarios.

Contents

  1. Featured Samples
  2. Google API Client Libraries
  3. Additional Ways To Access The API

Featured Samples

Try Prediction with App Engine

Google offers a featured sample application that includes all of the code required to exercise the Google Prediction API in a scalable web service hosted on Google App Engine. The featured application is called "Try-Prediction" and is available in Java and Python. Included in the featured app is a complete implementation of server-side shared OAuth 2.0 authentication/authorization credentials.

The source code and documentation for this application are available at Try Prediction. You can check out a read-only working copy of the project source anonymously using this command:

git clone https://code.google.com/p/try-prediction/

You can also experiment with "Try Prediction" interactively at http://try-prediction.appspot.com.

Access Prediction with App Engine Service Accounts

Use a pre-trained, publicly hosted predictive model and train your own predictive model, using an App Engine Service Account for easy authentication. Building on the Python version of the App Engine Guestbook application from the App Engine Getting Started Guide, which allows users to post messages, you can add the Prediction API to classify each message as having a positive or negative sentiment, first using a publicly hosted model and then, with a language identifier (for English, Spanish, or French), using a model that we'll train using sample data.

For more information, read the article on accessing App Engine service accounts with the Prediction API.

Google API Client Libraries

Here are some Google API REST client libraries that you can use to access the Google Prediction API in different languages.

In the tables below, the first column shows each library's stage of development; note that some are still in early stages. The second column links to the main page for each library.

The set of mature libraries includes:

Client library Documentation All client library samples
Google APIs Client Library for .NET Google APIs Client Library for .NET .NET samples
Google APIs Client Library for Java (rc) google-api-java-client/ Java samples
Google APIs Client Library for JavaScript (beta) Google APIs Client Library for JavaScript JavaScript samples
Google APIs Client Library for Objective-C google-api-objectivec-client/ Objective-C samples
Google APIs Client Library for PHP (beta) google-api-php-client PHP samples
Google APIs Client Library for Python Google APIs Client Library for Python Python samples

These early-stage libraries are also available:

Client library Documentation All client library samples
Google APIs Client Library for Go (alpha) google-api-go-client/ Go samples
Google API Libraries for Google Web Toolkit (alpha) gwt-google-apis/ GWT samples
Google APIs Client Library for Node.js (alpha) google-api-nodejs-client/ Node.js samples
Google APIs Client Library for Ruby (alpha) Google APIs Client Library for Ruby Ruby samples

In addition to the Google-supported client libraries listed in the table above, a set of third-party Dart libraries (with samples) is available for the Dart language.

Additional Ways To Access The API

Here are additional ways to access the Prediction API:

Access Method Description
APIs Explorer An interactive tool that lets you easily try out Google APIs right from your browser.
Google Apps Script A JavaScript cloud scripting language that makes it easy to automate tasks across Google products and third party services. See the sample Google Spreadsheet that uses Apps Script to call the Prediction API for more details.
Google Prediction Client Library for R A client library that lets you use the Google Prediction API with the R language.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.