Ranking Versions Save

Learning to Rank in TensorFlow

v0.5.3

9 months ago

This is the 0.5.3 release of TensorFlow Ranking. We release a ranking distillation benchmark called RD-Suite that will accompany a research paper.

We also include a new ranking loss, YetiLogisticLoss: Adapted to neural network models from the Yeti loss implementation for GBDT.

v0.5.2

1 year ago

This is the 0.5.2 release of TensorFlow Ranking. We fix bugs and make a few improvements to the library. We also update the API reference on www.tensorflow.org/ranking and on Github docs.

v0.5.1

1 year ago

This is the 0.5.1 release of TensorFlow Ranking. We provide new ranking losses, metrics, layers, and pipeline based on the latest research progresses in Learning to Rank and Unbiased Ranking. We also update the API reference on www.tensorflow.org/ranking and on Github docs. The new changes include:

Dependencies: The following packages will be installed as required when installing tensorflow-ranking. tensorflow-serving-api>= 2.0.0, < 3.0.0 tensorflow>=2.7.0.

v0.5.0

2 years ago

This is the 0.5.0 release of TensorFlow Ranking. We provide a detailed overview, tutorial notebooks and API reference on www.tensorflow.org/ranking. The new changes are:

  • Move task.py and premade tfrbert_task.py to extension.
  • Remove RankingNetwork based tfr-bert example. The latest tfr-bert example using native Keras is available at tfrbert_antique_train.py.
  • Remove dependency on tf-models-official package to reduce install time. Users of tfr.ext.task or modules that depend on the above package will need to manually install it.
  • Updated all docstrings to be more detailed. Made several docstrings to be testable.
  • Add colab notebooks for quickstart tutorial and distributed ranking tutorial, also available on www.tensorflow.org/ranking.
  • Update strategy_utils to support parameter server strategy.
  • Add symmetric log1p to tfr.utils.
  • Remove references to Estimator/Feature Column related APIs in API reference.

v0.4.2

2 years ago

This is the 0.4.2 release of TensorFlow Ranking. The main changes are the TFR-BERT module based on the Orbit framework in tf-models, which facilitates users to write customized training loops. The new components are:

TFR-BERT in Orbit

  • tfr.keras.task: This module contains the general boilerplate code to train TF-Ranking models in the Orbit framework. Particularly, there are:
    • RankingDataLoader, which parses an ELWC formatted data record into tensors
    • RankingTask, which specifies the behaviors of each training and evaluation step, as well as the training losses and evaluation metrics.
    • In addition, there are config data classes like RankingDataConfig and RankingTaskConfig to store configurations for above classes.
  • tfr.keras.premade.tfrbert_task: This module contains the TFR-BERT specification of the TF-Ranking Orbit task.
    • TFRBertDataLoader, which subclasses the RankingDataLoader and further specifies the feature specs of a TFR-BERT model.
    • TFRBertScorer and TFRBertModelBuilder, which defines a model builder that can create a TFR-BERT ranking model as a Keras model, based on tf-models’ implementation of BERT encoder.
    • TFRBertTask, which is a subclass of RankingTask. It defines the build_model behavior. It also defines the initialization method which would load an pretrained BERT checkpoint to initialize the encoder. It also provides the function to output the prediction results along with query ids and document ids.
    • In addition, there are config data classes like TFRBertDataConfig, TFRBertModelConfig and TFRBertConfig which stores configurations for above classes.
  • examples/keras/tfrbert_antique_train.py: This file provides an example of training a TFR-BERT model on the Antique data set. There is also an .yaml file where users can specify parameter configurations.

Dependencies: The following packages will be installed as required when installing tensorflow-ranking.

  • tf-models-official >= 2.5.0
  • tensorflow-serving-api>= 2.0.0, < 3.0.0
  • tensorflow==2.5.0.

v0.4.0

2 years ago

This release is one of the major releases for TF-Ranking. It provides full support to build and train a native Keras model for ranking problems. It includes necessary Keras layers for a ranking model, a module to construct a model in a flexible manner, and a pipeline to train a model with minimal boilerplate. To get started, please follow the example here. In addition, the new release adds RaggedTensor support in losses and metrics and we provide a handy example to show how to use it in a ranking model.

The new components are listed below:

  • Keras Layers:

    • Use input packing for layer signatures for SavedModel compatibility.
    • create_tower function to create a feedforward neural network with batch normalization and dropout.
    • GAMLayer, a Keras layer which implements the neural generalized additive ranking model.
    • Update build method of DocumentInteractionAttention layer to ensure SavedModel is restored correctly.
  • ModelBuilder to build tf.keras.Model using Functional API:

    • AbstractModelBuilder class for users to inherit.
    • ModelBuilder class that wraps the boilerplate code to build tf.keras.Model for a ranking model.
    • InputCreator abstract class to implement create_inputs in ModelBuilder.
      • FeatureSpecInputCreator class to create inputs from feature_specs.
      • TypeSpecInputCreator class to create inputs from type_specs.
    • Preprocessor abstract class to implement preprocess in ModelBuilder.
      • PreprocessorWithSpec class to do Keras preprocessing or feature transformations with functions specified in Specs.
    • Scorer abstract class to implement score in ModelBuilder.
      • UnivariateScorer class to implement univariate scoring functions.
        • DNNScorer class to implement fully connected DNN univariate scoring.
        • GAMScorer class to implement feature based GAM univariate scoring.
  • Pipeline to wrap the boilerplate codes for training:

    • AbstractDatasetBuilder abstract class to build and serve the dataset for training.
    • BaseDatasetBuilder class to build training and validation datasets and signatures for SavedModel from feature_specs.
      • SimpleDatasetBuilder class to build datasets with a single label feature spec.
      • MultiLabelDatasetBuilder class to build datasets for multi-task learning.
    • DatasetHparams dataclass to specify all hyper-parameters used in BaseDatasetBuilder class.
    • AbstractPipeline abstract class to train and validate the ranking tf.keras.Model.
    • ModelFitPipeline class to train the ranking models using model.fit() compatible with distribution strategies.
      • SimplePipeline class for single-task training.
      • MultiTaskPipeline class for multi-task training.
      • An example client to showcase training a deep neural network model with a distribution strategy using SimplePipeline.
    • PipelineHparams dataclass to specify all hyper-parameters used in ModelFitPipeline class.
    • strategy_utils helper module to support tf.distribute strategies.
  • RaggedTensor support in losses and metrics:

    • Losses in tfr.keras.losses and metrics in tfr.keras.metrics support to act on tf.RaggedTensor inputs. To do so, set argument ragged=True when defining the loss and metric objects:
      • E.g.: loss = tf.keras.losses.SoftmaxLoss(name=’softmax_loss’, ragged=True)
      • Add this argument in get to get the losses and metrics support ragged tensors: loss = tf.keras.losses.get(‘softmax_loss’, ragged=True)
      • An example client to showcase training a deep neural network model using model.fit() with ragged inputs and outputs.

Dependencies: The following packages will be installed as required when installing tensorflow-ranking. tf-models-official >= 2.5.0 tensorflow-serving-api>= 2.0.0, < 3.0.0 tensorflow==2.5.0.

v0.3.3

3 years ago

This is the 0.3.3 release of TensorFlow Ranking. It depends on tf-models-official >= 2.4.0 and tensorflow-serving-api>= 2.0.0, < 3.0.0. It is compatible with tensorflow==2.4.1. All of these packages will be installed as required packages when installing tensorflow-ranking.

The main changes in this release contain the Document Interaction Network (DIN) layer and layers for training Keras models using Functional API. The new components are listed below:

  • Document Interaction Network: See paper.

    • Building Keras ranking models for DIN using Keras Preprocessing Layers.
      • Native Keras training: An example client to showcase such a model using model.fit().
      • Estimator based training: Another example client to showcase training a DIN model as an Estimator.
    • tfr.keras.layers.DocumentInteractionAttention: A keras layer to model cross-document interactions. Applies cross-document attention across valid examples identified using a mask.
  • Keras Layers: for easy transformation of context and example features and related utilities.

  • Others

    • tfr.keras.metrics.get(metric_key): Add a get metric factory for keras metrics.
    • Masking support in tfr.data: Add support for parsing a boolean mask tensor which indicates number of valid examples via mask_feature_name argument in tfr.data._RankingDataParser and all associated input data parsing and serving_input_fn builders.

v0.3.2

3 years ago

In the latest release of TensorFlow Ranking v0.3.2, we introduce TFR-BERT extension to better support ranking models for text data based on BERT. BERT is a pre-trained language representation model which has achieved substantial improvement over numerous NLP tasks. We find that fine-tuning BERT with ranking losses further improve the ranking performance (arXiv). You can read detailed information about what is included in TFR-BERT extension here. There is also an example showing how to use TFR-BERT here.

v0.3.1

3 years ago

This is the 0.3.1 release of TensorFlow Ranking. It depends on tensorflow-serving-api==2.1.0 and is fully compatible with tensorflow==2.2.0. Both will be installed as required packages when installing tensorflow-ranking.

The main changes in this release are canned Neural RankGAM estimator, canned DNN estimators, canned Neural RankGAM keras models and their examples. The new components are:

v0.3.0

4 years ago

This is the 0.3.0 release of TensorFlow Ranking. It depends on tensorflow-serving-api==2.1.0 and is fully compatible with tensorflow==2.1.0. Both will be installed as required packages when installing tensorflow-ranking.

The main changes in this release are related to the DNN Estimator Builder and Keras APIs.

A DNN Estimator Builder is available at tfr.estimator.make_dnn_ranking_estimator().

For Keras, we provide an example to showcase the use of Keras APIs to build ranking models , and a documentation providing step-by-step user instructions outlining the Keras user journey.

The new Keras components are: