Recommendation overview
Recommendation systems are one of the most successful and widespread applications ofmachine learning for businesses. You can use a recommendation system to help your users find compelling content in a large body of content. For example, Google Play Storeoffers millions of apps, while YouTube offers billions of videos, with more appsand videos added every day.Users can use search to find new content, but that is limited by the search terms they use. A recommendation system can suggest content that users might not have thought to search for on their own. For more information, seeRecommendation Systems Overview.
Machine learning algorithms in recommendation systems are typically classifiedinto the following categories:
- Content-based filtering: uses similarity between items to providerecommendations. For example, if a user watches two cute cat videos, then therecommendation system can recommend more cute animal videos to that user.
- Collaborative filtering: uses similarities between users (based on userqueries) to provide recommendations. For example, if user A searches forsimilar things to user B, and user B likes video 1, then the recommendationsystem can recommend video 1 to user A, even if user A hasn't watched anyvideos similar to video 1.
Matrix factorization models
Matrix factorization models are widely used as a collaborative filtering method for recommendation systems.
In a matrix factorization model, user-item pairs are mapped to a two-dimensionalmatrix, with the unique users on one axis and the unique items on the otheraxis. Ratings that a user has given items reside in the cells of the matrix.This matrix doesn't need to be completely full; the majority of the time, userswon't have a value for each item. The goal of the matrix factorization model isto create two smaller, dense matrixes of weights that when multiplied together,approximate the original matrix cell values and provide predicted ratings forthe empty matrix cells.
One of the smaller matrixes contains the unique users on one axis and the numberof latent factors on the other axis, as specified by theNUM_FACTORS optionof theCREATE MODEL statement. The other smaller matrix contains the uniqueitems on one axis and the number of latent factors on the other axis. In thismatrix, the latent factor weights are generated by the algorithm used to trainthe model, based on the user-item combinations from the input matrix.
For more information, seeMatrix Factorization.
You can use a matrix factorization model with theML.RECOMMEND functionto make recommendations.
Other models for recommendation
To extend a collaborative filtering-based recommendation system beyond what ispossible with a matrix factorization model, you can usedeep neural network (DNN)andWide-and-Deepmodels with theML.PREDICT functionto make recommendations. These models can incorporate query and item features to improve therelevance of recommendations. For more information, see the following resources:
- Recommendation using Deep Neural Network Models
- Deep Neural Networks for YouTube Recommendations
- Wide & Deep Learning for Recommender Systems
Recommended knowledge
By using the default settings in theCREATE MODEL statements and theinference functions, you can create and use a recommendation model evenwithout much ML knowledge. However, having basic knowledge aboutML development, and recommendation models in particular,helps you optimize both your data and your model todeliver better results. We recommend using the following resources to developfamiliarity with ML techniques and processes:
- Machine Learning Crash Course
- Intro to Machine Learning
- Intermediate Machine Learning
- Recommendation Systems
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.