In this lab we train, evaluate, and deploy a machine learning model to predict a baby's weight. We then send requests to the model to make online predictions.
In this lab, we learn:
-
Launch a Vertex AI notebook
-
Carry out local training and distributed training
-
Deploy the ML model as a web service
-
Make predictions with the model
This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.
- Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method.
- Click Open Google Console. The lab spins up resources, and then opens another tab that shows the Sign in page.
- If necessary, copy the Username from the Lab Details panel and paste it into the Sign in dialog. Click Next.
- Copy the Password from the Lab Details panel and paste it into the Welcome dialog. Click Next.
- Accept the terms and conditions.
- Click Activate Cloud Shell Activate Cloud Shell icon at the top of the Google Cloud console.
- Click Continue.
- You can list the active account name with this command
gcloud auth list
Create a bucket using the Google Cloud console:
-
In your Cloud Console, click on the Navigation menu, and select Cloud Storage.
-
Click on Create bucket.
-
Choose a Regional bucket and set a unique name (use your project ID because it is unique).
-
Click Create.
To launch AI Platform Notebooks:
-
In the Navigation Menu click AI Platform > Dashboard.
-
In the Notebooks card, click View notebook instances.
-
On the Workbench page, at the top, click New Notebook.
-
In the Customize instance menu, select TensorFlow Enterprise and choose the latest version of TensorFlow Enterprise 2.x (with LTS) > Without GPUs.
-
In the New notebook dialog, click the pencil icon to edit notebook properties.
-
For Instance name, use the default name that was pregenerated for you.
-
For Region, select us-central1 and for Zone, select a zone within the selected region.
-
Scroll down to Machine configuration and select n1-standard-2 for Machine type.
-
Leave the remaining fields at their default and click Create.
After a few minutes, the Workbench page lists your instance name, followed by Open JupyterLab.
- Click Open JupyterLab. A JupyterLab window opens in a new tab.
To clone the training-data-analyst repository in your JupyterLab instance:
-
In JupyterLab, click the Terminal icon to open a new terminal.
-
At the command-line prompt, type the following command and press Enter:
git clone https://github.com/GoogleCloudPlatform/training-data-analyst
- To confirm that you have cloned the repository, in the left panel, double click the training-data-analyst folder to see its contents.
-
In the notebook interface, navigate to training-data-analyst > blogs > babyweight and open train_deploy.ipynb.
-
From the menu, click Edit > Clear All Outputs.
-
From the top right corner, make sure you're using the Python 3 kernel.
-
Read the narrative and click Shift + Enter (or Run) on each cell in the notebook.
We learned how to train, evaluate, and deploy a machine learning model in Cloud Datalab.