Recommendation systems in Netflix

Machine Learning Probabilistic Generative Model Support Vector Machine Sparse Modeling Artificial Intelligence General Machine Learning and Data Analysis Digital Transformation Clojure Recommendation Technology  Navigation of this blog
Netflix recommendation system

The Netflix recommendation system will be based on information such as a user’s viewing history, ratings, search history, browsing time and favourites list, with the aim of suggesting the best content for that user. The system uses a combination of machine learning and algorithms.

Specifically, the system can identify the user’s favourite genres, actors, directors, etc., based on their past viewing history, suggest content containing similar elements, and, by evaluating the films selected by the user, collect data to provide content tailored to the user’s preferred trends. The system is designed to be used for this purpose.

Furthermore, Netflix goes beyond the simple categorisation of other similar services and uses more elaborate algorithms to analyse content, enabling it to analyse various factors such as music, colour and filming methods, for example, to provide the best possible video experience for its users The system is designed to provide the best possible video experience for the user.

Algorithm of the recommendation system

Various algorithms are used in recommendation systems. Typical algorithms are described below.

  1. Collaborative filtering: a method for recommending content that a user likes based on the user’s rating history. A typical method is to group users with similar tastes and interests and recommend content that is rated highly within that group.
  2. Content-based filtering: A method of recommending content that is likely to be liked by a user based on the user’s viewing and rating history. A typical method is to analyse the tendencies of the user’s favourite genres, actors, directors, etc., based on past viewing and rating history, and recommend content based on this analysis.
  3. Neural network (Neural Networks) recommendation: A method that analyses information such as video and audio to recommend the most suitable content to the user. The use of neural networks enables more advanced feature extraction and classification.

Each of these algorithms has its advantages and disadvantages.

History of the evolution of Netflix’s recommendation algorithm

The initial Netflix recommendation system was a so-called content-based recommendation system that used available data such as film genre, actors, year of release, etc. However, even if the genre and actors were similar, the user groups watching the film were often completely different and the recommendations were not very convincing. However, even if the genres and actors were similar, the user groups viewing them were often completely different and the recommendations were not very convincing.

Amazon then created a recommendation engine based on the collaborative filtering method used by Amazon, which provides recommendations based on common purchasing behaviour, saying that people who bought this product also bought this product.

If this method is applied to Netflix, the problem is that watching two films does not indicate whether you liked them, and if you liked one film but not the other, if you simply create a recommendation engine using rental history data alone, people who have watched one film will not be recommended the other. The problem emerged that the other film would be recommended to those who had seen one of the films.

Therefore, we asked users to rate films on a five-star scale and used this data to create a recommendation engine.

In 2000, a recommendation engine called ‘CineMatch’ was completed, which recommended films that the user would like and that were in stock, based on the user’s rental history and favourite films.

In 2006, the number of Netflix users exceeded 4 million, and as the number of users grew, so did the number of reviews and the performance of the recommendation engine: as much as 70% of the films on Netflix users’ subscription lists were recommended by Cinematch.

CINEMATCH

CINEMATCH is a recommendation system based on the Collaborative Filtering algorithm and operates on the following algorithms

  1. User-based collaborative filtering: CINEMATCH uses a method of grouping users with similar tastes and recommending content that is highly rated within the group. Specifically, based on the rating values of the content rated by the user, users with similar tastes to that user are searched, and the content rated highly by that user is recommended to that user.
  2. Item-based collaborative filtering: CINEMATCH uses a method that analyses what other content is highly rated by users who rate a certain content highly and recommends content similar to that content. Specifically, it analyses the content frequently viewed by users who rate a certain content highly, and recommends content relevant to those users.
  3. Matrix Factorisation: CINEMATCH uses a method of extracting the characteristics of users and content by expressing the rated values of content rated by users as a matrix and decomposing the matrix. Based on these features, it is possible to recommend users and content with similar preferences.

As described above, CINEMATCH achieves more accurate recommendations by combining multiple algorithms, and in addition to past evaluation data, it also analyses the user’s viewing history, search history, favourites list and other data to achieve more personalised recommendations.

Matrix Factorization

Netflix runs the Netflix Prize, a contest for recommendation systems. The competition ultimately attracted more than 40,000 registered teams from 186 countries and has had a significant impact on the field of recommendation systems.
The Netflix Prize has spawned a variety of new recommendation methods, as data from 100 million five-star ratings has been made publicly available. Among these, the winning team from AT&T proposed a method called Matrix Factorisation, which was a major game-changer in the field of recommendation systems. Since then and up to the present, many methods based on matrix factorisation have been proposed, and recommendation systems in BigQuery and Spark are based on matrix factorisation.

Matrix Factorisation is a method for extracting the characteristics of users and items in a recommendation system by expressing the evaluation values of items (e.g. films, books, products) rated by users as a matrix and decomposing the matrix.

Specifically, a matrix with the number of users as rows and the number of items as columns is considered, and each element of this matrix contains the evaluation values given to the items by the users. However, for items that have not been rated by users, the rating values are unknown.

By decomposing this matrix, user and item characteristics are extracted, usually using dimensionality reduction techniques to decompose the original matrix into a lower dimensional matrix. This can be, for example, decomposed into two matrices, one matrix representing the user features and the other representing the item features. The basic algorithm is to decompose the matrices, adjusting the number of features so that the result of multiplying these two matrices is close to the original matrix.

By using the decomposed matrix, the evaluation values can be predicted for new users and items, specifically, the result of inner-producting the user’s feature vector and the item’s feature vector is the predicted value of the evaluation value. This feature vector can also be used to calculate similarity and other functions.

Recommendation systems using Matrix Factorization have been used in Netflix’s CINEMATCH and Amazon’s product recommendation system, and Matrix Factorization using deep learning has recently been studied to develop more advanced It has become a promising algorithm for the development of more advanced recommendation systems.

Matrix Factorization using deep learning is an extension of Matrix Factorization and uses neural networks to perform more advanced feature extraction. Compared to conventional Matrix Factorization, it can build more flexible and expressive models.

Matrix Factorisation using deep learning

Matrix Factorisation using deep learning is similar to normal Matrix Factorisation, which extracts the feature vectors of users and items. However, in extracting the feature vector, a multi-layer neural network is used to learn the feature representation. In normal Matrix Factorization, feature vectors are obtained by linear combination, but deep learning makes it possible to learn non-linear feature representations.

Various models exist for Matrix Factorisation using deep learning. Typical examples include AutoRec, Neural Collaborative Filtering and DeepFM.

AutoRec uses a self-encoder (Autoencoder) to learn the feature vectors of users and items, and is a method for extracting important information contained in the input data by self-encoding and reconstructing the input data.In AutoRec, only items rated by the user only as input data and learns the user’s feature vectors so that the output data is the same as the input data.

Neural Collaborative Filtering uses a multi-layer neural network to learn the feature vectors of the user and the item, and in this model, as with normal Matrix Factorisation, the result of multiplying the feature vectors of the user and the item is used as the prediction. The result of multiplying the user and item feature vectors is used as the predictive value. However, in this model, not only the product of the feature vectors, but also the element-by-element product of the feature vectors is used for prediction.

DeepFM is a method that adds a multi-layer neural network to the Factorization Machine.

implementation example

The basic idea of Matrix Factorisation is to decompose a large matrix into several smaller matrices, from which an approximation of the original matrix is obtained. A simple example of implementing Matrix Factorisation using the numpy library in Python is described below.

Here, the user and item matrices are decomposed and the latent factor matrix is learnt to approximate the original matrix.

1. importing the required libraries

import numpy as np

2. matrix initialisation: take the example of a user x item matrix (e.g. a matrix of the evaluation values given by the user for an item). The missing (unrated) values are processed as NaN.

# Example: 5 users and 4 items
R = np.array([[5, 3, np.nan, 1],
              [4, np.nan, np.nan, 1],
              [1, 1, np.nan, 5],
              [1, np.nan, np.nan, 4],
              [1, 0, np.nan, 4]])

# Matrix size
num_users, num_items = R.shape

# Number of latent factors (ranks to be decomposed)
K = 2

# Initialisation of user and item latent factor matrices.
P = np.random.rand(num_users, K)  # User latent factor matrix
Q = np.random.rand(num_items, K)  # Latent factor matrix of items

3. learning matrix decomposition: here, the learning is done by ignoring the missing values of R and reconstructing the matrix. The loss function uses the square error and is optimised by gradient descent.

# Learning rate and number of iterations
learning_rate = 0.01
iterations = 1000
lambda_reg = 0.02  # regularization term

# Perform matrix decomposition
for iteration in range(iterations):
    for i in range(num_users):
        for j in range(num_items):
            if not np.isnan(R[i, j]):  # Calculated only if not a missing value
                error_ij = R[i, j] - np.dot(P[i, :], Q[j, :].T)  # error calculation
                # Update by gradient descent method
                for k in range(K):
                    P[i, k] += learning_rate * (2 * error_ij * Q[j, k] - lambda_reg * P[i, k])
                    Q[j, k] += learning_rate * (2 * error_ij * P[i, k] - lambda_reg * Q[j, k])

    # Show losses on the way (optional).
    if (iteration + 1) % 100 == 0:
        loss = 0
        for i in range(num_users):
            for j in range(num_items):
                if not np.isnan(R[i, j]):
                    loss += (R[i, j] - np.dot(P[i, :], Q[j, :].T)) ** 2
                    for k in range(K):
                        loss += (lambda_reg / 2) * (P[i, k] ** 2 + Q[j, k] ** 2)
        print(f"Iteration {iteration + 1}: loss = {loss}")

4. matrix reconstruction: after learning, an approximation of the original evaluation matrix R can be obtained by multiplying P and Q.

/# Approximation of matrices
R_hat = np.dot(P, Q.T)

print("Reconstructed matrix:")
print(R_hat)

5. result: when this code is executed, R_hat becomes an approximation matrix of the original matrix R. Where there were missing values, the predicted valuations go in; P and Q are optimised so that the values of R_hat are closer to the actual valuations.

reference book

Reference books relevant to the Netflix recommender system are described below.

1. ‘Recommender Systems: the Textbook’.
– Author: charu Aggarwal
– Abstract: This book provides a comprehensive description of the key techniques and algorithms associated with recommender systems. In particular, it delves deeply into the techniques related to the Netflix recommender system, including collaborative filtering, content-based recommendation, matrix factorisation (Matrix Factorization) and recommendation algorithms utilising deep learning.

2. ‘Mining of Massive Datasets’.
– Author(s): Jure Leskovec, Anand Rajaraman, Jeffrey Ullman
– Abstract: This book is dedicated to the analysis of large datasets and provides useful theories and techniques for building large-scale recommendation systems such as Netflix. It provides an understanding of practical algorithms such as matrix factorisation, clustering and optimisation.

3. ‘Deep Learning for Recommender Systems’.
– Author(s): Alexandros Karatzoglou, Balázs Hidasi
– Abstract: This book deals with the application of deep learning to complex recommender systems such as Netflix. It focuses on the design of recommender systems using deep learning and approaches using user and item embedding.

4. ‘Recommender Systems Handbook’.
– Edited by Francesco Ricci, Lior Rokach, Bracha Shapira
– Abstract: This handbook deals extensively with the theoretical, technical and implementation details related to recommender systems. In particular, it delves deeply into collaborative filtering and matrix factorisation techniques, with examples from real-world recommender systems such as Netflix.

5. “Collaborative Filtering: Recommender Systems
– Abstract: This book focuses on algorithms for collaborative filtering (the core technology of the Netflix recommender system). It focuses on recommendation techniques based on relationships between users and items, providing theoretical and practical approaches for individual implementations.

6. ‘Practical Recommender Systems’.
– Author: Kim Falk
– Abstract: This book describes how to build a recommendation system for practical use. It teaches how to design and implement recommendation systems with real-world case studies, taking into account large scale systems such as Netflix.

7. ‘Recommendation Systems: Challenges, Insights and Research Opportunities’.
– Author(s): Alberto Artuñedo, Juan José González, et al.
– Abstract: This book details current challenges, theoretical insights and future research directions on recommendation systems, and addresses the challenges of scaling systems such as Netflix efficiently.

コメント

Exit mobile version
タイトルとURLをコピーしました