Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tensorflow Recommenders

Tensorflow Recommenders

TensorFlow User Group Summit SSA
Une Session sur TensorFlow Recommenders- une bibliothèque de composants que vous pouvez utiliser pour créer, vous l'avez deviné, des systèmes de recommandation.

Yannick Serge Obam

November 07, 2021
Tweet

More Decks by Yannick Serge Obam

Other Decks in Programming

Transcript

  1. 1 Yannick Serge Obam ML GDE Tensorflow recommenders 1 @OBAMSerge

    Construire les systemes de recommandations avec TensorFlow
  2. • Filtrage collaboraif • Filtrage basé sur le contenu •

    Hybride 03 philosophies de modélisation
  3. TensorFlow recommenders • Bibliothèque permettant de créer des modèles système

    pour les outils de recommandation. • S’appuie sur tensorflow 2.0 et Keras 8
  4. Conduit par des besoins pratiques • Apprentissage multitache • Modelisation

    des interactions des features • Entrainement sur TPU 9
  5. import tensorflow_datasets as tfds import tensorflow_recommenders as tfrs # Data

    on ratings. ratings = tfds.load("movielens/100k-ratings", split="train") # Movie features. movies = tfds.load("movielens/100k-movies", split="train")
  6. import tensorflow_datasets as tfds import tensorflow_recommenders as tfrs # Data

    on ratings. ratings = tfds.load("movielens/100k-ratings", split="train") # Movie features. movies = tfds.load("movielens/100k-movies", split="train") # The user and movie models can be arbitrary Keras models. user_model = tf.keras.Sequential([ tf.keras.layers.Embedding(1000, 32), tf.keras.layers.Dense(64, activation=”relu”) ]) movie_model = tf.keras.layers.Embedding(1700, 64)
  7. import tensorflow_datasets as tfds import tensorflow_recommenders as tfrs # Data

    on ratings. ratings = tfds.load("movielens/100k-ratings", split="train") # Movie features. movies = tfds.load("movielens/100k-movies", split="train") # The user and movie models can be arbitrary Keras models. user_model = tf.keras.Sequential([ tf.keras.layers.Embedding(1000, 32), tf.keras.layers.Dense(64, activation=”relu”) ]) movie_model = tf.keras.layers.Embedding(1700, 64) for x in ratings.take(1).as_numpy_iterator(): pprint.pprint(x)
  8. 19 model = MovielensModel( user_model=user_model, movie_model=movie_model, # The retrieval task

    will optimize for retrieving the best movies. task=tfrs.tasks.Retrieval( # Model retrieval accuracy measured across all recommendable movies. metrics=tfrs.metrics.FactorizedTopK( candidates=movies.batch(128).map(movie_model) )) )
  9. 20

  10. 22

  11. 23

  12. 24 Resources: TensorFlow Recommenders homepage → https://goo.gle/2IJAkrK TensorFlow Recommenders repository

    on GitHub → https://goo.gle/3ef3tYy Building a retrieval model using TensorFlow Recommenders → https://goo.gle/3yUAqkK https://www.tensorflow.org/guide/ https://www.tensorflow.org/tutorials Question & Bugs: https://github.com/tensorflow/tensorflow/issues Merci