google-ai-platform-go-samples

module
v0.0.0-...-8c1f7d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2019 License: Apache-2.0

README

Introduction

Google's AI platform brings a number of tools together to enable you to create end-to-end machine learning pipelines. This repository provides an example of using the platform to train a recommendation engine using the Go programming language.

Motivation

At the time of writing, the AI platform is relatively new and as a result the documentation is incomplete, particularly with respect to Go. The AI platform is not part of the Google Cloud SDK. Instead, we need to use the Google APIs client which is a bit 'lower level', in that it just exposes Google's various REST APIs in raw form. Documentation for using the AI platform with Python is useful as a basis for doing the same thing in Go.

n.b. although not part of the SDK, the AI platform's functionality is still available through the gcloud command line tool, it just isn't available as part of the SDK for Python, Go, etc.

Accessing the API

The AI platform's API is described here: https://cloud.google.com/ml-engine/reference/rest. To set up the client do something like this:

import "google.golang.org/api/ml/v1"
client := /* construct oauth'd HTTP client */
service := ml.New(client)

Authentication is covered further down.

Regions

Some features are only available in certain regions; for instance TensorFlow.

REST endpoints

Using the APIs client the endpoints are built up in stages that follow the layout of the REST endpoints. For example:

service.Projects.Jobs.List("projects/<your gcloud project name>").Do()

One thing to watch out for is the project name: it must be prefixed with projects/, or else you'll get a 404 not found error like The requested URL <code>/v1/<your gcloud project name>/jobs?alt=json&amp;prettyPrint=false</code> was not found on this server.

Authenticaton / OAuth

To make API calls you'll need to be authenticated using OAuth. There are plenty of ways to do this and some are quite complex. We cover two simple examples:

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL