From e-commerce to short video, recommendation system is widely used in various scenarios, but in fact, it is not easy to build an effective recommendation system.TensorFlow RecommendersIt is a library designed to build an efficient and scalable recommendation system.

Then introduce TensorFlow Recommenders to forge a recall system to introduce TensorFlow Recommender library.

Recommendation system

Recommendation system: recommend data according to user behavior. The behavioral data of one user, and the behavioral data of other users in the past, can help predict what to recommend to users next.

The complexity of recommendation systems

  • Most recommendation systems based on neural networks are composed of multiple components

Recommendation system of a few big difficulties

  • Difficult to train: high latitude, sparse large-scale models. The problem of multi-objective optimization needs to be solved.
  • Difficult to evaluate: Off-line metrics can be highly intrusive. Long-term learning in online trials is difficult to assess.
  • Difficult to deploy: The vocabulary is large and requires proximity recalls to achieve lower latency. Most models include recall, roughing and fining.

The core code

View the Data set (Movielens)

Randomly shuffled and sliced data sets

Prepare vocabulary of movie titles, user ids (for mapping)

Demo: Two-tower recall model

Define query towers, candidate towers

Define model index and training loss function

Put it together into a complete model

Compile the model and prepare the training and test data sets

Evaluate test set performance