|View source on GitHub|
A ranking task.
tfrs.tasks.Ranking( loss: Optional[tf.keras.losses.Loss] = None, metrics: Optional[List[tf.keras.metrics.Metric]] = None, prediction_metrics: Optional[List[tf.keras.metrics.Metric]] = None, label_metrics: Optional[List[tf.keras.metrics.Metric]] = None, loss_metrics: Optional[List[tf.keras.metrics.Metric]] = None, name: Optional[Text] = None ) -> None
Used in the notebooks
|Used in the tutorials|
Recommender systems are often composed of two components:
- a retrieval model, retrieving O(thousands) candidates from a corpus of O(millions) candidates.
- a ranker model, scoring the candidates retrieved by the retrieval model to return a ranked shortlist of a few dozen candidates.
This task helps with building ranker models. Usually, these will involve predicting signals such as clicks, cart additions, likes, ratings, and purchases.
call( labels: tf.Tensor, predictions: tf.Tensor, sample_weight: Optional[tf.Tensor] = None, training: bool = False, compute_metrics: bool = True ) -> tf.Tensor
Computes the task loss and metrics.
||Tensor of labels.|
||Tensor of predictions.|
||Tensor of sample weights.|
||Indicator whether training or test loss is being computed.|
||Whether to compute metrics. Set this to False during training for faster training.|
||Tensor of loss values.|