Introducing TF-Ranking

Programmatically, the ranking head is exposed via the factory method tfr.head.create_ranking_head.Using TF-RankingFrom the programming standpoint, TF-Ranking implements the TensorFlow Estimator interface which abstracts different aspects of the machine learning application lifecycle such as training, evaluation, prediction and model serving..The experience for using TF-Ranking is illustrated in the following code.def get_estimator(hparams): """Create a ranking estimator..Args: hparams: ( a hyperparameters object..Returns: tf.learn `Estimator`..""" def _train_op_fn(loss): """Defines train op used in ranking head.""" return tf.contrib.layers.optimize_loss( loss=loss, global_step=tf.train.get_global_step(), learning_rate=hparams.learning_rate, optimizer="Adagrad") ranking_head = tfr.head.create_ranking_head( loss_fn=tfr.losses.make_loss_fn(_LOSS), eval_metric_fns=eval_metric_fns(), train_op_fn=_train_op_fn) return tf.estimator.Estimator( model_fn=tfr.model.make_groupwise_ranking_fn( group_score_fn=make_score_fn(), group_size=1, transform_fn=None, ranking_head=ranking_head), params=hparams)In addition to the programming simplicity, TF-Ranking is integrated with the rest of the TensorFlow ecosystem..Models developed using TF-Rankign can be visually evaluated using the TensorBoard toolset as shown in the following image.TF-Ranking in the Real WorldGoogle evaluated TF-Ranking in two mission critical scenarios: Gmail search and recommendations for documents stored in Google Drive..In the case of the Gmail search scenario, TF-Ranking was used to rank five results that match a specific user query..Metrics such as user clicks are used as relevance labels for ranking..The results of the different ranking models are shown in the following matrix.In the case of the Google Drive scenario, TF-Ranking was used to implement a recommendation engine that surfaces documents currently relevant to the user when she visits the Drive home screen..Similar to the Gmail scenario, the recommendation system factors in user clicks to reevaluate the ranking models..The results are shown in the following matrix.TF-Ranking is a great addition to the TensorFlow stack..Differently from its predecessors.. More details

Leave a Reply