arrow_back

Building a Forecasting Pipeline Using Vertex AI Python SDKs

로그인 가입
700개 이상의 실습 및 과정 이용하기

Building a Forecasting Pipeline Using Vertex AI Python SDKs

실습 3시간 universal_currency_alt 크레딧 5개 show_chart 고급
info 이 실습에는 학습을 지원하는 AI 도구가 통합되어 있을 수 있습니다.
700개 이상의 실습 및 과정 이용하기

Overview

In this lab, you use Python SDKs to build a forecasting pipeline, where you can train a Vertex AI AutoML Forecasting model and then use that model to make batch predictions.

This lab takes about 3 hours including the model training for 2 hours and the batch prediction for 30 min. It's an optional lab associated with the course titled Vertex Forecasting and Time Series in Practice. If you don't have sufficient time to complete the lab, you're recommended to browse the coding (Vertex_AI_Forecasting.ipynb) to get the sense of using SDKs to create a forecasting pipeline.

What you learn

In this lab, you learn how to:

  • Create a Vertex AI Workbench notebook instance.
  • Create a managed dataset using the Vertex AI Python SDK.
  • Train a forecasting model using the Vertex AI Python SDK.
  • Make batch predictions using the Vertex AI Python SDK.

Setup and requirements

Before you click the Start Lab button

Note: Read these instructions.

Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.

This Qwiklabs 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.

What you need

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
  • Time to complete the lab.
Note: If you already have your own personal Google Cloud account or project, do not use it for this lab. Note: If you are using a Pixelbook, open an Incognito window to run this lab.

How to start your lab and sign in to the Console

  1. Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is a panel populated with the temporary credentials that you must use for this lab.

    Credentials panel

  2. Copy the username, and then click Open Google Console. The lab spins up resources, and then opens another tab that shows the Choose an account page.

    Note: Open the tabs in separate windows, side-by-side.
  3. On the Choose an account page, click Use Another Account. The Sign in page opens.

    Choose an account dialog box with Use Another Account option highlighted

  4. Paste the username that you copied from the Connection Details panel. Then copy and paste the password.

Note: You must use the credentials from the Connection Details panel. Do not use your Google Cloud Skills Boost credentials. If you have your own Google Cloud account, do not use it for this lab (avoids incurring charges).
  1. Click through the subsequent pages:
  • Accept the terms and conditions.
  • Do not add recovery options or two-factor authentication (because this is a temporary account).
  • Do not sign up for free trials.

After a few moments, the Cloud console opens in this tab.

Note: You can view the menu with a list of Google Cloud Products and Services by clicking the Navigation menu at the top-left. Cloud Console Menu

Task 1. Deploy a Vertex AI notebook instance

In this task, you create the Vertex AI Workbench JupyterLab (iPython) notebook that is used for the rest of the lab.

  1. In the Google Cloud Console, navigate to Vertex AI > Dashboard and click the dropdown Show API list and click Enable on the Vertex AI API tile.

  2. In the Cloud Console, navigate to Vertex AI > Workbench and click the Enable Notebooks API button.

  3. On the Workbench menu bar, click +New Notebook.

  4. In the Customize... pop-up menu, select Python3.

  5. In the New notebook instance dialog for Notebook Name enter vertex-ai.

  6. For Region, select us-central1.

  7. Leave all other fields with their default options and click Create.

After a few minutes, the Vertex AI console displays your instance name, followed by Open JupyterLab. The UI might not automatically refresh so you may need to refresh the page to see the link.

  1. Click Open JupyterLab.

Once you get into it, you find a screen like this.

JupyterLab UI

Task 2. Create a Vertex AI Forecasting Model using the Python SDK

In this task, you create a Vertex AI Forecasting Model using the Python SDK in a JupyterLab notebook.

  1. In the JupyterLab tab, in the Other launcher section, click Terminal to open a new Terminal window.

  2. In the Terminal console shell, paste the following command to copy the JupyterLab notebook for the lab into your JupyterLab instance:

gsutil cp gs://cloud-training/CBL458/setup/Vertex_AI_Forecasting.ipynb Vertex_AI_Forecasting.ipynb
  1. Double-click the filename Vertex_AI_Forecasting.ipynb in the file list to open your lab notebook.

  2. Follow the instructions in the Notebook to prepare the dataset and start training your model.

The model will take approximately 2 hours to train completely. Once the training job reports that it has started, you can return here for instructions on how to load and explore example batch prediction result data so that you can see what the output data looks like and use the code supplied to display the prediction data using Looker Studio.

Task 3. Explore pre-prepared prediction result data

This step guides you through the process of accessing sample batch prediction result data and using a JupyterLab notebook and Looker Studio to visualize the predictions.

  1. Switch to the Terminal console shell in your notebook instance and paste the following command to copy a JupyterLab notebook to analyze the example data into your JupyterLab instance:
gsutil cp gs://cloud-training/CBL458/setup/Results.ipynb Results.ipynb
  1. Paste the following commands into the Terminal console shell to create the example BigQuery dataset and import the tables containing example prediction result data:
bq --location=us mk --dataset $PROJECT_ID:iowa_liquor_sales_predictions_example bq --location=us load --source_format=AVRO \ iowa_liquor_sales_predictions_example.errors_example \ gs://cloud-training/CBL458/setup/batch_prediction_error_example.avro bq --location=us load --source_format=AVRO \ iowa_liquor_sales_predictions_example.predictions_example \ gs://cloud-training/CBL458/setup/batch_prediction_example.avro
  1. Open the JupyterLab notebook file called Results.ipynb and run all the cells to generate a clickable link that will display the data in Looker Studio.

  2. Click the link that is displayed to open the Looker Studio report that will display a chart showing the prediction data.

You can now also explore the BigQuery example batch prediction output data in the iowa_liquor_sales_predictions_example.errors_example and iowa_liquor_sales_predictions_example.predictions_example BigQuery tables if you want to see what the output data and schemata look like.

Task 4. Perform batch predictions using the SDK (optional)

  • If you want to wait for the model to complete, you can return to the original notebook and wait until the job.run cell in the Train the Vertex AI AutoML Forecasting model section has finished.

  • You can monitor progress there or via the Vertex AI console under the Vertex AI > Training page. Remember that the Vertex AI AutoML Forecasting training task takes approximately 2 hours to complete.

  • Once the model is trained, you can then run the remaining cells to display the model evaluation metrics, and perform a batch prediction. Your final output data should be similar to the example data you viewed in the last task.

Congratulations!

You have successfully used the Python SDK to build and train a Vertex AI AutoML Forecasting model and then used that model to make batch predictions.

You are now ready to create models and run batch predictions with Vertex AI AutoML Forecasting with the Python SDK!

End your lab

When you have completed your lab, click End Lab. Google Cloud Skills Boost removes the resources you’ve used and cleans the account for you.

You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.

The number of stars indicates the following:

  • 1 star = Very dissatisfied
  • 2 stars = Dissatisfied
  • 3 stars = Neutral
  • 4 stars = Satisfied
  • 5 stars = Very satisfied

You can close the dialog box if you don't want to provide feedback.

For feedback, suggestions, or corrections, please use the Support tab.

Copyright 2022 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.

시작하기 전에

  1. 실습에서는 정해진 기간 동안 Google Cloud 프로젝트와 리소스를 만듭니다.
  2. 실습에는 시간 제한이 있으며 일시중지 기능이 없습니다. 실습을 종료하면 처음부터 다시 시작해야 합니다.
  3. 화면 왼쪽 상단에서 실습 시작을 클릭하여 시작합니다.

시크릿 브라우징 사용

  1. 실습에 입력한 사용자 이름비밀번호를 복사합니다.
  2. 비공개 모드에서 콘솔 열기를 클릭합니다.

콘솔에 로그인

    실습 사용자 인증 정보를 사용하여
  1. 로그인합니다. 다른 사용자 인증 정보를 사용하면 오류가 발생하거나 요금이 부과될 수 있습니다.
  2. 약관에 동의하고 리소스 복구 페이지를 건너뜁니다.
  3. 실습을 완료했거나 다시 시작하려고 하는 경우가 아니면 실습 종료를 클릭하지 마세요. 이 버튼을 클릭하면 작업 내용이 지워지고 프로젝트가 삭제됩니다.

현재 이 콘텐츠를 이용할 수 없습니다

이용할 수 있게 되면 이메일로 알려드리겠습니다.

감사합니다

이용할 수 있게 되면 이메일로 알려드리겠습니다.

한 번에 실습 1개만 가능

모든 기존 실습을 종료하고 이 실습을 시작할지 확인하세요.

시크릿 브라우징을 사용하여 실습 실행하기

이 실습을 실행하려면 시크릿 모드 또는 시크릿 브라우저 창을 사용하세요. 개인 계정과 학생 계정 간의 충돌로 개인 계정에 추가 요금이 발생하는 일을 방지해 줍니다.