TensorFlow is one of the greatest gifts to the machine learning community by Google. An end-to-end open-source framework for machine learning with a comprehensive ecosystem of tools, libraries and community resources, TensorFlow lets researchers push the state-of-the-art in ML and developers can easily build and deploy ML-powered applications. Ever since its release to the public back in November 2015, TensorFlow has grown to become one of the most popular deep learning frameworks. This month, TensorFlow turned five, and in this article, we take a look at its popular libraries.
Lattice
TensorFlow Lattice library implements constrained and interpretable lattice-based models that enable users to inject domain knowledge into the learning process through common-sense. TF Lattice allows users to use domain knowledge to extrapolate to the parts of the input space that hasn’t been covered by the training dataset.
TensorFlow Probability
TensorFlow Probability makes it easy to combine probabilistic models and deep learning on TPUs and GPUs. It’s built for data scientists, statisticians, ML researchers, and practitioners who want to encode domain knowledge to understand data and make predictions.
TensorFlow Hub
TensorFlow Hub consists of a collection of trained machine learning models ready for fine-tuning and deployable anywhere. This allows reusing trained models like BERT and Faster R-CNN with just a few lines of code.
!pip install --upgrade tensorflow_hub
TFRS
TensorFlow Recommenders (TFRS) is released for building recommender system models with great ease.
It assists the users with the full workflow of building a recommender system: data preparation, model formulation, training, evaluation, and deployment.
Built on Keras, TFRS makes it possible to:
- Build and evaluate flexible recommendation retrieval models.
- Incorporate item, user, and context information into recommendation models.
- Train multi-task models that jointly optimise multiple recommendation objectives.
import tensorflow_recommenders as tfrs
TensorFlow Graphics
TensorFlow Graphics aims at making useful graphics functions widely accessible to the community by providing a set of differentiable graphics layers (e.g. cameras, reflectance models, mesh convolutions) and 3D viewer functionalities (e.g. 3D TensorBoard. This can be used in your machine learning models of choice.
pip install --upgrade tensorflow-graphics
Nucleus
Nucleus is a library of Python and C++ code designed to make it easy to read, write and analyse data in common genomics file formats like SAM and VCF. In addition, Nucleus enables painless integration with the TensorFlow machine learning framework, as anywhere a genomics file is consumed or produced, a TensorFlow tfrecords file may be used instead.
pip install --user google-nucleus
Sonnet
Sonnet is designed to provide simple, composable abstractions for machine learning research. Designed and built by researchers at DeepMind, Sonnet consists of many predefined modules like snt.Linear, snt.Conv2D, snt.BatchNorm and some predefined networks of modules like snt.nets.MLP. Users can also build their own modules.
$ pip install dm-sonnet
TensorFlow Ranking
TensorFlow Ranking is a library for Learning-to-Rank (LTR) techniques on the TensorFlow platform. It contains the following components:
- Commonly used loss functions, including pointwise, pairwise, and listwise losses.
- Commonly used ranking metrics like Mean Reciprocal Rank (MRR) and Normalised Discounted Cumulative Gain (NDCG).
- Multi-item (also known as Groupwise) scoring functions.
- LambdaLoss implementation for direct ranking metric optimisation.
- Unbiased Learning-to-Rank from biased feedback data.
This library provides a convenient open platform for hosting and advancing state-of-the-art ranking models based on deep learning techniques, and thus facilitate both academic research and industrial applications.
pip install --user --upgrade tensorflow_ranking
TensorFlow Privacy
TensorFlow Privacy is a Python library that includes implementations of TensorFlow optimisers for training machine learning models with differential privacy.
TensorFlow Privacy installation:
pip install tensorflow-privacy
T2T
Tensor2Tensor, or T2T for short, is one of the earliest libraries by TF, designed to make deep learning more accessible. T2T was developed by Google Brain team.
pip install tensor2tensor
For Reinforcement Learning
TensorFlow has two popular libraries for RL:
- TRFL is an open-source library of useful building blocks for writing reinforcement learning (RL) agents in TensorFlow. It represents a collection of key algorithmic components that are used for a large number of DeepMind’s most successful agents such as DQN, DDPG and the Importance Weighted Actor Learner Architecture.
- TF-Agents makes designing, implementing and testing new RL algorithms easier by providing well tested modular components that can be modified and extended. It enables fast code iteration, with good test integration and benchmarking.