In this lab you train, evaluate, and deploy a machine learning model to predict a baby's weight. You then send requests to the model to make online predictions. This lab is part of a series of labs on processing scientific data.

What you need

To complete this lab, you need:

What you learn

In this lab, you:

To launch Cloud Datalab:

Step 1

Open Cloud Shell. The cloud shell icon is at the top right of the GCP web console:

Step 2

In Cloud Shell, type:

gcloud compute zones list

Pick a zone in a geographically closeby region.

Step 2

In Cloud Shell, type:

datalab create babyweight --zone <ZONE>

Datalab will take about 5 minutes to start. Move on to the next step.

You would normally choose the variables to use as predictors after careful analysis. You might do some transformations on the input data as well. See this notebook for the analysis and the Dataflow code to export the necessary data from BigQuery to CSV. To save time, we will start off by copying the already preprocessed dataset.

Step 1

Navigate to the Storage section from the top-left-corner ("hamburger") menu. If necessary, create a bucket that is regional.

Step 2

Use the + button on the top-left ribbon on Cloud Shell to get another tab of Cloud Shell.

Step 3

In the new Cloud Shell tab, type:

gsutil cp gs://cloud-training-demos/babyweight/preproc/* gs://<BUCKET>/babyweight/preproc/

This copies the necessary data over to your bucket.

Switch back to the first Cloud Shell tab.

Step 1

If necessary, wait for Datalab to finish launching. Datalab is ready when you see a message prompting you to do a "Web Preview".

Step 2

Click on the Web Preview icon on the top-right corner of the Cloud Shell ribbon.

Step 3

In Datalab, click on the icon for "Open ungit" in the top-right ribbon.

Step 4

In the Ungit window, select the text that reads /content/datalab/notebooks and remove the notebooks so that it reads /content/datalab, then hit enter.

In the panel that comes up, type the following as the GitHub repository to Clone from:

Then, click on Clone repository.

Step 5

Switch back to the browser window where you have Cloud Datalab open and navigate to training-data-analyst/blogs/babyweight/babyweight.ipynb

Step 1

Change the PROJECT and BUCKET settings in the notebook. Click on Run.

Then, read the narrative and click Shift + Enter (or Run) on each cell in the notebook.

Step 1

Click on the person icon in the top-right corner of your Datalab window and click on the link to manage the VM.

Step 2

In the web console, select the Datalab VM and click DELETE.

In this lab you learned how to train, evaluate, and deploy a TensorFlow machine learning model. You then send requests to the model to make online predictions.

┬ęGoogle, Inc. or its affiliates. All rights reserved. Do not distribute.