# 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](https://developers.google.com/machine-learning/recommendation/overview/types).

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](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-matrix-factorization) 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 matrices 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 matrices contains the unique users on one axis and the number
of latent factors on the other axis, as specified by the
[`NUM_FACTORS` option](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-matrix-factorization#num_factors)
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](https://developers.google.com/machine-learning/recommendation/collaborative/matrix).

You can use a matrix factorization model with the
[`ML.RECOMMEND` function](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-recommend)
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)](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-dnn-models)
and
[Wide-and-Deep](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-wnd-models)
models with the
[`ML.PREDICT` function](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/bigqueryml-syntax-predict)
to make recommendations. These models can incorporate query and item features to improve the
relevance of recommendations. For more information, see the following resources:

- [Recommendation using Deep Neural Network Models](https://developers.google.com/machine-learning/recommendation/dnn/softmax)
- [Deep Neural Networks for YouTube Recommendations](https://research.google/pubs/pub45530)
- [Wide \& Deep Learning for Recommender Systems](https://arxiv.org/pdf/1606.07792.pdf)

## 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:

- [Machine Learning Crash Course](https://developers.google.com/machine-learning/crash-course)
- [Intro to Machine Learning](https://www.kaggle.com/learn/intro-to-machine-learning)
- [Intermediate Machine Learning](https://www.kaggle.com/learn/intermediate-machine-learning)
- [Recommendation Systems](https://developers.google.com/machine-learning/recommendation)