181
Views
0
CrossRef citations to date
0
Altmetric
Reviews of Books and Teaching Materials

Deep Learning and Scientific Computing with R torch

Sigrid Keydana, Boca Raton, FL: Chapman & Hall/CRC Press, 2023, xix + 393 pp., $180.00(H), ISBN: 978-1-032-23138-9.

ORCID Icon
Page 264 | Received 19 Aug 2023, Accepted 29 Jan 2024, Published online: 17 Apr 2024

With ever-increasing amounts of data and computing power, we have witnessed the miraculous rise of deep learning in both academia and industry around the globe. Its success can be partially attributed to the development of user-friendly computing frameworks such as TensorFlow and PyTorch, which streamline and (semi-)automate the design and deployment of sophisticated deep neural networks. This book introduces an R interface torch that gives R users access to the functionality of PyTorch in a pure R environment. The book is very well written and easy to follow with plenty of illustrations and explanations via examples and codes. I have learned a lot from the book and believe that many R users can greatly benefit from it as well even without an extensive machine learning background.

The book consists of three major parts: (1) Chapters 1–11 introducing the basics of torch such as tensors and automatic differentiation, (2) Chapters 12–22 covering the implementations of deep neural networks via torch, and (3) Chapters 23–28 showcasing the utility of torch beyond deep learning. Below, I will briefly review all the chapters of the book.

Part I. Chapters 1 and 2 provide a short overview of the book and the installation instructions of torch and its associated packages in R (no Python installation is required!), respectively. Chapter 3 introduces the most fundamental data structure in torch, tensors, which are arrays equipped with efficient computational capability. The readers would learn how to create, access, manipulate, reshape, and broadcast tensors. Chapters 4 and 5 demonstrate torch’s automatic differentiation capability (autograd) and its usage in function minimization, which greatly simplifies the implementation of algorithms that involve differentiation such as minimizing a loss function commonly encountered in machine learning. Chapter 6 builds a small neural network from tensors and trains it with autograd for a simple regression task. This “explicit” implementation of a neural network from scratch is instructive, especially for readers without the knowledge of neural networks. Chapters 7–9 introduce modules, optimizers, and lossestorch’s built-in functionalities that help simplify the specification of the architecture of a neural network and its training strategy. Chapter 10 tackles the issue of choosing the learning rating of an optimizer via the L-BFGS algorithm with or without the line search. Chapter 11 presents a much-simplified implementation of the neural network built in Chapter 6 using the built-in functionalities of torch introduced in Chapters 7–9.

Part II. Chapter 12 provides a short overview of the second part of the book, which focuses on the implementation of deep neural networks. Chapter 13 describes the data loading method that allows the data to be loaded in batches, which is crucial for handling big data. Chapter 14 introduces the package luz, which further streamlines the implementation of neural networks by simplifying the process of training, validation, and testing while retaining the customizability via callbacks. luz also automates the communication between CPU and GPU. Chapter 15 covers the convolutional neural network, which is specialized in image classification tasks. In torch, it can be implemented with built-in convolutional layers and pooling layers. Chapter 16 addresses the overfitting issue, which, if left unaddressed, can lead to poor out-of-sample prediction performance, through data augmentation, dropout, explicit regularization, and early stopping in training. Chapter 17 speeds up neural network training via batch normalization, dynamic learning rate determination, and transfer learning with pre-trained models. Chapter 18 revisits the image classification task by applying the techniques from Chapters 16 and 17. The performance is much improved in terms of both better generalizability and faster learning. Chapter 19 moves on from image classification to image segmentation, which classifies pixels of an image rather than the image itself. The specialized neural network for this task is the U-Net, which has a coupled encoder-decoder architecture. Chapter 20 focuses on tabular data, which are a more familiar form of data to many statisticians. Neural networks are capable of learning latent compact representations via the embedding module, a key feature to achieve superior prediction performance. Chapter 21 deals with time series data via recurrent neural networks. Chapter 22 addresses the audio classification task via the spectrogram representation, which turns audio data into images so that existing image classification algorithms such as convolutional neural networks can be applied.

Part III. Chapter 23 provides an overview of the final part of the book–the functionality of torch beyond neural networks. Chapters 24 and 25 cover various matrix computation techniques including matrix decomposition and convolution. Chapters 26–28 conclude the book by introducing three signal transformation techniques, namely, the discrete Fourier transform, the fast Fourier transform, and the wavelet transform.

Yang Ni
Department of Statistics, Texas A&M University, College Station, TX
[email protected]

Reprints and Corporate Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

To request a reprint or corporate permissions for this article, please click on the relevant link below:

Academic Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

Obtain permissions instantly via Rightslink by clicking on the button below:

If you are unable to obtain permissions via Rightslink, please complete and submit this Permissions form. For more information, please visit our Permissions help page.