Lab: Exploratory Data Analysis Using Python and BigQuery
Overview
This lab is in introduction to linear regression using Python and Scikit-Learn. This lab serves as a foundation for more complex algorithms and machine learning models that you will encounter in the course. We will train a linear regression model to predict housing price.
Learning objectives
-
Analyze a Pandas Dataframe
-
Create Seaborn plots for Exploratory Data Analysis in Python
-
Write a SQL query to pick up specific fields from a BigQuery dataset
-
Exploratory Analysis in BigQuery
Setup and requirements
Enable the Vertex AI API
-
In the Google Cloud Console, on the Navigation menu, click Vertex AI > Dashboard.
-
Click Enable Vertex AI API.
Enable the Notebooks API
-
In the Google Cloud Console, on the Navigation menu, click APIs & Services > Library.
-
Search for Notebooks API, and press ENTER.
-
Click on the Notebooks API result.
-
If the API is not enabled, click Enable.
Task 1. Create a Vertex AI Workbench instance
-
In the Google Cloud Console, on the Navigation Menu, click Vertex AI > Workbench. Select User-Managed Notebooks.
-
On the Notebook instances page, click New Notebook > TensorFlow Enterprise > TensorFlow Enterprise 2.6 (with LTS) > Without GPUs.
-
In the New notebook instance dialog, confirm the name of the deep learning VM, if you don’t want to change the region and zone, leave all settings as they are and then click Create. The new VM will take 2-3 minutes to start.
-
Click Open JupyterLab.
A JupyterLab window will open in a new tab. -
You will see “Build recommended” pop up, click Build. If you see the build failed, ignore it.
Task 2. Clone a course repo within your Vertex AI Notebooks instance
To clone the training-data-analyst notebook in your JupyterLab instance:
-
In JupyterLab, to open a new terminal, click the Terminal icon.
- At the command-line prompt, run the following command:
git clone https://github.com/GoogleCloudPlatform/training-data-analyst
- To confirm that you have cloned the repository, double-click on the training-data-analyst directory and ensure that you can see its contents. The files for all the Jupyter notebook-based labs throughout this course are available in this directory.
Task 3. Exploratory data analysis using Python and BigQuery
-
In the notebook interface, navigate to training-data-analyst > courses > machine_learning > deepdive2 > launching_into_ml > labs and open python.BQ_explore_data.ipynb.
-
In the notebook interface, click Edit > Clear All Outputs.
-
Carefully read through the notebook instructions and fill in lines marked with #TODO where you need to complete the code.
Tip: To run the current cell, click the cell and press SHIFT+ENTER. Other cell commands are listed in the notebook UI under Run.
- Hints may also be provided for the tasks to guide you along. Highlight the text to read the hints (they are in white text).
- If you need more help, look at the complete solution at training-data-analyst > courses > machine_learning > deepdive2 > launching_into_ml > solutions and open python.BQ_explore_data.ipynb.