Showing posts with label Google Prediction API. Show all posts

Code updates required for Apps Script advanced services

Friday, November 8, 2013 | 3:26 PM

Labels: , ,

The APIs for three of Apps Script's advanced servicesAnalytics, BigQuery, and Prediction — will undergo breaking changes on Monday, November 18. If you don't update your code to the new syntax before then, you'll receive error messages such as Required parameter is missing.

Advanced services allow you to easily connect to certain public Google APIs from Apps Script. We're working to expand and improve our advanced services, and as a side effect some methods and parameters that were incorrectly listed as optional are now required.

On November 18, these services will switch to use the new method signatures shown in the tables below. To learn how new arguments should be structured, refer to the documentation for the underlying API. For example, the documentation for the BigQuery service's Jobs.query() method shows the valid properties for the resource object in the "Request body" section of the page.


Old New
Analytics.Management.Uploads
.deleteUploadData(
    accountId, 
    webPropertyId, 
    customDataSourceId, 
    optionalArgs)
.deleteUploadData(
    resource, 
    accountId, 
    webPropertyId, 
    customDataSourceId)
BigQuery.Datasets
.insert(
    resource, 
    optionalArgs)
.insert(
    resource, 
    projectId)
.update(
    resource,
    optionalArgs)
.update(
    resource, 
    projectId,
    datasetId)
BigQuery.Jobs
.insert(
    resource, 
    mediaData,
    optionalArgs)
.insert(
    resource, 
    projectId, 
    mediaData)
.query(
    projectId,
    query)
.query(
    resource,
    projectId)
BigQuery.Tabledata
.insertAll(
    projectId,
    datasetId, 
    tableId,
    optionalArgs)
.insertAll(
    resource,
    projectId, 
    datasetId, 
    tableId)
BigQuery.Tables
.insert(
    resource,
    optionalArgs)
.insert(
    resource, 
    projectId,
    datasetId)
.update(
    resource, 
    optionalArgs)
.update(
    resource, 
    projectId,
    datasetId,
    tableId)
Prediction.Hostedmodels
.predict(
    project, 
    hostedModelName, 
    optionalArgs)
.predict(
    resource,
    project, 
    hostedModelName)
Prediction.Trainedmodels
.insert(
    project, 
    optionalArgs)
.insert(
    resource,
    project)
.predict(
    project, 
    id, 
    optionalArgs)
.predict(
    resource, 
    project, 
    id)
.update(
    project, 
    id, 
    optionalArgs)
.update(
    resource, 
    project, 
    id)

If you want to prepare your code ahead of time, you can add a try/catch around your existing code that retries with the new method signature if the old one fails. For example, the following sample applies this approach to the BigQuery service's Jobs.query() method:

  var result;
  try {
    result = BigQuery.Jobs.query(projectId, query, {
      timeoutMs: 10000
    });
  } catch (e) {
    // Refer to the BigQuery documentation for the structure of the 
    // resource object.
    var resource = {
      query: query,
      timeoutMs: 1000
    };
    result = BigQuery.Jobs.query(resource, projectId);
  }

We apologize for inconvenience and look forward to sharing exciting news about advanced services in the coming weeks.


Eric Koleda profile

Eric is a Developer Programs Engineer based in NYC on the Google Apps Script team. He's previously worked with the AdWords API and enterprise content management software.

Au-to-do, a sample application using Google Apps APIs in the cloud

Tuesday, November 29, 2011 | 3:31 PM

Labels: , , ,

One of the big focuses of this blog (and the team behind it) has been providing compelling examples of how integration with Google Apps APIs can make a product richer and more engaging. As a part of this effort, earlier today we announced Au-to-do, a sample application built using Google APIs.


Au-to-do is a sample implementation of a ticket tracker, built using a combination of Google App Engine, Google Cloud Storage, and Google Prediction APIs.

In addition to providing a demonstration of the power of building on Google App Engine, Au-to-do also provides an example of improving the user experience by integrating with Google Apps. Users of Au-to-do can automatically have tasks created using the Google Tasks API whenever they are assigned a ticket. These tasks have a deep link back to the ticket in Au-to-do. This helps users maintain a single todo list, using a tool that’s already part of the Google Apps workflow.


We’re going to continue work on Au-to-do, and provide additional integrations with Google Apps (and other Google APIs) in the following months.

To learn more, read the full announcement or jump right to the getting started guide.


Dan Holevoet   profile

Dan joined the Google Developer Relations team in 2007. When not playing Starcraft, he works on Google Apps, with a focus on the Calendar and Contacts APIs. He's previously worked on iGoogle, OpenSocial, Gmail contextual gadgets, and the Google Apps Marketplace.

Make your Business App Intelligent with the Google Prediction API

Monday, June 13, 2011 | 8:18 AM

Labels:

The Google Prediction API exposes Google’s machine learning algorithms as a RESTful API for use by applications around the web. This allows developers to replace repetitive manual processes with automated and smarter code, saving users valuable time and preventing headaches. The Prediction API first launched in at I/O 2010 and the team recently added a number of enhancements that make it more powerful for many types of business applications.

What can the Prediction API do?

The basic job of machine learning is to recognize historical patterns in data and use those patterns to make intelligent predictions in the future.

Some great use cases:
  • Spam detection: Does your product allow users to submit content? Do some users abuse this opportunity by submitting spam? Instead of maintaining a large number of regular expressions trying to catch common types of spam, you can use the Prediction API to automatically detect it and react accordingly.
  • Sentiment analysis: Are you building a CRM that keeps track of exchanges with customers? You could use the Prediction API to analyze correspondence with customers and detect when a customer might be communicating with a really negative or positive tone. This can alert you to when you might need to improve a relationship or even start writing a customer success story.
  • Tagging & organizing: Does your application store a lot of unstructured content? You can provide organization for this content by automatically tagging it based on how your users have previously tagged similar content.
  • Message routing: If you have a CRM that needs to route leads to the most appropriate people or a helpdesk ticket system that needs to route tickets to the correct support team, the Prediction API can help. Instead of writing a set of rules for which leads or tickets get routed to which people, use machine learning to predict the routing based on historical patterns.

On example: We built a demo app that uses the Prediction API to predict what types of applications a company might want to add from the Google Apps Marketplace based on the demographics of the company and a sampling of previous install data.

You can also try out some pre-built demonstration models in the Hosted Model Gallery.

How does it work?

Simple process:
  1. Upload training data to Google Storage. Training data is formatted as a CSV file with the first column representing the result (categorical or real-valued) and the remaining columns representing separate features contributing to the result.

    Example for predicting the size of a person in meters:
    "Height in meters", "Gender", "Father's height", "Mother's height", "Country of origin"
    1.71,”Male”,1.74,1.62,”France”
    1.51,”Female”,1.61,1.50,”India”
    ….
  2. Train a model based on the uploaded data. You only need to make a single REST call to start the asynchronous training process.
  3. Predict results based on new data
  4. (Optional) Tune the training model with new results. If you have new training data, you can now add it to your existing model to tune it.
  5. (Optional) Make your model available to others via the forthcoming Hosted Model Gallery.

Try it out

Get started with the prediction API by going through the Hello World example or checking out the Hosted Model Gallery. Then move onto your more interesting business use cases and let us know what you build by buzzing via the link below!



Ryan Boyd profile | twitter | events

Ryan is a Developer Advocate on the Google Apps Marketplace team, helping businesses build applications integrated into Google Apps. Wearing both engineering and business development hats, you'll find Ryan writing code and helping businesses get to market with integrated features.


Want to weigh in on this topic? Discuss on Buzz