Recommendation overview
Recommendation systems are one of the most successful and widespread applications of
machine 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 Store
offers millions of apps, while YouTube offers billions of videos, with more apps
and 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, see
Recommendation Systems Overview.
Machine learning algorithms in recommendation systems are typically classified
into the following categories:
- Content-based filtering: uses similarity between items to provide
recommendations. For example, if a user watches two cute cat videos, then the
recommendation system can recommend more cute animal videos to that user.
- Collaborative filtering: uses similarities between users (based on user
queries) to provide recommendations. For example, if user A searches for
similar things to user B, and user B likes video 1, then the recommendation
system can recommend video 1 to user A, even if user A hasn't watched any
videos 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-dimensional
matrix, with the unique users on one axis and the unique items on the other
axis. 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, users
won't have a value for each item. The goal of the matrix factorization model is
to create two smaller, dense matrixes of weights that when multiplied together,
approximate the original matrix cell values and provide predicted ratings for
the empty matrix cells.
One of the smaller matrixes contains the unique users on one axis and the number
of latent factors on the other axis, as specified by the
NUM_FACTORS
option
of the CREATE MODEL
statement. The other smaller matrix contains the unique
items on one axis and the number of latent factors on the other axis. In this
matrix, the latent factor weights are generated by the algorithm used to train
the model, based on the user-item combinations from the input matrix.
For more information, see
Matrix Factorization.
You can use a matrix factorization model with the
ML.RECOMMEND
function
to make recommendations.
Other models for recommendation
To extend a collaborative filtering-based recommendation system beyond what is
possible with a matrix factorization model, you can use
deep neural network (DNN)
and
Wide-and-Deep
models with the
ML.PREDICT
function
to make recommendations. These models can incorporate query and item features to improve the
relevance of recommendations. For more information, see the following resources:
Recommended knowledge
By using the default settings in the CREATE MODEL
statements and the
inference functions, you can create and use a recommendation model even
without much ML knowledge. However, having basic knowledge about
ML development, and recommendation models in particular,
helps you optimize both your data and your model to
deliver better results. We recommend using the following resources to develop
familiarity with ML techniques and processes:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-25 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eRecommendation systems are widely used in businesses to help users discover content they might not find through search, utilizing machine learning to suggest relevant items.\u003c/p\u003e\n"],["\u003cp\u003eContent-based filtering and collaborative filtering are two primary methods used in recommendation systems, with the former focusing on item similarity and the latter on user similarities.\u003c/p\u003e\n"],["\u003cp\u003eMatrix factorization models, which are a type of collaborative filtering, map user-item interactions to a matrix and aim to predict user preferences by filling in missing data, using latent factors to simplify the matrix.\u003c/p\u003e\n"],["\u003cp\u003eFor more advanced recommendation systems, deep neural network (DNN) and Wide-and-Deep models can be used, incorporating query and item features to enhance the accuracy and relevance of recommendations.\u003c/p\u003e\n"],["\u003cp\u003eBasic machine learning knowledge can improve the effectiveness of recommendation models, and resources are recommended to help develop familiarity with machine learning techniques.\u003c/p\u003e\n"]]],[],null,["# Recommendation overview\n=======================\n\nRecommendation systems are one of the most successful and widespread applications of\nmachine 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 Store\noffers millions of apps, while YouTube offers billions of videos, with more apps\nand videos added every day.\nUsers 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, see\n[Recommendation Systems Overview](https://developers.google.com/machine-learning/recommendation/overview/types).\n\nMachine learning algorithms in recommendation systems are typically classified\ninto the following categories:\n\n- Content-based filtering: uses similarity between items to provide recommendations. For example, if a user watches two cute cat videos, then the recommendation system can recommend more cute animal videos to that user.\n- Collaborative filtering: uses similarities between users (based on user queries) to provide recommendations. For example, if user A searches for similar things to user B, and user B likes video 1, then the recommendation system can recommend video 1 to user A, even if user A hasn't watched any videos similar to video 1.\n\nMatrix factorization models\n---------------------------\n\n[Matrix factorization models](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-matrix-factorization) are widely used as a collaborative filtering method for recommendation systems.\n\nIn a matrix factorization model, user-item pairs are mapped to a two-dimensional\nmatrix, with the unique users on one axis and the unique items on the other\naxis. Ratings that a user has given items reside in the cells of the matrix.\nThis matrix doesn't need to be completely full; the majority of the time, users\nwon't have a value for each item. The goal of the matrix factorization model is\nto create two smaller, dense matrixes of weights that when multiplied together,\napproximate the original matrix cell values and provide predicted ratings for\nthe empty matrix cells.\n\nOne of the smaller matrixes contains the unique users on one axis and the number\nof latent factors on the other axis, as specified by the\n[`NUM_FACTORS` option](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-matrix-factorization#num_factors)\nof the `CREATE MODEL` statement. The other smaller matrix contains the unique\nitems on one axis and the number of latent factors on the other axis. In this\nmatrix, the latent factor weights are generated by the algorithm used to train\nthe model, based on the user-item combinations from the input matrix.\n\nFor more information, see\n[Matrix Factorization](https://developers.google.com/machine-learning/recommendation/collaborative/matrix).\n\nYou can use a matrix factorization model with the\n[`ML.RECOMMEND` function](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-recommend)\nto make recommendations.\n\nOther models for recommendation\n-------------------------------\n\nTo extend a collaborative filtering-based recommendation system beyond what is\npossible with a matrix factorization model, you can use\n[deep neural network (DNN)](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-dnn-models)\nand\n[Wide-and-Deep](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-wnd-models)\nmodels with the\n[`ML.PREDICT` function](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-predict)\nto make recommendations. These models can incorporate query and item features to improve the\nrelevance of recommendations. For more information, see the following resources:\n\n- [Recommendation using Deep Neural Network Models](https://developers.google.com/machine-learning/recommendation/dnn/softmax)\n- [Deep Neural Networks for YouTube Recommendations](https://research.google/pubs/pub45530)\n- [Wide \\& Deep Learning for Recommender Systems](https://arxiv.org/pdf/1606.07792.pdf)\n\nRecommended knowledge\n---------------------\n\nBy using the default settings in the `CREATE MODEL` statements and the\ninference functions, you can create and use a recommendation model even\nwithout much ML knowledge. However, having basic knowledge about\nML development, and recommendation models in particular,\nhelps you optimize both your data and your model to\ndeliver better results. We recommend using the following resources to develop\nfamiliarity with ML techniques and processes:\n\n- [Machine Learning Crash Course](https://developers.google.com/machine-learning/crash-course)\n- [Intro to Machine Learning](https://www.kaggle.com/learn/intro-to-machine-learning)\n- [Intermediate Machine Learning](https://www.kaggle.com/learn/intermediate-machine-learning)\n- [Recommendation Systems](https://developers.google.com/machine-learning/recommendation)"]]