%global _empty_manifest_terminate_build 0 Name: python-tensorflow-recommenders Version: 0.7.3 Release: 1 Summary: Tensorflow Recommenders, a TensorFlow library for recommender systems. License: Apache 2.0 URL: https://github.com/tensorflow/recommenders Source0: https://mirrors.nju.edu.cn/pypi/web/packages/c0/d0/50dbb1a2b9d775a580441c45269b71b60aea3b0358f8131ae3f5c8e4ccec/tensorflow-recommenders-0.7.3.tar.gz BuildArch: noarch Requires: python3-absl-py Requires: python3-tensorflow Requires: python3-tensorflow-macos Requires: python3-annoy Requires: python3-fire Requires: python3-scann Requires: python3-tensorflow-ranking %description # TensorFlow Recommenders ![TensorFlow Recommenders logo](assets/full_logo.png) ![TensorFlow Recommenders build badge](https://github.com/tensorflow/recommenders/actions/workflows/test.yaml/badge.svg) [![PyPI badge](https://img.shields.io/pypi/v/tensorflow-recommenders.svg)](https://pypi.python.org/pypi/tensorflow-recommenders/) TensorFlow Recommenders is a library for building recommender system models using [TensorFlow](https://www.tensorflow.org). It helps with the full workflow of building a recommender system: data preparation, model formulation, training, evaluation, and deployment. It's built on Keras and aims to have a gentle learning curve while still giving you the flexibility to build complex models. ## Installation Make sure you have TensorFlow 2.x installed, and install from `pip`: ```shell pip install tensorflow-recommenders ``` ## Documentation Have a look at our [tutorials](https://tensorflow.org/recommenders/examples/quickstart) and [API reference](https://www.tensorflow.org/recommenders/api_docs/python/tfrs/). ## Quick start Building a factorization model for the Movielens 100K dataset is very simple ([Colab](https://tensorflow.org/recommenders/examples/quickstart)): ```python from typing import Dict, Text import tensorflow as tf import tensorflow_datasets as tfds import tensorflow_recommenders as tfrs # Ratings data. ratings = tfds.load('movielens/100k-ratings', split="train") # Features of all the available movies. movies = tfds.load('movielens/100k-movies', split="train") # Select the basic features. ratings = ratings.map(lambda x: { "movie_id": tf.strings.to_number(x["movie_id"]), "user_id": tf.strings.to_number(x["user_id"]) }) movies = movies.map(lambda x: tf.strings.to_number(x["movie_id"])) # Build a model. class Model(tfrs.Model): def __init__(self): super().__init__() # Set up user representation. self.user_model = tf.keras.layers.Embedding( input_dim=2000, output_dim=64) # Set up movie representation. self.item_model = tf.keras.layers.Embedding( input_dim=2000, output_dim=64) # Set up a retrieval task and evaluation metrics over the # entire dataset of candidates. self.task = tfrs.tasks.Retrieval( metrics=tfrs.metrics.FactorizedTopK( candidates=movies.batch(128).map(self.item_model) ) ) def compute_loss(self, features: Dict[Text, tf.Tensor], training=False) -> tf.Tensor: user_embeddings = self.user_model(features["user_id"]) movie_embeddings = self.item_model(features["movie_id"]) return self.task(user_embeddings, movie_embeddings) model = Model() model.compile(optimizer=tf.keras.optimizers.Adagrad(0.5)) # Randomly shuffle data and split between train and test. tf.random.set_seed(42) shuffled = ratings.shuffle(100_000, seed=42, reshuffle_each_iteration=False) train = shuffled.take(80_000) test = shuffled.skip(80_000).take(20_000) # Train. model.fit(train.batch(4096), epochs=5) # Evaluate. model.evaluate(test.batch(4096), return_dict=True) ``` %package -n python3-tensorflow-recommenders Summary: Tensorflow Recommenders, a TensorFlow library for recommender systems. Provides: python-tensorflow-recommenders BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-tensorflow-recommenders # TensorFlow Recommenders ![TensorFlow Recommenders logo](assets/full_logo.png) ![TensorFlow Recommenders build badge](https://github.com/tensorflow/recommenders/actions/workflows/test.yaml/badge.svg) [![PyPI badge](https://img.shields.io/pypi/v/tensorflow-recommenders.svg)](https://pypi.python.org/pypi/tensorflow-recommenders/) TensorFlow Recommenders is a library for building recommender system models using [TensorFlow](https://www.tensorflow.org). It helps with the full workflow of building a recommender system: data preparation, model formulation, training, evaluation, and deployment. It's built on Keras and aims to have a gentle learning curve while still giving you the flexibility to build complex models. ## Installation Make sure you have TensorFlow 2.x installed, and install from `pip`: ```shell pip install tensorflow-recommenders ``` ## Documentation Have a look at our [tutorials](https://tensorflow.org/recommenders/examples/quickstart) and [API reference](https://www.tensorflow.org/recommenders/api_docs/python/tfrs/). ## Quick start Building a factorization model for the Movielens 100K dataset is very simple ([Colab](https://tensorflow.org/recommenders/examples/quickstart)): ```python from typing import Dict, Text import tensorflow as tf import tensorflow_datasets as tfds import tensorflow_recommenders as tfrs # Ratings data. ratings = tfds.load('movielens/100k-ratings', split="train") # Features of all the available movies. movies = tfds.load('movielens/100k-movies', split="train") # Select the basic features. ratings = ratings.map(lambda x: { "movie_id": tf.strings.to_number(x["movie_id"]), "user_id": tf.strings.to_number(x["user_id"]) }) movies = movies.map(lambda x: tf.strings.to_number(x["movie_id"])) # Build a model. class Model(tfrs.Model): def __init__(self): super().__init__() # Set up user representation. self.user_model = tf.keras.layers.Embedding( input_dim=2000, output_dim=64) # Set up movie representation. self.item_model = tf.keras.layers.Embedding( input_dim=2000, output_dim=64) # Set up a retrieval task and evaluation metrics over the # entire dataset of candidates. self.task = tfrs.tasks.Retrieval( metrics=tfrs.metrics.FactorizedTopK( candidates=movies.batch(128).map(self.item_model) ) ) def compute_loss(self, features: Dict[Text, tf.Tensor], training=False) -> tf.Tensor: user_embeddings = self.user_model(features["user_id"]) movie_embeddings = self.item_model(features["movie_id"]) return self.task(user_embeddings, movie_embeddings) model = Model() model.compile(optimizer=tf.keras.optimizers.Adagrad(0.5)) # Randomly shuffle data and split between train and test. tf.random.set_seed(42) shuffled = ratings.shuffle(100_000, seed=42, reshuffle_each_iteration=False) train = shuffled.take(80_000) test = shuffled.skip(80_000).take(20_000) # Train. model.fit(train.batch(4096), epochs=5) # Evaluate. model.evaluate(test.batch(4096), return_dict=True) ``` %package help Summary: Development documents and examples for tensorflow-recommenders Provides: python3-tensorflow-recommenders-doc %description help # TensorFlow Recommenders ![TensorFlow Recommenders logo](assets/full_logo.png) ![TensorFlow Recommenders build badge](https://github.com/tensorflow/recommenders/actions/workflows/test.yaml/badge.svg) [![PyPI badge](https://img.shields.io/pypi/v/tensorflow-recommenders.svg)](https://pypi.python.org/pypi/tensorflow-recommenders/) TensorFlow Recommenders is a library for building recommender system models using [TensorFlow](https://www.tensorflow.org). It helps with the full workflow of building a recommender system: data preparation, model formulation, training, evaluation, and deployment. It's built on Keras and aims to have a gentle learning curve while still giving you the flexibility to build complex models. ## Installation Make sure you have TensorFlow 2.x installed, and install from `pip`: ```shell pip install tensorflow-recommenders ``` ## Documentation Have a look at our [tutorials](https://tensorflow.org/recommenders/examples/quickstart) and [API reference](https://www.tensorflow.org/recommenders/api_docs/python/tfrs/). ## Quick start Building a factorization model for the Movielens 100K dataset is very simple ([Colab](https://tensorflow.org/recommenders/examples/quickstart)): ```python from typing import Dict, Text import tensorflow as tf import tensorflow_datasets as tfds import tensorflow_recommenders as tfrs # Ratings data. ratings = tfds.load('movielens/100k-ratings', split="train") # Features of all the available movies. movies = tfds.load('movielens/100k-movies', split="train") # Select the basic features. ratings = ratings.map(lambda x: { "movie_id": tf.strings.to_number(x["movie_id"]), "user_id": tf.strings.to_number(x["user_id"]) }) movies = movies.map(lambda x: tf.strings.to_number(x["movie_id"])) # Build a model. class Model(tfrs.Model): def __init__(self): super().__init__() # Set up user representation. self.user_model = tf.keras.layers.Embedding( input_dim=2000, output_dim=64) # Set up movie representation. self.item_model = tf.keras.layers.Embedding( input_dim=2000, output_dim=64) # Set up a retrieval task and evaluation metrics over the # entire dataset of candidates. self.task = tfrs.tasks.Retrieval( metrics=tfrs.metrics.FactorizedTopK( candidates=movies.batch(128).map(self.item_model) ) ) def compute_loss(self, features: Dict[Text, tf.Tensor], training=False) -> tf.Tensor: user_embeddings = self.user_model(features["user_id"]) movie_embeddings = self.item_model(features["movie_id"]) return self.task(user_embeddings, movie_embeddings) model = Model() model.compile(optimizer=tf.keras.optimizers.Adagrad(0.5)) # Randomly shuffle data and split between train and test. tf.random.set_seed(42) shuffled = ratings.shuffle(100_000, seed=42, reshuffle_each_iteration=False) train = shuffled.take(80_000) test = shuffled.skip(80_000).take(20_000) # Train. model.fit(train.batch(4096), epochs=5) # Evaluate. model.evaluate(test.batch(4096), return_dict=True) ``` %prep %autosetup -n tensorflow-recommenders-0.7.3 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-tensorflow-recommenders -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri Apr 21 2023 Python_Bot - 0.7.3-1 - Package Spec generated