Lab setup instructions and requirements
Protect your account and progress. Always use a private browser window and lab credentials to run this lab.

Developing an End-to-end Forecasting Solution in Retail

Lab 3 год universal_currency_alt 5 кредитів show_chart Початковий
info This lab may incorporate AI tools to support your learning.
This content is not yet optimized for mobile devices.
For the best experience, please visit us on a desktop computer using a link sent by email.

Overview

In this lab, you use AutoML to train and test a forecasting model, and then make predictions. With the sales dataset from a retail store, you walk through an end-to-end workflow from importing data, to training the model and evaluating the performance, and finally running a batch inference.

Objectives

You learn how to:

  • Import data from BigQuery.
  • Build a forecasting model by configuring the options.
  • Train the model and evaluate the performance.
  • Run a batch inference to forecast the future sales.

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 Google Skills 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 Skills 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. Import the dataset from BigQuery

In this task, you prepare the training dataset by importing it from a BigQuery table.

Introduce the data

This lab uses the sales data from a retail store. The main purpose of the lab is to walk you through an end-to-end workflow to build a forecasting solution rather than creating a comprehensive model. Therefore, the dataset used in this lab is simple and straightforward. It has 8280 data points and includes three columns. It relies on the historical sales only to predict the future sales, which is called a univariate time series.

  • Date: The date (timestamp).
  • Department_ID: A string indicating which department (for example, bags and baby basics) the sales belong to (time series ID).
  • Sales: The gross sales in dollars (target).

Create a dataset

  1. In the Google Cloud console, on the Navigation menu, click Vertex AI > Datasets.
  2. For the pop-up API is not enabled, click Enable and then close the pop-up.
  3. Select the Region from the dropdown.
  4. Click Create dataset.
  5. On the Datasets page, give the dataset a name, for example, RetailSales.
  6. For the data type and objective, click Tabular, and then select Forecasting.
  7. Select the Region and click Create.

Import data from BigQuery

There are three options to import data in Vertex AI:

  • Upload CSV files from your computer
  • Select CSV files from Cloud Storage
  • Select a table or view from BigQuery

In this lab, you import the dataset from BigQuery.

  1. For the Select a data source, select Select a table or view from BigQuery.

  2. Enter the following BigQuery path:

cloud-training-demos.RetailSales.RetailSales
  1. Click Continue.
Note: You have multiple ways to create a new dataset. For example, you can also click create dataset directly from dashboard.

(Optional) Generate statistics

  1. To see the descriptive statistics of your dataset, click the tab Analyze and then the button Generate statistics .

    Note: Generating the statistics may take a few minutes. To save time, you can advance to the next step and come back to check the results in a few minutes.
  2. When the statistics are ready, click each column name to display analytical charts.

Task 2. Train your model

With the dataset ready, you build the forecasting model and train it.

Click Train new model. You go through 4 steps of configuration:

  1. Training method
  2. Model details
  3. Training options
  4. Compute and pricing

Training method

  1. For Model training method, select AutoML.

  2. Click Continue.

Model details

Specify the model name and columns. You start from Train new model.

  1. Specify the model name, such as RetailSales.

  2. For Target column, select Sales (FLOAT).

  3. For Series identifier column, select Department_id (STRING).

  4. For Timestamp column, select Date (DATE).

Define forecasting configuration.

  1. For Data granularity, select Daily.

  2. Holiday regions is optional based on your own region, for example, you can select NA (North America).

  3. For Forecast horizon, enter 5, meaning you want to forecast the future 5 days of sales.

  4. For Context window, enter 5, meaning you want to use the 5 days of the historical data to predict the future sales.

Note: To achieve the highest forecasting accuracy with the lowest cost, you can always experiment with different combinations of context window and forecast horizon. For more information about the definition and the best practices to set forecast horizon and context window, please refer to the module titled model training in the course of Vertex Forecasting and Timer Series in Practice on Coursera, Pluralsight, and Google Skills.

(Optional) Explore advanced options. You are suggested to keep the default options for the lab purpose.

  1. For Data split, you have the option to choose either Chronological which is the default automatic data split or manual.

  2. For Window selection options, you can choose from count, stride, and column to determine how you want to generate sliding windows (context window plus forecast horizon).

  3. For Encryption, you can choose from Google-managed encryption key and Customer-managed encryption key (CMEK).

  4. Click Continue.

Training options

Specify the role of each column.

  1. You don't need to change anything in this step because AutoML automatically identify the role of each column for this simple dataset. Otherwise, you need to specify timestamp column (date in this dataset), series identifier (department_id in this dataset), and target (sales in this dataset). You also need to decide data transformation (if needed) and specify the feature type (for example, attribute vs. covariate, and if latter, available vs. unavailable at the forecasting time).

(Optional) Explore Advanced options.

  1. For Weight column, you can decide if you want certain columns to weight differently in prediction.

  2. For Optimization objectives, you can select different optimization objectives other than the default RMSE.

    For more information about optimization objectives for tabular AutoML models, refer to the Optimization objectives for tabular AutoML models guide.

  3. You can also set Hierarchical forecasting.

  4. Click Continue.

Compute and pricing

  1. For Budget, which represents the number of node hours for training, enter 1.
    Training your AutoML model for 1 compute hour is typically a good start for understanding whether there is a relationship between the features and label you've selected. From there, you can modify your features and train for more time to improve model performance.

  2. Click Start training.

The training takes about 2 hours. AutoML uses the technology called Neural Architecture Search (NAS) to automatically search through multiple ML models, and provide you the best result by averaging the top ten models in terms of performance. Depending on the data size and the training method, the training can take a couple of hours. In production you receive an email from Google Cloud when training completes. However, that's not the case in the lab environment. So now it's time for you to chill out and click back (click training from the left menu, where you can find the status of your model training) after about 2 hours.

Task 3. Evaluate the model performance

Once the model training completes, it's time to evaluate the performance.

  1. Select Training from the left menu, click the model name (for example, RetailSales).

  2. The first tab is evaluate, you can find the metrics such as MAE, MAPE, RMSE, RMSLE, and R square.

Among the different metrics, RMSE is the one you normally use. The number is high, 12,597,752 (yours can be slightly different). To convert it to a standardized RMSE is about 90%. The higher the value of RMSE the lower the performance.

Let's look at R square, it's 0.007 (yours can be slightly different). The lower the value of R square the lower the performance.

In sum, the metrics indicate a low performance of this model. Among many reasons, the lack of features in the forecasting model is one important cause. Due to the restriction of the maximum lab time (the model training time), you depend the forecasting completely on the historical sales data. You can, in the future, include more features such as advertisement and promotion in the forecasting model to achieve better performance.

  1. You can also find feature importance, which is displayed through a bar chart to illustrate how each feature contributes to a prediction. The longer the bar, or the larger the numerical value associated with a feature, the more important it is.

Though you can't gain many insights from this case, the analysis based on feature importance helps build a better model. You might decide to remove the least important features next time or to combine two of the more significant features into a feature cross to see whether this improves model performance.

Feature importance is one example of Vertex AI’s comprehensive machine learning functionality called Explainable AI. Explainable AI is a set of tools and frameworks to help understand and interpret predictions made by machine learning models.

Task 4. Make predictions

In this task, you use a batch inference to forecast the future sales from the model you just trained.

  1. Click Batch inference, from the left menu, and select the Region .

  2. Click + Create and specify the name of the batch inference, for example, ForecastSales.

  3. Select the Version 1 for Version.

  4. For Select source, choose BigQuery table, and for BigQuery Path enter:

cloud-training-demos.RetailSales.ForecastInput

The input data looks like below, where you have the same format as the training data but with five rows (the forecast window) with null values for sales that you want to predict.

Batch inference input data

  1. In Batch inference output section, choose BigQuery table from Output format dropdown, and for BigQuery Path enter:
{{{project_0.project_id|Project ID}}}.ForecastOutput Note: You can choose either a BigQuery table or a CSV file on Cloud Storage to get the input and save the output. For more information, please check Get predictions for a forecast model.
  1. Click Continue, turn off Enable model monitoring for this batch inference (as you don't need it right now), and then Create.

Depending on the resources (budget and pricing), it takes about a few minutes to finish the forecasting. If you have 1 budget hour as in this lab, it takes about 30 minutes.

  1. Assuming the prediction completes, click the button (shown below) besides the name of the batch inference, choose the table under the dataset ForecastOutput, and you see the prediction results.

Batch inference result button

The output of the forecasting looks like below, where you find an additional column named predicted_sales. The column includes the five values you want to predict at the forecasting time. Batch inference output data

Congratulations!

You have successfully built and trained a forecasting model with AutoML and run a batch inference based on the trained model! In this lab, you learned about importing data, building a forecast model, evaluating the model performance, and forecasting sales using a batch inference in Vertex AI.

Hope you enjoyed it! Now you're ready to build your own forecasting solution!

End your lab

When you have completed your lab, click End Lab. Google Skills 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 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.

Before you begin

  1. Labs create a Google Cloud project and resources for a fixed time
  2. Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
  3. On the top left of your screen, click Start lab to begin

Use private browsing

  1. Copy the provided Username and Password for the lab
  2. Click Open console in private mode

Sign in to the Console

  1. Sign in using your lab credentials. Using other credentials might cause errors or incur charges.
  2. Accept the terms, and skip the recovery resource page
  3. Don't click End lab unless you've finished the lab or want to restart it, as it will clear your work and remove the project

This content is not currently available

We will notify you via email when it becomes available

Great!

We will contact you via email if it becomes available

One lab at a time

Confirm to end all existing labs and start this one

Use private browsing to run the lab

Using an Incognito or private browser window is the best way to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.