Book Image

Journey to Become a Google Cloud Machine Learning Engineer

By : Dr. Logan Song
Book Image

Journey to Become a Google Cloud Machine Learning Engineer

By: Dr. Logan Song

Overview of this book

This book aims to provide a study guide to learn and master machine learning in Google Cloud: to build a broad and strong knowledge base, train hands-on skills, and get certified as a Google Cloud Machine Learning Engineer. The book is for someone who has the basic Google Cloud Platform (GCP) knowledge and skills, and basic Python programming skills, and wants to learn machine learning in GCP to take their next step toward becoming a Google Cloud Certified Machine Learning professional. The book starts by laying the foundations of Google Cloud Platform and Python programming, followed the by building blocks of machine learning, then focusing on machine learning in Google Cloud, and finally ends the studying for the Google Cloud Machine Learning certification by integrating all the knowledge and skills together. The book is based on the graduate courses the author has been teaching at the University of Texas at Dallas. When going through the chapters, the reader is expected to study the concepts, complete the exercises, understand and practice the labs in the appendices, and study each exam question thoroughly. Then, at the end of the learning journey, you can expect to harvest the knowledge, skills, and a certificate.
Table of Contents (23 chapters)
1
Part 1: Starting with GCP and Python
4
Part 2: Introducing Machine Learning
8
Part 3: Mastering ML in GCP
13
Part 4: Accomplishing GCP ML Certification
15
Part 5: Appendices
Appendix 2: Practicing Using the Python Data Libraries

Regression

Now we have split the datasets and transformed the data, we will show you how to use the scikit-learn library to build up ML models. We will start with regression and show you the following examples:

  • Simple linear regression
  • Multiple linear regression
  • Polynomial/non-linear regression

Simple linear regression

First things first, we need to prepare the dataset:

import numpy as pd
import pandas as pd
import matplotlib.pyplot as plt
dataset = pd.read_csv('Salary_Data.csv')
X = dataset.iloc[:,:-1].values
y = dataset.iloc[:, -1].values
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y , test_size = 0.2, random_state = 1)

Now we can start training our regression model. We need to import a class and feed our training data:

from sklearn.linear_model import LinearRegression
regressor = LinearRegression()
regressor.fit(X_train, y_train)

Next, we are going to predict the results...