Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Machine Learning with BigQuery ML

You're reading from   Machine Learning with BigQuery ML Create, execute, and improve machine learning models in BigQuery using standard SQL queries

Arrow left icon
Product type Paperback
Published in Jun 2021
Publisher Packt
ISBN-13 9781800560307
Length 344 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Alessandro Marrandino Alessandro Marrandino
Author Profile Icon Alessandro Marrandino
Alessandro Marrandino
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Section 1: Introduction and Environment Setup
2. Chapter 1: Introduction to Google Cloud and BigQuery FREE CHAPTER 3. Chapter 2: Setting Up Your GCP and BigQuery Environment 4. Chapter 3: Introducing BigQuery Syntax 5. Section 2: Deep Learning Networks
6. Chapter 4: Predicting Numerical Values with Linear Regression 7. Chapter 5: Predicting Boolean Values Using Binary Logistic Regression 8. Chapter 6: Classifying Trees with Multiclass Logistic Regression 9. Section 3: Advanced Models with BigQuery ML
10. Chapter 7: Clustering Using the K-Means Algorithm 11. Chapter 8: Forecasting Using Time Series 12. Chapter 9: Suggesting the Right Product by Using Matrix Factorization 13. Chapter 10: Predicting Boolean Values Using XGBoost 14. Chapter 11: Implementing Deep Neural Networks 15. Section 4: Further Extending Your ML Capabilities with GCP
16. Chapter 12: Using BigQuery ML with AI Notebooks 17. Chapter 13: Running TensorFlow Models with BigQuery ML 18. Chapter 14: BigQuery ML Tips and Best Practices 19. Other Books You May Enjoy

Training the matrix factorization model

In this section, we'll train the BigQuery ML matrix factorization model in order to build a recommendation system with the e-commerce data that we've already prepared.

Let's start training the purchase_recommender ML model by executing the following SQL statement:

CREATE OR REPLACE MODEL `09_recommendation_engine.purchase_recommender`
OPTIONS(model_type='matrix_factorization',
        user_col='fullVisitorID',
        item_col='purchased_product_id',
        rating_col='quantity',
        feedback_type='implicit'
        )
AS
SELECT fullVisitorID, purchased_product_id, quantity 
FROM `09_recommendation_engine.product_purchases`; 

The first few lines of the query are composed...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime