Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Configure your notebook environment
/ 10
Create a connection to Google Cloud Serverless for Apache Spark
/ 10
Load data and explore with Gemini
/ 10
Perform feature engineering
/ 10
Train a logistic regression model
/ 10
Conduct model evaluation
/ 10
Write predictions to BigQuery
/ 10
Save the model to Cloud Storage
/ 10
Create an inference server
/ 10
Configure an agent
/ 10
Configure your notebook environment
/ 10
Create a connection to Google Cloud Serverless for Apache Spark
/ 10
Load data and explore with Gemini
/ 10
Perform feature engineering
/ 10
Train a logistic regression model
/ 10
Conduct model evaluation
/ 10
Write predictions to BigQuery
/ 10
Save the model to Cloud Storage
/ 10
Create an inference server
/ 10
Configure an agent
/ 10
Scenario: A hypothetical eCommerce clothing retailer named TheLook stores data on customers, products, orders, logistics, web events, and digital marketing campaigns in BigQuery. The company wants to leverage the team's existing SQL and PySpark expertise to analyze this data using Apache Spark and make predictions about users' future purchases. To avoid manual infrastructure provisioning or tuning for Spark, TheLook seeks an auto-scaling solution that allows them to focus on workloads rather than cluster management. Additionally, they want to minimize the effort required to integrate Spark and BigQuery while staying within the BigQuery Studio environment.
In this lab, you implement a workflow to predict whether a user will make a purchase by building a Logistic Regression Classifier using PySpark and leveraging BigQuery Studio's native notebook integration and AI-features for exploring the data. Then, you deploy this model to an inference server and create an agent to query the model using natural language.
In this lab, you learn how to perform the following tasks:
Before starting this lab, you should be familiar with:
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 are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the right is the Lab setup and access panel with the following:
Note that the lab timer is located near the top of the page, showing the remaining time.
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab setup and access panel.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab setup and access panel.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
In this task, you open the notebook for this lab in BigQuery and connect to a runtime.
In the Google Cloud console, in the Navigation menu (), click BigQuery.
If a Welcome to BigQuery in the Cloud Console card opens, click Done to dismiss it.
Above the BigQuery Studio pane, next to the SQL query button (+), click the dropdown arrow for Create new.
In the Create new dropdown menu, hover the cursor over Notebook, and select Upload.
Wait for the notebook name to auto-populate to spark_data_science.
For Region, select
Click Upload.
The notebook automatically opens. In the event that it does not open automatically, you can perform the following step to open the notebook.
spark_data_science.On the top right of the notebook menu bar, click Connect to connect to a new runtime.
In the pop-up, click Open if prompted and authorize Colab Enterprise to use your lab account,
In this task, you configure your notebook environment with the necessary tools and items to complete the lab—including configuring Private Google Access, creating a Cloud Storage bucket, and creating a BigQuery dataset.
In the notebook, you are prompted to add the Project ID and Region.
Click Check my progress to verify the objective.
In this task, you use the serverless Spark Connect client to run interactive Spark jobs.
Managed Service for Spark Session was successfully created before proceeding to the next task.Click Check my progress to verify the objective.
In this task, you run through the first important step in any data science project: preparing your data. You start by loading data into an Apache Spark dataframe from BigQuery. Then, you use Gemini to generate PySpark code to explore the data.
The dataset is a synthetic dataset of customer information and purchase history, which is available as a BigQuery Public Dataset called thelook_ecommerce.
After you explore the data in the notebook, answer the following multiple-choice question to reinforce your understanding.
Click Check my progress to verify the objective.
In this task, you perform feature engineering on the data. Specifically, you select the appropriate columns, transform the data into more suitable data types, and identify a label column.
Click Check my progress to verify the objective.
In this task, you use MLlib to train a logistic regression model. First, you use a VectorAssembler to convert the data into a vector format, and then StandardScaler scales the features column for better performance. Next, you create a reference to a LogisticRegression model and define hyperparameters. Last, you combine these steps into a Pipeline object, train the model using the fit() function and transform the data using the transform() function.
Click Check my progress to verify the objective.
In this task, you evaluate your newly transformed dataset and generate the evaluation metric area under curve (AUC). Then, you use Gemini to generate PySpark code to visualize your model output.
Click Check my progress to verify the objective.
In this task, you use Gemini to generate code to write your predictions to a new table in your BigQuery dataset.
Click Check my progress to verify the objective.
In this task, you use MLlib's native functionality to save your model to Cloud Storage, so that the inference server can load the model from a bucket.
Click Check my progress to verify the objective.
Cloud Run is a flexible tool to run serverless web apps. It uses Docker containers to provide users with maximum customizability.
In this task, you use a Dockerfile that is configured to run a Flask app powering PySpark. This container runs on Cloud Run to perform inference on input data.
For reference, the original source code can be found on GitHub.
Click Check my progress to verify the objective.
Agent Runtime is a part of Gemini Enterprise Agent Platform, a set of services that enable developers to deploy, manage, and scale AI agents in production. It has many tools including evaluating agents, session contexts, and code execution. It supports many popular agentic frameworks, including the Agent Development Kit (ADK). ADK is an open source agentic framework that, while built and optimized for use with Gemini and the Google ecosystem, is model-agnostic. It is designed to make agent development feel more like software development.
In this task, you use Agent Runtime to create an agent that can perform inference.
GEMINI_FLASH_MODEL_ID with the Click Check my progress to verify the objective.
In this lab, you learned how to use BigQuery Studio notebooks to run data science workflows that leverage Google Cloud Serverless for Apache Spark to train and evaluate a classification model. You also deployed an inference server for the model and deployed an agent to query the inference server using natural language with Agent Runtime and the Agent Development Kit (ADK).
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated November 05, 2026
Lab Last Tested November 11, 2026
Copyright 2026 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.
This content is not currently available
We can notify you via email when it becomes available
Great!
We can contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one