Mehta Et Al. - 2019 - A High-Bias, Low-Variance Introduction To Machine PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 116

A high-bias, low-variance introduction to Machine Learning for physicists

Pankaj Mehta, Ching-Hao Wang, Alexandre G. R. Day, and Clint Richardson


Department of Physics,
Boston University,
Boston, MA 02215,
USA∗

Marin Bukov
Department of Physics,
arXiv:1803.08823v3 [physics.comp-ph] 27 May 2019

University of California,
Berkeley, CA 94720,
USA†

Charles K. Fisher
Unlearn.AI, San Francisco,
CA 94108

David J. Schwab
Initiative for the Theoretical Sciences,
The Graduate Center,
City University of New York,
365 Fifth Ave., New York,
NY 10016

(Dated: May 29, 2019)

Machine Learning (ML) is one of the most exciting and dynamic areas of modern re-
search and application. The purpose of this review is to provide an introduction to the
core concepts and tools of machine learning in a manner easily understood and intuitive
to physicists. The review begins by covering fundamental concepts in ML and modern
statistics such as the bias-variance tradeoff, overfitting, regularization, generalization,
and gradient descent before moving on to more advanced topics in both supervised
and unsupervised learning. Topics covered in the review include ensemble models, deep
learning and neural networks, clustering and data visualization, energy-based models (in-
cluding MaxEnt models and Restricted Boltzmann Machines), and variational methods.
Throughout, we emphasize the many natural connections between ML and statistical
physics. A notable aspect of the review is the use of Python Jupyter notebooks to in-
troduce modern ML/statistical packages to readers using physics-inspired datasets (the
Ising Model and Monte-Carlo simulations of supersymmetric decays of proton-proton
collisions). We conclude with an extended outlook discussing possible uses of machine
learning for furthering our understanding of the physical world as well as open problems
in ML where physicists may be able to contribute.

CONTENTS B. Bias-Variance Decomposition 12

I. Introduction 3 IV. Gradient Descent and its Generalizations 13


A. What is Machine Learning? 3 A. Gradient Descent and Newton’s method 13
B. Why study Machine Learning? 4 B. Limitations of the simplest gradient descent
C. Scope and structure of the review 4 algorithm 15
C. Stochastic Gradient Descent (SGD) with
II. Why is Machine Learning difficult? 6 mini-batches 16
A. Setting up a problem in ML and data science 6 D. Adding Momentum 17
B. Polynomial Regression 6 E. Methods that use the second moment of the
gradient 17
III. Basics of Statistical Learning Theory 10 F. Comparison of various methods 18
A. Three simple schematics that summarize the basic G. Gradient descent in practice: practical tips 19
intuitions from Statistical Learning Theory 10
V. Overview of Bayesian Inference 19
A. Bayes Rule 20
B. Bayesian Decisions 20

C. Hyperparameters 20
[email protected]
[email protected] VI. Linear Regression 21
2

A. Least-square regression 21 3. Neural networks scale up well


B. Ridge-Regression 22 computationally 62
C. LASSO and Sparse Regression 23 C. Limitations of supervised learning with deep
D. Using Linear Regression to Learn the Ising networks 62
Hamiltonian 24
E. Convexity of regularizer 25 XII. Dimensional Reduction and Data Visualization 63
F. Bayesian formulation of linear regression 27 A. Some of the challenges of high-dimensional data 63
G. Recap and a general perspective on regularizers 28 B. Principal component analysis (PCA) 64
C. Multidimensional scaling 66
VII. Logistic Regression 29 D. t-SNE 66
A. The cross-entropy as a cost function for logistic
regression 29 XIII. Clustering 68
B. Minimizing the cross entropy 30 A. Practical clustering methods 69
C. Examples of binary classification 30 1. K-means 69
1. Identifying the phases of the 2D Ising model 30 2. Hierarchical clustering: Agglomerative
2. SUSY 32 methods 70
D. Softmax Regression 34 3. Density-based (DB) clustering 71
E. An Example of SoftMax Classification: MNIST B. Clustering and Latent Variables via the Gaussian
Digit Classification 34 Mixture Models 72
C. Clustering in high dimensions 74
VIII. Combining Models 35
A. Revisiting the Bias-Variance Tradeoff for XIV. Variational Methods and Mean-Field Theory
Ensembles 35 (MFT) 75
1. Bias-Variance Decomposition for Ensembles 35 A. Variational mean-field theory for the Ising
2. Summarizing the Theory and Intuitions behind model 76
Ensembles 38 B. Expectation Maximization (EM) 78
B. Bagging 39
C. Boosting 40 XV. Energy Based Models: Maximum Entropy (MaxEnt)
D. Random Forests 41 Principle, Generative models, and Boltzmann
E. Gradient Boosted Trees and XGBoost 42 Learning 80
F. Applications to the Ising model and A. An overview of energy-based generative models 80
Supersymmetry Datasets 44 B. Maximum entropy models: the simplest
energy-based generative models 81
IX. An Introduction to Feed-Forward Deep Neural 1. MaxEnt models in statistical mechanics 81
Networks (DNNs) 45 2. From statistical mechanics to machine
A. Neural Network Basics 46 learning 82
1. The basic building block: neurons 46 3. Generalized Ising Models from MaxEnt 83
2. Layering neurons to build deep networks:
C. Cost functions for training energy-based models 83
network architecture. 47
1. Maximum likelihood 84
B. Training deep networks 48
2. Regularization 84
C. The Backpropagation algorithm 49
D. Computing gradients 85
1. Deriving and implementing the
E. Summary of the training procedure 86
backpropagation equations 50
2. Computing gradients in deep networks: what
XVI. Deep Generative Models: Hidden Variables and
can go wrong with backprop? 51
Restricted Boltzmann Machines (RBMs) 86
D. Regularizing neural networks and other practical
A. Why hidden (latent) variables? 86
considerations 52
B. Restricted Boltzmann Machines (RBMs) 87
1. Implicit regularization using SGD:
C. Training RBMs 89
initialization, hyper-parameter tuning, and
1. Gibbs sampling and contrastive divergence
Early Stopping 52
(CD) 89
2. Dropout 52
2. Practical Considerations 90
3. Batch Normalization 52
D. Deep Boltzmann Machine 90
E. Deep neural networks in practice: examples 53
1. Deep learning packages 53 E. Generative models in practice: examples 91
2. Approaching the learning problem 54 1. MNIST 91
3. SUSY dataset 55 2. Example: 2D Ising Model 92
4. Phases of the 2D Ising model 55 F. Generative models in physics 92

X. Convolutional Neural Networks (CNNs) 56 XVII. Variational AutoEncoders (VAEs) and Generative
A. The structure of convolutional neural networks 56 Adversarial Networks (GANs) 94
B. Example: CNNs for the 2D Ising model 58 A. The limitations of maximizing Likelihood 94
C. Pre-trained CNNs and transfer learning 58 B. Generative models and adversarial learning 96
C. Variational Autoencoders (VAEs) 97
XI. High-level Concepts in Deep Neural Networks 60 1. VAEs as variational models 97
A. Organizing deep learning workflows using the 2. Training via the reparametrization trick 98
bias-variance tradeoff 60 3. Connection to the information bottleneck 99
B. Why neural networks are so successful: three D. VAE with Gaussian latent variables and Gaussian
high-level perspectives on neural networks 61 encoder 100
1. Neural networks as representation learning 61 1. Implementing the Gaussian VAE 100
2. Neural networks can exploit large amounts of 2. VAEs for the MNIST dataset 101
data 61 3. VAEs for the 2D Ising model 101
3

XVIII. Outlook 103 sity in Fall of 2016. As such, it assumes a level of familiar-
A. Research at the intersection of physics and ML 103 ity with several topics found in graduate physics curricula
B. Topics not covered in review 104
(partition functions, statistical mechanics) and a fluency
C. Rebranding Machine Learning as “Artificial
Intelligence” 105 in mathematical techniques such as linear algebra, multi-
D. Social Implications of Machine Learning 105 variate calculus, variational methods, probability theory,
and Monte-Carlo methods. It also assumes a familiar-
XIX. Acknowledgments 106
ity with basic computer programming and algorithmic
A. Overview of the Datasets used in the Review 106 design.
1. Ising dataset 106
2. SUSY dataset 106
3. MNIST Dataset 107 A. What is Machine Learning?
References 107
Most physicists learn the basics of classical statistics
early on in undergraduate laboratory courses. Classical
I. INTRODUCTION statistics is primarily concerned with how to use data
to estimate the value of an unknown quantity. For in-
Machine Learning (ML), data science, and statistics stance, estimating the speed of light using measurements
are fields that describe how to learn from, and make pre- obtained with an interferometer is one such example that
dictions about, data. The availability of big datasets is relies heavily on techniques from statistics.
a hallmark of modern science, including physics, where Machine Learning is a subfield of artificial intelligence
data analysis has become an important component of di- with the goal of developing algorithms capable of learning
verse areas, such as experimental particle physics, ob- from data automatically. In particular, an artificially in-
servational astronomy and cosmology, condensed matter telligent agent needs to be able to recognize objects in its
physics, biophysics, and quantum computing. Moreover, surroundings and predict the behavior of its environment
ML and data science are playing increasingly important in order to make informed choices. Therefore, techniques
roles in many aspects of modern technology, ranging from in ML tend to be more focused on prediction rather than
biotechnology to the engineering of self-driving cars and estimation. For example, how do we use data from the
smart devices. Therefore, having a thorough grasp of the interferometry experiment to predict what interference
concepts and tools used in ML is an important skill that pattern would be observed under a different experimental
is increasingly relevant in the physical sciences. setup? In addition, methods from ML tend to be applied
The purpose of this review is to serve as an introduc- to more complex high-dimensional problems than those
tion to foundational and state-of-the-art techniques in typically encountered in a classical statistics course.
ML and data science for physicists. The review seeks to Despite these differences, estimation and prediction
find a middle ground between a short overview and a full- problems can be cast into a common conceptual frame-
length textbook. While there exist many wonderful ML work. In both cases, we choose some observable quantity
textbooks (Abu-Mostafa et al., 2012; Bishop, 2006; Fried- x of the system we are studying (e.g., an interference pat-
man et al., 2001; Murphy, 2012), they are lengthy and use tern) that is related to some parameters θ (e.g., the speed
specialized language that is often unfamiliar to physicists. of light) of a model p(x|θ) that describes the probability
This review builds upon the considerable knowledge most of observing x given θ. Now, we perform an experiment
physicists already possess in statistical physics in order to obtain a dataset X and use these data to fit the model.
to introduce many of the major ideas and techniques Typically, “fitting” the model involves finding θ̂ that pro-
used in modern ML. We take a physics-inspired peda- vides the best explanation for the data. In the case when
gogical approach, emphasizing simple examples (e.g., re- “fitting” refers to the method of least squares, the esti-
gression and clustering), before delving into more ad- mated parameters maximize the probability of observ-
vanced topics. The intention of this review and the ing the data (i.e., θ̂ = argmaxθ {p(X|θ)}). Estimation
accompanying Jupyter notebooks (available at https: problems are concerned with the accuracy of θ̂, whereas
//physics.bu.edu/~pankajm/MLnotebooks.html) is to prediction problems are concerned with the ability of the
give the reader the requisite background knowledge to model to predict new observations (i.e., the accuracy of
follow and apply these techniques to their own areas of p(x|θ̂)). Although the goals of estimation and prediction
interest. are related, they often lead to different approaches. As
While this review is written with a physics background this review is aimed as an introduction to the concepts of
in mind, we aim for it to be useful to anyone with some ML, we will focus on prediction problems and refer the
background in statistical physics, and it is suitable for reader to one of many excellent textbooks on classical
both graduate students and researchers as well as ad- statistics for more information on estimation (Lehmann
vanced undergraduates. The review is based on an ad- and Casella, 2006; Lehmann and Romano, 2006; Wasser-
vanced topics graduate course taught at Boston Univer- man, 2013; Witte and Witte, 2013).
4

B. Why study Machine Learning? C. Scope and structure of the review

The last three decades have seen an unprecedented in- Any review on ML must simultaneously accomplish
crease in our ability to generate and analyze large data two related but distinct goals. First, it must convey the
sets. This “big data” revolution has been spurred by an rich theoretical foundations underlying modern ML. This
exponential increase in computing power and memory task is made especially difficult because ML is very broad
commonly known as Moore’s law. Computations that and interdisciplinary, drawing on ideas and intuitions
were unthinkable a few decades ago can now be routinely from many fields including statistics, computational neu-
performed on laptops. Specialized computing machines roscience, and physics. Unfortunately, this means mak-
(such as GPU-based machines) are continuing this trend ing choices about what theoretical ideas to include in the
towards cheap, large-scale computation, suggesting that review. This review emphasizes connections with sta-
the “big data” revolution is here to stay. tistical physics, physics-inspired Bayesian inference, and
This increase in our computational ability has been ac- computational neuroscience models. Thus, certain ideas
companied by new techniques for analyzing and learning (e.g., gradient descent, expectation maximization, varia-
from large datasets. These techniques draw heavily from tional methods, and deep learning and neural networks)
ideas in statistics, computational neuroscience, computer are covered extensively, while other important ideas are
science, and physics. Similar to physics, modern ML given less attention or even omitted entirely (e.g., statis-
places a premium on empirical results and intuition over tical learning, support vector machines, kernel methods,
the more formal treatments common in statistics, com- Gaussian processes). Second, any ML review must give
puter science, and mathematics. This is not to say that the reader the practical know-how to start using the tools
proofs are not important or undesirable. Rather, many and concepts of ML for practical problems. To accom-
of the advances of the last two decades – especially in plish this, we have written a series of Jupyter notebooks
fields like deep learning – do not have formal justifica- to accompany this review. These python notebooks in-
tions (much like there still exists no mathematically well- troduce the nuts-and-bolts of how to use, code, and im-
defined concept of the Feynman path-integral in d > 1). plement the methods introduced in the main text. Luck-
ily, there are numerous great ML software packages avail-
Physicists are uniquely situated to benefit from and able in Python (scikit-learn, tensorflow, Pytorch, Keras)
contribute to ML. Many of the core concepts and tech- and we have made extensive use of them. We have also
niques used in ML – such as Monte-Carlo methods, simu- made use of a new package, Paysage, for energy-based
lated annealing, variational methods – have their origins generative models which has been co-developed by one
in physics. Moreover, “energy-based models” inspired by of the authors (CKF) and maintained by Unlearn.AI (a
statistical physics are the backbone of many deep learn- company affiliated with two of the authors: CKF and
ing methods. For these reasons, there is much in modern PM). The purpose of the notebooks is to both familiarize
ML that will be familiar to physicists. physicists with these resources and to serve as a starting
Physicists and astronomers have also been at the fore- point for experimenting and playing with ideas.
front of using “big data”. For example, experiments such ML can be divided into three broad categories: super-
as CMS and ATLAS at the LHC generate petabytes of vised learning, unsupervised learning, and reinforcement
data per year. In astronomy, projects such as the Sloan learning. Supervised learning concerns learning from la-
Digital Sky Survey (SDSS) routinely analyze and release beled data (for example, a collection of pictures labeled
hundreds of terabytes of data measuring the properties of as containing a cat or not containing a cat). Common
nearly a billion stars and galaxies. Researchers in these supervised learning tasks include classification and re-
fields are increasingly incorporating recent advances in gression. Unsupervised learning is concerned with find-
ML and data science, and this trend is likely to acceler- ing patterns and structure in unlabeled data. Examples
ate in the future. of unsupervised learning include clustering, dimensional-
Besides applications to physics, part of the goal of this ity reduction, and generative modeling. Finally, in rein-
review is to serve as an introductory resource for those forcement learning an agent learns by interacting with an
looking to transition to more industry-oriented projects. environment and changing its behavior to maximize its
Physicists have already made many important contribu- reward. For example, a robot can be trained to navigate
tions to modern big data applications in an industrial in a complex environment by assigning a high reward to
setting (Metz, 2017). Data scientists and ML engineers actions that help the robot reach a desired destination.
in industry use concepts and tools developed for ML to We refer the interested reader to the classic book by Sut-
gain insight from large datasets. A familiarity with ML ton and Barto Reinforcement Learning: an Introduction
is a prerequisite for many of the most exciting employ- (Sutton and Barto, 1998). While useful, the distinction
ment opportunities in the field, and we hope this review between the three types of ML is sometimes fuzzy and
will serve as a useful introduction to ML for physicists fluid, and many applications often combine them in novel
beyond an academic setting. and interesting ways. For example, the recent success
5

of Google DeepMind in developing ML algorithms that MNIST dataset, on the other hand, introduces the fla-
excel at tasks such as playing Go and video games em- vor of present-day ML problems. By re-analyzing the
ploy deep reinforcement learning, combining reinforce- same datasets with multiple techniques, we hope readers
ment learning with supervised learning methods based will be able to get a sense of the various, inevitable trade-
on deep neural networks. offs involved in choosing how to analyze data. Certain
Here, we limit our focus to supervised and unsuper- techniques work better when data is limited while others
vised learning. The literature on reinforcement learning may be better suited to large data sets with many fea-
is extensive and uses ideas and concepts that, to a large tures. A short description of these datasets are given in
degree, are distinct from supervised and unsupervised the Appendix.
learning tasks. For this reason, to ensure cohesiveness This review draws generously on many wonderful text-
and limit the length of this review, we have chosen not books on ML and we encourage the reader to con-
to discuss reinforcement learning. However, this omis- sult them for further information. They include Abu
sion should not be mistaken for a value judgement on Mostafa’s masterful Learning from Data, which intro-
the utility of reinforcement learning for solving physical duces the basic concepts of statistical learning theory
problems. For example, some of the authors have used (Abu-Mostafa et al., 2012), the more advanced but
inspiration from reinforcement learning to tackle difficult equally good The Elements of Statistical Learning by
problems in quantum control (Bukov, 2018; Bukov et al., Hastie, Tibshirani, and Friedman (Friedman et al., 2001),
2018). Michael Nielsen’s indispensable Neural Networks and
In writing this review, we have tried to adopt a style Deep Learning which serves as a wonderful introduction
that reflects what we consider to be the best of the to the neural networks and deep learning (Nielsen, 2015)
physics tradition. Physicists understand the importance and David MacKay’s outstanding Information Theory,
of well-chosen examples for furthering our understand- Inference, and Learning Algorithms which introduced
ing. It is hard to imagine a graduate course in statistical Bayesian inference and information theory to a whole
physics without the Ising model. Each new concept that generation of physicists (MacKay, 2003). More com-
is introduced in statistical physics (mean-field theory, prehensive (and much longer) books on modern ML
transfer matrix techniques, high- and low-temperature techniques include Christopher Bishop’s classic Pattern
expansions, the renormalization group, etc.) is applied to Recognition and Machine Learning (Bishop, 2006) and
the Ising model. This allows for the progressive building the more recently published Machine Learning: A Prob-
of intuition and ultimately a coherent picture of statisti- abilistic Perspective by Kevin Murphy (Murphy, 2012).
cal physics. We have tried to replicate this pedagogical Finally, one of the great successes of modern ML is deep
approach in this review by focusing on a few well-chosen learning, and some of the pioneers of this field have writ-
techniques – linear and logistic regression in the case of ten a textbook for students and researchers entitled Deep
supervised learning and clustering in the case of unsu- Learning (Goodfellow et al., 2016). In addition to these
pervised learning – to introduce the major theoretical textbooks, we have consulted numerous research papers,
concepts. reviews, and web resources. Whenever possible, we have
In this same spirit, we have chosen three interest- tried to point the reader to key papers and other refer-
ing datasets with which to illustrate the various algo- ences that we have found useful in preparing this review.
rithms discussed here. (i) The SUSY data set consists However, we are neither capable of nor have we made any
of 5, 000, 000 Monte-Carlo samples of proton-proton col- effort to make a comprehensive review of the literature.
lisions decaying to either signal or background processes, The review is organized as follows. We begin by
which are both parametrized with 18 features. The sig- introducing polynomial regression as a simple example
nal process is the production of electrically-charged su- that highlights many of the core ideas of ML. The next
persymmetric particles, which decay to W bosons and an few chapters introduce the language and major concepts
electrically-neutral supersymmetric particle, invisible to needed to make these ideas more precise including tools
the detector, while the background processes are various from statistical learning theory such as overfitting, the
decays involving only Standard Model particles (Baldi bias-variance tradeoff, regularization, and the basics of
et al., 2014). (ii) The Ising data set consists of 104 Bayesian inference. The next chapter builds on these
states of the 2D Ising model on a 40 × 40 square lat- examples to discuss stochastic gradient descent and its
tice, obtained using Monte-Carlo (MC) sampling at a generalizations. We then apply these concepts to linear
few fixed temperatures T . (iii) The MNIST dataset com- and logistic regression, followed by a detour to discuss
prises 70000 handwritten digits, each of which comes in how we can combine multiple statistical techniques to
a square image, divided into a 28 × 28 pixel grid. The improve supervised learning, introducing bagging, boost-
first two datasets were chosen to reflect the various sub- ing, random forests, and XG Boost. These ideas, though
disciplines of physics (high-energy experiment, condensed fairly technical, lie at the root of many of the advances
matter) where we foresee techniques from ML becom- in ML over the last decade. The review continues with
ing an increasingly important tool for research. The a thorough discussion of supervised deep learning and
6

neural networks, as well as convolutional nets. We then on the training set is called the in-sample error Ein =
turn our focus to unsupervised learning. We start with C(ytrain , f (Xtrain ; θ)) and the value of the cost func-
data visualization and dimensionality reduction before tion on the test set is called the out-of-sample error
proceeding to a detailed treatment of clustering. Our Eout = C(ytest , f (Xtest ; θ)).
discussion of clustering naturally leads to an examina- One of the most important observations we can make
tion of variational methods and their close relationship is that the out-of-sample error is almost always greater
with mean-field theory. The review continues with a than the in-sample error, i.e. Eout ≥ Ein . We explore
discussion of deep unsupervised learning, focusing on this point further in Sec. VI and its accompanying note-
energy-based models, such as Restricted Boltzmann Ma- book. Splitting the data into mutually exclusive train-
chines (RBMs) and Deep Boltzmann Machines (DBMs). ing and test sets provides an unbiased estimate for the
Then we discuss two new and extremely popular model- predictive performance of the model – this is known as
ing frameworks for unsupervised learning, generative ad- cross-validation in the ML and statistics literature. In
versarial networks (GANs) and variational autoencoders many applications of classical statistics, we start with a
(VAEs). We conclude the review with an outlook and mathematical model that we assume to be true (e.g., we
discussion of promising research directions at the inter- may assume that Hooke’s law is true if we are observing
section physics and ML. a mass-spring system) and our goal is to estimate the
value of some unknown model parameters (e.g., we do
not know the value of the spring stiffness). Problems in
II. WHY IS MACHINE LEARNING DIFFICULT? ML, by contrast, typically involve inference about com-
plex systems where we do not know the exact form of the
A. Setting up a problem in ML and data science mathematical model that describes the system. There-
fore, it is not uncommon for ML researchers to have mul-
Many problems in ML and data science starts with tiple candidate models that need to be compared. This
the same ingredients. The first ingredient is the dataset comparison is usually done using Eout ; the model that
D = (X, y) where X is a matrix of independent variables minimizes this out-of-sample error is chosen as the best
and y is a vector of dependent variables. The second is model (i.e. model selection). Note that once we select
the model f (x; θ), which is a function f : x → y of the the best model on the basis of its performance on Eout ,
parameters θ. That is, f is a function used to predict an the real-world performance of the winning model should
output from a vector of input variables. The final ingre- be expected to be slightly worse because the test data
dient is the cost function C(y, f (X; θ)) that allows us to was now used in the fitting procedure.
judge how well the model performs on the observations y.
The model is fit by finding the value of θ that minimizes
the cost function. For example, one commonly used cost B. Polynomial Regression
function is the squared error. Minimizing the squared er-
ror cost function is known as the method of least squares, In the previous section, we mentioned that multiple
and is typically appropriate for experiments with Gaus- candidate models are typically compared using the out-
sian measurement errors. of-sample error Eout . It may be at first surprising that
ML researchers and data scientists follow a standard the model that has the lowest out-of-sample error Eout
recipe to obtain models that are useful for prediction usually does not have the lowest in-sample error Ein .
problems. We will see why this is necessary in the fol- Therefore, if our goal is to obtain a model that is use-
lowing sections, but it is useful to present the recipe up ful for prediction we may not want to choose the model
front to provide context. The first step in the analysis that provides the best explanation for the current obser-
is to randomly divide the dataset D into two mutually vations. At first glance, the observation that the model
exclusive groups Dtrain and Dtest called the training and providing the best explanation for the current dataset
test sets. The fact that this must be the first step should probably will not provide the best explanation for future
be heavily emphasized – performing some analysis (such datasets is very counter-intuitive.
as using the data to select important variables) before Moreover, the discrepancy between Ein and Eout be-
partitioning the data is a common pitfall that can lead to comes more and more important, as the complexity of our
incorrect conclusions. Typically, the majority of the data data, and the models we use to make predictions, grows.
are partitioned into the training set (e.g., 90%) with the As the number of parameters in the model increases,
remainder going into the test set. The model is fit by min- we are forced to work in high-dimensional spaces. The
imizing the cost function using only the data in the train- “curse of dimensionality” ensures that many phenomena
ing set θ̂ = arg minθ {C(ytrain , f (Xtrain ; θ))}. Finally, that are absent or rare in low-dimensional spaces become
the performance of the model is evaluated by computing generic. For example, the nature of distance changes in
the cost function using the test set C(ytest , f (Xtest ; θ̂)). high dimensions, as evidenced in the derivation of the
The value of the cost function for the best fit model Maxwell distribution in statistical physics where the fact
7

Ntrain =10, σ =0 (train) Ntest =20, σ =0 (pred.)


2.5
4 test
2.0 linear
2 3rd order
1.5
10th order
0
y

y
Training 1.0
−2 Linear
Poly 3 0.5
−4 Poly 10
0.0
0.0 0.2 0.4 0.6 0.8 1.0 0.00 0.25 0.50 0.75 1.00 1.25
x x

Ntrain =10, σ =0 (train) Ntest =20, σ =0 (pred.)

4 Test
60 linear
2 3rd order
40 10th order
0
y

Training
−2 Linear 20
Poly 3
−4 Poly 10
0
0.0 0.2 0.4 0.6 0.8 1.0 0.00 0.25 0.50 0.75 1.00 1.25
x x

FIG. 1 Fitting versus predicting for noiseless data. Ntrain = 10 points in the range x ∈ [0, 1] were generated from a
linear model (top) or tenth-order polynomial (bottom). This data was fit using three model classes: linear models (red), all
polynomials of order 3 (yellow), all polynomials of order 10 (green) and used to make prediction on Ntest = 20 new data points
with xtest ∈ [0, 1.2] (shown on right). Notice that in the absence of noise (σ = 0), given enough data points that fitting and
predicting are identical.

that all the volume of a d-dimensional sphere of radius we have, the “noise” in the data generation process, and
r is contained in a small spherical shell around r is ex- our prior knowledge about the system. The goal is to
ploited. Almost all critical points of a function (i.e., the build intuition about why prediction is difficult in prepa-
points where all derivatives vanish) are saddles rather ration for introducing general strategies that overcome
than maxima or minima (an observation first made in these difficulties.
physics in the context of the p-spin spherical spin glass). Before reading the rest of the section, we strongly en-
For all these reasons, it turns out that for complicated courage the reader to read Notebook 1 and complete the
models studied in ML, predicting and fitting are very accompanying exercises.
different things (Bickel et al., 2006). Consider a probabilistic process that assigns a label yi
To develop some intuition about why we need to pay to an observation xi . The data are generated by drawing
close attention to out-of-sample performance, we will samples from the equation
consider a simple one-dimensional problem – polynomial yi = f (xi ) + ηi , (1)
regression. Our task is a simple one, fitting data with
polynomials of different order. We will explore how our where f (xi ) is some fixed (but possibly unknown) func-
ability to predict depends on the number of data points tion, and ηi is a Gaussian, uncorrelated noise variable,
8

Ntrain =100, σ =1 (train) Ntest =20, σ =1 (pred.)


20
4 Test
15
linear
2 10 3rd order
10th order
0 5
y

y
Training
−2 Linear 0
Poly 3
−5
−4 Poly 10
−10
0.0 0.2 0.4 0.6 0.8 1.0 0.00 0.25 0.50 0.75 1.00 1.25
x x

Ntrain =100, σ =1 (train) Ntest =20, σ =1 (pred.)


20
4 Test
15
linear
2 10 3rd order
10th order
0 5
y

Training
−2 Linear 0
Poly 3
−5
−4 Poly 10
−10
0.0 0.2 0.4 0.6 0.8 1.0 0.00 0.25 0.50 0.75 1.00 1.25
x x

FIG. 2 Fitting versus predicting for noisy data. Ntrain = 100 noisy data points (σ = 1) in the range x ∈ [0, 1] were
generated from a linear model (top) or tenth-order polynomial (bottom). This data was fit using three model classes: linear
models (red), all polynomials of order 3 (yellow), all polynomials of order 10 (green) and used to make prediction on Ntest = 20
new data points with xtest ∈ [0, 1.2](shown on right). Notice that even when the data was generated using a tenth order
polynomial, the linear and third order polynomials give better out-of-sample predictions, especially beyond the x range over
which the model was trained.

such that we will consider three different model classes: (i) all poly-
nomials of order 1 which we denote by f1 (x; θ1 ), (ii) all
hηi i = 0, polynomials up to order 3 which we denote by f3 (x; θ3 ),
hηi ηj i = δij σ 2 . and (iii) all polynomials of order 10, f10 (x; θ10 ). Notice
that these three model classes contain different number
We will refer to the f (xi ) as the function used to generate of parameters. Whereas f1 (x; θ1 ) has only two parame-
the data, and σ as the noise strength. The larger σ is the ters (the coefficients of the zeroth and first order terms
noisier the data; σ = 0 corresponds to the noiseless case. in the polynomial), f3 (x; θ3 ) and f10 (x; θ10 ) have four
To make predictions, we will consider a family of func- and eleven parameters, respectively. This reflects the
tions fα (x; θα ) that depend on some parameters θα . fact that these three models have different model com-
These functions represent the model class that we are us- plexities. If we think of each term in the polynomial as a
ing to model the data and make predictions. Note that “feature” in our model, then increasing the order of the
we choose the model class without knowing the function polynomial we fit increases the number of features. Using
f (x). The fα (x; θα ) encode the features we choose to a more complex model class may give us better predic-
represent the data. In the case of polynomial regression
9

tive power, but only if we have a large enough sample noise encodes real information. This problem is called
size to accurately learn the model parameters associated “overfitting” and leads to a steep drop-off in predictive
with these extra features from the training dataset. performance.
To learn the parameters θα , we will train our models We can guard against overfitting in two ways: we can
on a training dataset and then test the effectiveness of use less expressive models with fewer parameters, or we
the model on a different dataset, the test dataset. Since can collect more data so that the likelihood that the noise
we are interested only in gaining intuition, we will simply appears patterned decreases. Indeed, when we increase
plot the fitted polynomials and compare the predictions the size of the training data set by two orders of mag-
of our fits for the test data with the true values. As we nitude to Ntrain = 104 (see Figure 3) the tenth order
will see below, the models that give the best fit to existing polynomial clearly gives both the best fits and the most
data do not necessarily make the best predictions even predictive power over the entire training range x ∈ [0, 1],
for a simple task like polynomial regression. and even slightly beyond to approximately x ≈ 1.05.
To illustrate these ideas, we encourage the reader to This is our first experience with what is known as the
experiment with the accompanying notebook to gener- bias-variance tradeoff, c.f. Sec. III.B. When the amount
ate data using a linear function f (x) = 2x and a tenth of training data is limited as it is when Ntrain = 100,
order polynomial f (x) = 2x − 10x5 + 15x10 and ask one can often get better predictive performance by using
how the size of the training dataset Ntrain and the noise a less expressive model (e.g., a lower order polynomial)
strength σ affect the ability to make predictions. Obvi- rather than the more complex model (e.g., the tenth-
ously, more data and less noise leads to better predic- order polynomial). The simpler model has more “bias”
tions. To train the models (linear, third-order, tenth- but is less dependent on the particular realization of the
order), we uniformly sampled the interval x ∈ [0, 1] and training dataset, i.e. less “variance”. Finally we note that
constructed Ntrain training examples using (1). We then even with ten thousand data points, the model’s perfor-
fit the models on these training samples using standard mance quickly degrades beyond the original training data
least-squares regression. To visualize the performance of range. This demonstrates the difficulty of predicting be-
the three models, we plot the predictions using the best yond the training data we mentioned earlier.
fit parameters for a test set where x are drawn uniformly This simple example highlights why ML is so difficult
from the interval x ∈ [0, 1.2]. Notice that the test interval and holds some universal lessons that we will encounter
is slightly larger than the training interval. repeatedly in this review:
Figure 1 shows the results of this procedure for the
noiseless case, σ = 0. Even using a small training set • Fitting is not predicting. Fitting existing data well
with Ntrain = 10 examples, we find that the model class is fundamentally different from making predictions
that generated the data also provides the best fit and the about new data.
most accurate out-of-sample predictions. That is, the
linear model performs the best for data generated from a
• Using a complex model can result in overfitting. In-
linear polynomial (the third and tenth order polynomials
creasing a model’s complexity (i.e number of fitting
perform similarly), and the tenth order model performs
parameters) will usually yield better results on the
the best for data generated from a tenth order polyno-
training data. However when the training data size
mial. While this may be expected, the results are quite
is small and the data are noisy, this results in over-
different for larger noise strengths.
fitting and can substantially degrade the predictive
Figure 2 shows the results of the same procedure for
performance of the model.
noisy data, σ = 1, and a larger training set, Ntrain = 100.
As in the noiseless case, the tenth order model provides
the best fit to the data (i.e., the lowest Ein ). In contrast, • For complex datasets and small training sets, sim-
the tenth order model now makes the worst out-of-sample ple models can be better at prediction than com-
predictions (i.e., the highest Eout ). Remarkably, this is plex models due to the bias-variance tradeoff. It
true even if the data were generated using a tenth order takes less data to train a simple model than a com-
polynomial. plex one. Therefore, even though the correct model
At small sample sizes, noise can create fluctuations in is guaranteed to have better predictive performance
the data that look like genuine patterns. Simple mod- for an infinite amount of training data (less bias),
els (like a linear function) cannot represent complicated the training errors stemming from finite-size sam-
patterns in the data, so they are forced to ignore the pling (variance) can cause simpler models to out-
fluctuations and to focus on the larger trends. Complex perform the more complex model when sampling is
models with many parameters, such as the tenth order limited.
polynomial in our example, can capture both the global
trends and noise-generated patterns at the same time. In • It is difficult to generalize beyond the situations
this case, the model can be tricked into thinking that the encountered in the training data set.
10

Ntrain =10000, σ =1 (train) Ntest =100, σ =1 (pred.)


20
4 Test
15
linear
2 10 3rd order
10th order
0 5
y

y
Training
−2 Linear 0
Poly 3
−5
−4 Poly 10
−10
0.0 0.2 0.4 0.6 0.8 1.0 0.00 0.25 0.50 0.75 1.00 1.25
x x

FIG. 3 Fitting versus predicting for noisy data. Ntrain = 104 noisy data points (σ = 1) in the range x ∈ [0, 1] were
generated from a tenth-order polynomial. This data was fit using three model classes: linear models (red), all polynomials
of order 3 (yellow), all polynomials of order 10 (green) and used to make prediction on Ntest = 100 new data points with
xtest ∈ [0, 1.2](shown on right). The tenth order polynomial gives good predictions but the model’s predictive power quickly
degrades beyond the training data range.

III. BASICS OF STATISTICAL LEARNING THEORY general about the relationship between Ein and Eout ?
Surprisingly, the answer is ‘Yes’. We can in fact say
In this section, we briefly summarize and discuss the quite a bit. This is the domain of statistical learning
sense in which learning is possible, with a focus on su- theory, and we give a brief overview of the main results
pervised learning. We begin with an unknown function in this section. Our goal is to briefly introduce some of
y = f (x) and fix a hypothesis set H consisting of all func- the major ideas from statistical learning theory because
tions we are willing to consider, defined also on the do- of the important role they have played in shaping how we
main of f . This set may be uncountably infinite (e.g. if think about machine learning. However, this is a highly
there are real-valued parameters to fit). The choice of technical and theoretical field, so we will just skim over
which functions to include in H usually depends on our some introductory topics. A more thorough introduction
intuition about the problem of interest. The function to statistical learning theory can be found in the intro-
f (x) produces a set of pairs (xi , yi ), i = 1 . . . N , which ductory textbook by Abu Mostafa (Abu-Mostafa et al.,
serve as the observable data. Our goal is to select a func- 2012).
tion from the hypothesis set h ∈ H that approximates
f (x) as best as possible, namely, we would like to find
h ∈ H such that h ≈ f in some strict mathematical A. Three simple schematics that summarize the basic
sense which we specify below. If this is possible, we say intuitions from Statistical Learning Theory
that we learned f (x). But if the function f (x) can, in
principle, take any value on unobserved inputs, how is it The basic intuitions of statistical learning can be sum-
possible to learn in any meaningful sense? marized in three simple schematics. The first schematic,
The answer is that learning is possible in the restricted shown in Figure 4, shows the typical out-of-sample er-
sense that the fitted model will probably perform approx- ror, Eout , and in-sample error, Ein , as a function of the
imately as well on new data as it did on the training data. amount of training data. In making this graph, we have
Once an appropriate error function E is chosen for the assumed that the true data is drawn from a sufficiently
problem under consideration (e.g. sum of squared errors complicated distribution, so that we cannot exactly learn
in linear regression), we can define two distinct perfor- the function f (x). Hence, after a quick initial drop (not
mance measures of interest. The in-sample error, Ein , shown in figure), the in-sample error will increase with
and the out-of-sample or generalization error, Eout . Re- the number of data points, because our models are not
call from Sec II that both metrics are required due to the powerful enough to learn the true function we are seeking
distinction between fitting and predicting. to approximate. In contrast, the out-of-sample error will
This raises a natural question: Can we say something decrease with the number of data points. As the number
11

Optimum
E out
E out

Error
{
Variance
Variance

}
}
Error

Bias

Bias Model Complexity

E in
FIG. 5 Bias-Variance tradeoff and model complexity.
This schematic shows the typical out-of-sample error Eout as
function of the model complexity for a training dataset of fixed
Number of data points size. Notice how the bias always decreases with model com-
plexity, but the variance, i.e. fluctuation in performance due
FIG. 4 Schematic of typical in-sample and out-of- to finite size sampling effects, increases with model complex-
sample error as a function of training set size. The ity. Thus, optimal performance is achieved at intermediate
typical in-sample or training error, Ein , out-of-sample or gen- levels of model complexity.
eralization error, Eout , bias, variance, and difference of errors
as a function of the number of training data points. The
schematic assumes that the number of data points is large (in
fitting and predicting. Models with a large difference be-
particular, the schematic does not show the initial drop in
Ein for small amounts of data), and that our model cannot tween the in-sample and out-of-sample errors are said to
exactly fit the true function f (x). “overfit” the data. One of the lessons of statistical learn-
ing theory is that it is not enough to simply minimize
the training error, because the out-of-sample error can
of data points gets large, the sampling noise decreases still be large. As we will see in our discussion of regres-
and the training data set becomes more representative sion in Sec. VI, this insight naturally leads to the idea of
of the true distribution from which the data is drawn. “regularization”.
For this reason, in the infinite data limit, the in-sample The second schematic, shown in Figure 5, shows the
and out-of-sample errors must approach the same value, out-of-sample, or test, error Eout as a function of “model
which is called the “bias” of our model. complexity”. Model complexity is a very subtle idea
The bias represents the best our model could do if we and defining it precisely is one of the great achieve-
had an infinite amount of training data to beat down ments of statistical learning theory. In many cases, model
sampling noise. The bias is a property of the kind of complexity is related to the number of parameters we
functions, or model class, we are using to approximate are using to approximate the true function f (x)1 . In
f (x). In general, the more complex the model class we the example of polynomial regression discussed above,
use, the smaller the bias. However, we do not generally higher-order polynomials are more complex than the lin-
have an infinite amount of data. For this reason, to get ear model. If we consider a training dataset of a fixed
best predictive power it is better to minimize the out-of- size, Eout will be a non-monotonic function of the model
sample error, Eout , rather than the bias. As shown in complexity, and is generally minimized for models with
Figure 4, Eout can be naturally decomposed into a bias, intermediate complexity. The underlying reason for this
which measures how well we can hypothetically do in the is that, even though using a more complicated model
infinite data limit, and a variance, which measures the always reduces the bias, at some point the model be-
typical errors introduced in training our model due to comes too complex for the amount of training data and
sampling noise from having a finite training set. the generalization error becomes large due to high vari-
The final quantity shown in Figure 4 is the difference ance. Thus, to minimize Eout and maximize our predic-
between the generalization and training error. It mea- tive power, it may be more suitable to use a more bi-
sures how well our in-sample error reflects the out-of-
sample error, and measures how much worse we would
do on a new data set compared to our training data. For 1 There are, of course, exceptions. One neat example in the context
this reason, the difference between these errors is pre- of one-dimensional regression in given in (Friedman et al., 2001),
cisely the quantity that measures the difference between Figure 7.5.
12

favorable to use a less complex, high-bias model to make


predictions.
High variance, x x x x
low-bias model x x x x
x B. Bias-Variance Decomposition
x x x True model
x x x x
x x x x x In this section, we dig further into the central prin-
x x x x x ciple that underlies much of machine learning: the bias-
x x xx x x variance tradeoff. We will discuss the bias-variance trade-
x x x
x x x off in the context of continuous predictions such as regres-
x Low variance, sion. However, many of the intuitions and ideas discussed
xx x x x x high-bias model here also carry over to classification tasks. Consider a
dataset D = (X, y) consisting of the N pairs of indepen-
dent and dependent variables. Let us assume that the
true data is generated from a noisy model
FIG. 6 Bias-Variance tradeoff. Another useful depiction
of the bias-variance tradeoff is to think about how Eout varies y = f (x) +  (2)
as we consider different training data sets of a fixed size. A
more complex model (green) will exhibit larger fluctuations where  is normally distributed with mean zero and stan-
(variance) due to finite size sampling effects than the sim- dard deviation σ .
pler model (black). However, the average over all the trained
Assume that we have a statistical procedure (e.g. least-
models (bias) is closer to the true model for the more complex
model. squares regression) for forming a predictor f (x; θ̂) that
gives the prediction of our model for a new data point x.
This estimator is chosen by minimizing a cost function
ased model with small variance than a less-biased model which we take to be the squared error
with large variance. This important concept is commonly
called the bias-variance tradeoff and gets at the heart of
X
C(y, f (X; θ)) = (yi − f (xi ; θ))2 . (3)
why machine learning is difficult. i
Another way to visualize the bias-variance tradeoff is
shown in Figure 6. In this figure, we imagine training Therefore, the estimates for the parameters,
a complex model (shown in green) and a simpler model
(shown in black) many times on different training sets θ̂D = arg min C(y, f (X; θ)). (4)
θ
of a fixed size N . Due to the sampling noise from hav-
ing finite size data sets, the learned models will differ for are a function of the dataset, D. We would obtain a
each choice of training sets. In general, more complex different error C(yj , f (Xj ; θ̂Dj )) for each dataset Dj =
models need a larger amount of training data. For this (yj , Xj ) in a universe of possible datasets obtained by
reason, the fluctuations in the learned models (variance) drawing N samples from the true data distribution. We
will be much larger for the more complex model than the denote an expectation value over all of these datasets as
simpler model. However, if we consider the asymptotic ED .
performance as we increase the size of the training set We would also like to average over different instances
(the bias), it is clear that the complex model will even- of the “noise”  and we denote the expectation value over
tually perform better than the simpler model. Thus, de- the noise by E . Thus, we can decompose the expected
pending on the amount of training data, it may be more generalization error as

" #
X
2
ED, [C(y, f (X; θ̂D ))] = ED, (yi − f (xi ; θ̂D ))
i
" #
X
= ED, (yi − f (xi ) + f (xi ) − f (xi ; θ̂D ))2
i
X
= E [(yi − f (xi ))2 ] + ED, [(f (xi ) − f (xi ; θ̂D ))2 ] + 2E [yi − f (xi )]ED [f (xi ) − f (xi ; θ̂D )]
i
X
= σ2 + ED [(f (xi ) − f (xi ; θ̂D ))2 ], (5)
i

where in the last line we used the fact that our noise has zero mean and variance σ2 and the sum over i applies to all
13

terms. It is also helpful to further decompose the second term as follows:


ED [(f (xi ) − f (xi ; θ̂D ))2 ] = ED [{f (xi ) − ED [f (xi ; θ̂D )] + ED [f (xi ; θ̂D )] − f (xi ; θ̂D )}2 ]
= ED [{f (xi ) − ED [f (xi ; θ̂D )]}2 ] + ED [{f (xi ; θ̂D ) − ED [f (xi ; θ̂D )]}2 ]
+2ED [{f (xi ) − ED [f (xi ; θ̂D )]}{f (xi ; θ̂D ) − ED [f (xi ; θ̂D )]}]
= (f (xi ) − ED [f (xi ; θ̂D )])2 + ED [{f (xi ; θ̂D ) − ED [f (xi ; θ̂D )]}2 ]. (6)

The first term is called the bias However, in practice gradient descent is full of surprises
X and a series of ingenious tricks have been developed by
Bias2 = (f (xi ) − ED [f (xi ; θ̂D )])2 (7) the optimization and machine learning communities to
i
improve the performance of these algorithms.
and measures the deviation of the expectation value of The underlying reason why training a machine learn-
our estimator (i.e. the asymptotic value of our estimator ing algorithm is difficult is that the cost functions we
in the infinite data limit) from the true value. The second wish to optimize are usually complicated, rugged, non-
term is called the variance convex functions in a high-dimensional space with many
X local minima. To make things even more difficult, we
V ar = ED [(f (xi ; θ̂D ) − ED [f (xi ; θ̂D )])2 ], (8) almost never have access to the true function we wish
i
to minimize: instead, we must estimate this function di-
and measures how much our estimator fluctuates due rectly from data. In modern applications, both the size
to finite-sample effects. Combining these expressions, of the dataset and the number of parameters we wish to
we see that the expected out-of-sample error, Eout := fit is often enormous (millions of parameters and exam-
ED, [C(y, f (X; θ̂D ))], can be decomposed as ples). The goal of this chapter is to explain how gradient
descent methods can be used to train machine learning
Eout = Bias2 + V ar + N oise, (9) algorithms even in these difficult settings.
with N oise = i σ .
P 2 This chapter seeks to both introduce commonly used
The bias-variance tradeoff summarizes the fundamen- methods and give intuition for why they work. We
tal tension in machine learning, particularly supervised also include some practical tips for improving the per-
learning, between the complexity of a model and the formance of stochastic gradient descent (Bottou, 2012;
amount of training data needed to train it. Since data LeCun et al., 1998b). To help the reader gain more in-
is often limited, in practice it is often useful to use a tuition about gradient descent and its variants, we have
less-complex model with higher bias – a model whose developed a Jupyter notebook that allows the reader to
asymptotic performance is worse than another model – visualize how these algorithms perform on two dimen-
because it is easier to train and less sensitive to sampling sional surfaces. The reader is encouraged to experi-
noise arising from having a finite-sized training dataset ment with the accompanying notebook whenever a new
(smaller variance). This is the basic intuition behind the method is introduced (especially to explore how changing
schematics in Figs. 4, 5, and 6. hyper-parameters can affect performance). The reader
may also wish to consult useful reviews that cover these
topics (Ruder, 2016) and this blog http://ruder.io/
IV. GRADIENT DESCENT AND ITS GENERALIZATIONS optimizing-gradient-descent/.

Almost every problem in ML and data science starts


with the same ingredients: a dataset X, a model g(θ), A. Gradient Descent and Newton’s method
which is a function of the parameters θ, and a cost func-
tion C(X, g(θ)) that allows us to judge how well the We begin by introducing a simple first-order gradient
model g(θ) explains the observations X. The model is fit descent method and comparing and contrasting it with
by finding the values of θ that minimize the cost function. another algorithm, Newton’s method. Newton’s method
In this section, we discuss one of the most powerful is intimately related to many algorithms (conjugate gra-
and widely used classes of methods for performing this dient, quasi-Newton methods) commonly used in physics
minimization – gradient descent and its generalizations. for optimization problems. Denote the function we wish
The basic idea behind these methods is straightforward: to minimize by E(θ).
iteratively adjust the parametersθ in the direction where In the context of machine learning, E(θ) is just the
the gradient of the cost function is large and negative. cost function E(θ) = C(X, g(θ)). As we shall see for
In this way, the training procedure ensures the parame- linear and logistic regression in Secs. VI, VII, this energy
ters flow towards a local minimum of the cost function. function can almost always be written as a sum over n
14

with Newton’s method which is the inspiration for many


5.0
widely employed optimization methods. In Newton’s
2.5 method, we choose the step v for the parameters in such
a way as to minimize a second-order Taylor expansion to
0.0 the energy function
y

η =0.1
η =0.5 1
−2.5
η =1 E(θ + v) ≈ E(θ) + ∇θ E(θ)v + vT H(θ)v,
2
η =1.01
−5.0 where H(θ) is the Hessian matrix of second derivatives.
−4 −2 0 2 4 Differentiating this equation respect to v and noting that
x for the optimal value vopt we expect ∇θ E(θ + vopt ) = 0,
yields the following equation
FIG. 7 Gradient descent exhibits three qualitatively
different regimes as a function of the learning rate. 0 = ∇θ E(θ) + H(θ)vopt . (12)
Result of gradient descent on surface z = x2 + y 2 − 1 for
learning rate of η = 0.1, 0.5, 1.01. Notice that the trajectory Rearranging this expression results in the desired update
converges to the global minima in multiple steps for small
rules for Newton’s method
learning rates (η = 0.1). Increasing the learning rate fur-
ther (η = 0.5) causes the trajectory to oscillate around the vt = H −1 (θt )∇θ E(θt ) (13)
global minima before converging. For even larger learning
rates (η = 1.01) the trajectory diverges from the minima. See θt+1 = θt − vt . (14)
corresponding notebook for details.
Since we have no guarantee that the Hessian is well con-
ditioned, in almost all applications of Netwon’s method,
data points, one replaces the inverse of the Hessian H −1 (θt ) by some
suitably regularized pseudo-inverse such as [H(θt )+I]−1
n
X with  a small parameter (Battiti, 1992).
E(θ) = ei (xi , θ). (10) For the purposes of machine learning, Newton’s
i=1 method is not practical for two interrelated reasons.
For example, for linear regression ei is just the mean First, calculating a Hessian is an extremely expensive
square-error for data point i; for logistic regression, it is numerical computation. Second, even if we employ first-
the cross-entropy. To make analogy with physical sys- order approximation methods to approximate the Hes-
tems, we will often refer to this function as the “energy”. sian (commonly called quasi-Newton methods), we must
In the simplest gradient descent (GD) algorithm, we store and invert a matrix with n2 entries, where n is the
update the parameters as follows. Initialize the parame- number of parameters. For models with millions of pa-
ters to some value θ0 and iteratively update the param- rameters such as those commonly employed in the neu-
eters according to the equation ral network literature, this is close to impossible with
present-day computational power. Despite these practi-
vt = ηt ∇θ E(θt ), cal shortcomings, Newton’s method gives many impor-
θt+1 = θt − vt (11) tant intuitions about how to modify GD algorithms to
improve their performance. Notice that, unlike in GD
where ∇θ E(θ) is the gradient of E(θ) w.r.t. θ and we where the learning rate is the same for all parameters,
have introduced a learning rate, ηt , that controls how big Newton’s method automatically “adapts” the learning
a step we should take in the direction of the gradient at rate of different parameters depending on the Hessian
time step t. It is clear that for sufficiently small choice of matrix. Since the Hessian encodes the curvature of the
the learning rate ηt this methods will converge to a local surface we are trying to find the minimum of – more
minimum (in all directions) of the cost function. How- specifically, the singular values of the Hessian are in-
ever, choosing a small ηt comes at a huge computational versely proportional to the squares of the local curvatures
cost. The smaller ηt , the more steps we have to take to of the surface – Newton’s method automatically adjusts
reach the local minimum. In contrast, if ηt is too large, the step size so that one takes larger steps in flat di-
we can overshoot the minimum and the algorithm be- rections with small curvature and smaller steps in steep
comes unstable (it either oscillates or even moves away directions with large curvature.
from the minimum). This is shown in Figure 7. In prac- Our derivation of Newton’s method also allows us to
tice, one usually specifies a “schedule” that decreases ηt develop intuition about the role of the learning rate in
at long times. Common schedules include power law and GD. Let us first consider the special case of using GD
exponential decay in time. to find the minimum of a quadratic energy function of
To better understand this behavior and highlight some a single parameter θ (LeCun et al., 1998b). Given the
of the shortcomings of GD, it is useful to contrast GD current value of our parameter θ, we can ask what is
15

A E(θ) B E(θ) can always perform a singular value decomposition (i.e.


a rotation by an orthogonal matrix for quadratic minima
η<ηopt η=ηopt
where the Hessian is symmetric, see Sec. VI.B for a brief
introduction to SVD) and consider the singular values
{λ} of the Hessian. If we use a single learning rate for all
parameters, in analogy with (17), convergence requires
that
θ θ
θmin 2
θmin D
η< , (18)
C E(θ) E(θ) λmax
η>ηopt η>2ηopt
where λmax is the largest singular value of the Hessian.
If the minimum eigenvalue λmin differs significantly from
the largest value λmax , then convergence in the λmin -
direction will be extremely slow! One can actually show
that the convergence time scales with the condition num-
θ θ ber κ = λmax /λmin (LeCun et al., 1998b).
θmin θmin
FIG. 8 Effect of learning rate on convergence. For a B. Limitations of the simplest gradient descent algorithm
one dimensional quadratic potential, one can show that there
exists four different qualitative behaviors for gradient descent
(GD) as a function of the learning rate η depending on the The last section hints at some of the major shortcom-
relationship between η and ηopt = [∂θ2 E(θ)]−1 . (a) For η < ings of the simple GD algorithm described in (11). Before
ηopt , GD converges to the minimum. (b) For η = ηopt , GD proceeding, we briefly summarize these limitations and
converges in a single step. (c) For ηopt < η < 2ηopt , GD discuss general strategies for modifying GD to overcome
oscillates around the minima and eventually converges. (d) these deficiencies.
For η > 2ηopt , GD moves away from the minima. This figure
is adapted from (LeCun et al., 1998b). • GD finds local minima of the cost function. Since
the GD algorithm is deterministic, if it converges,
it will converge to a local minimum of our energy
the optimal choice of the learning rate ηopt , where ηopt
function. Because in ML we are often dealing with
is defined as the value of η that allows us to reach the
extremely rugged landscapes with many local min-
minimum of the quadratic energy function in a single
ima, this can lead to poor performance. A similar
step (see Figure 8). To find ηopt , we expand the energy
problem is encountered in physics. To overcome
function to second order around the current value
this, physicists often use methods like simulated
1 annealing that introduce a fictitious “temperature”
E(θ + v) = E(θc ) + ∂θ E(θ)v + ∂θ2 E(θ)v 2 . (15)
2 which is eventually taken to zero. The “tempera-
Differentiating with respect to v and setting θmin = θ − v ture” term introduces stochasticity in the form of
yields thermal fluctuations that allow the algorithm to
thermally tunnel over energy barriers. This sug-
θmin = θ − [∂θ2 E(θ)]−1 ∂θ E(θ). (16) gests that, in the context of ML, we should modify
GD to include stochasticity.
Comparing with (11) gives,
ηopt = [∂θ2 E(θ)]−1 . (17) • Gradients are computationally expensive to calcu-
late for large datasets. In many cases in statistics
One can show that there are four qualitatively different and ML, the energy function is a sum of terms,
regimes possible (see Fig. 8) (LeCun et al., 1998b). If with one term for each P data point. For example, in
n
η < ηopt , then GD will take multiple small steps to reach linear regression, E ∝ i=1 (yi − wT · xi )2 ; for lo-
the bottom of the potential. For η = ηopt , GD reaches gistic regression, the square error is replaced by the
the bottom of the potential in a single step. If ηopt < cross entropy, see Secs. VI, VII. Thus, to calculate
η < 2ηopt , then the GD algorithm will oscillate across the gradient we have to sum over all n data points.
both sides of the potential before eventually converging to Doing this at every GD step becomes extremely
the minimum. However, when η > 2ηopt , the algorithm computationally expensive. An ingenious solution
actually diverges! to this, discussed below, is to calculate the gra-
It is straightforward to generalize this to the multidi- dients using small subsets of the data called “mini
mensional case. The natural multidimensional general- batches”. This has the added benefit of introducing
ization of the second derivative is the Hessian H(θ). We stochasticity into our algorithm.
16

• GD is very sensitive to choices of the learning rates. really experiment with different methods in landscapes
As discussed above, GD is extremely sensitive to of varying complexity using the accompanying notebook.
the choice of learning rates. If the learning rate is
very small, the training process takes an extremely
long time. For larger learning rates, GD can di- C. Stochastic Gradient Descent (SGD) with mini-batches
verge and give poor results. Furthermore, depend-
ing on what the local landscape looks like, we have One of the most widely-applied variants of the gra-
to modify the learning rates to ensure convergence. dient descent algorithm is stochastic gradient descent
Ideally, we would “adaptively” choose the learning (SGD)(Bottou, 2012; Williams and Hinton, 1986). As
rates to match the landscape. the name suggests, unlike ordinary GD, the algorithm
is stochastic. Stochasticity is incorporated by approx-
• GD treats all directions in parameter space uni- imating the gradient on a subset of the data called a
formly. Another major drawback of GD is that minibatch 2 . The size of the minibatches is almost al-
unlike Newton’s method, the learning rate for GD ways much smaller than the total number of data points
is the same in all directions in parameter space. For n, with typical minibatch sizes ranging from ten to a
this reason, the maximum learning rate is set by the few hundred data points. If there are n points in total,
behavior of the steepest direction and this can sig- and the mini-batch size is M , there will be n/M mini-
nificantly slow down training. Ideally, we would like batches. Let us denote these minibatches by Bk where
to take large steps in flat directions and small steps k = 1, . . . , n/M . Thus, in SGD, at each gradient descent
in steep directions. Since we are exploring rugged step we approximate the gradient using a single mini-
landscapes where curvatures change, this requires batch Bk ,
us to keep track of not only the gradient but second n
X X
derivatives of the energy function (note as discussed ∇θ E(θ) = ∇θ ei (xi , θ) −→ ∇θ ei (xi , θ). (19)
above, the ideal scenario would be to calculate the i=1 i∈Bk
Hessian but this proves to be too computationally We then cycle over all k = 1, . . . , n/M minibatches one
expensive). at a time, and use the mini-batch approximation to the
gradient to update the parameters θ at every step k. A
• GD is sensitive to initial conditions. One conse- full iteration over all n data points – in other words using
quence of the local nature of GD is that initial con- all n/M minibatches – is called an epoch. For notational
ditions matter. Depending on where one starts, one convenience, we will denote the mini-batch approxima-
will end up at a different local minimum. There- tion to the gradient by
fore, it is very important to think about how one X
initializes the training process. This is true for GD ∇θ E M B (θ) = ∇θ ei (xi , θ). (20)
as well as more complicated variants of GD intro- i∈Bk
duced below. With this notation, we can rewrite the SGD algorithm as
• GD can take exponential time to escape saddle vt = ηt ∇θ E M B (θ),
points, even with random initialization. As we men- θt+1 = θt − vt . (21)
tioned, GD is extremely sensitive to the initial con- Thus, in SGD, we replace the actual gradient over the
dition since it determines the particular local min- full data at each gradient descent step by an approxima-
imum GD would eventually reach. However, even tion to the gradient computed using a minibatch. This
with a good initialization scheme, through random- has two important benefits. First, it introduces stochas-
ness (to be introduced later), GD can still take ex- ticity and decreases the chance that our fitting algorithm
ponential time to escape saddle points, which are gets stuck in isolated local minima. Second, it signifi-
prevalent in high-dimensional spaces, even for non- cantly speeds up the calculation as one does not have
pathological objective functions (Du et al., 2017). to use all n data points to approximate the gradient.
Indeed, there are modified GD methods developed Empirical and theoretical work suggests that SGD has
recently to accelerate the escape. The details of additional benefits. Chief among these is that introduc-
these boosted method are beyond the scope of this ing stochasticity is thought to act as a natural regular-
review, and we refer avid readers to (Jin et al., izer that prevents overfitting in deep, isolated minima
2017) for details. (Bishop, 1995a; Keskar et al., 2016).
In the next few subsections, we will introduce variants
of GD that address many of these shortcomings. These 2 Traditionally, SGD was reserved for the case where you train on
generalized gradient descent methods form the backbone a single example – in other words minibatches of size 1. However,
of much of modern deep learning and neural networks, we will use SGD to mean any approximation to the gradient on
see Sec IX. For this reason, the reader is encouraged to a subset of the data.
17

D. Adding Momentum Thus, as the name suggests, the momentum parameter


is proportional to the mass of the particle and effec-
In practice, SGD is almost always used with a “mo- tively provides inertia. Furthermore, in the large vis-
mentum” or inertia term that serves as a memory of the cosity/small learning rate limit, our memory time scales
direction we are moving in parameter space. This is typ- as (1 − γ)−1 ≈ m/(µ∆t).
ically implemented as follows Why is momentum useful? SGD momentum helps
the gradient descent algorithm gain speed in directions
vt = γvt−1 + ηt ∇θ E(θt ) with persistent but small gradients even in the presence
θt+1 = θt − vt , (22) of stochasticity, while suppressing oscillations in high-
curvature directions. This becomes especially important
where we have introduced a momentum parameter γ, in situations where the landscape is shallow and flat in
with 0 ≤ γ ≤ 1, and for brevity we dropped the ex- some directions and narrow and steep in others. It has
plicit notation to indicate the gradient is to be taken been argued that first-order methods (with appropriate
over a different mini-batch at each step. We call this al- initial conditions) can perform comparable to more ex-
gorithm gradient descent with momentum (GDM). From pensive second order methods, especially in the context
these equations, it is clear that vt is a running average of complex deep learning models (Sutskever et al., 2013).
of recently encountered gradients and (1 − γ)−1 sets the Empirical studies suggest that the benefits of including
characteristic time scale for the memory used in the av- momentum are especially pronounced in complex models
eraging procedure. Consistent with this, when γ = 0, in the initial “transient phase” of training, rather than
this just reduces down to ordinary SGD as described in during a subsequent fine-tuning of a coarse minimum.
Eq. (21). An equivalent way of writing the updates is The reason for this is that, in this transient phase, corre-
lations in the gradient persist across many gradient de-
∆θt+1 = γ∆θt − ηt ∇θ E(θt ), (23) scent steps, accentuating the role of inertia and memory.
These beneficial properties of momentum can some-
where we have defined ∆θt = θt − θt−1 . In what should times become even more pronounced by using a slight
be a familiar scenario to many physicists, momentum modification of the classical momentum algorithm called
based methods were first introduced in old, largely for- Nesterov Accelerated Gradient (NAG) (Nesterov, 1983;
gotten (until recently) Soviet papers (Nesterov, 1983; Sutskever et al., 2013). In the NAG algorithm, rather
Polyak, 1964). than calculating the gradient at the current parameters,
Before proceeding further, let us try to get more in- ∇θ E(θt ), one calculates the gradient at the expected
tuition from these equations. It is helpful to consider a value of the parameters given our current momentum,
simple physical analogy with a particle of mass m moving ∇θ E(θt + γvt−1 ). This yields the NAG update rule
in a viscous medium with viscous damping coefficient µ
and potential E(w) (Qian, 1999). If we denote the par- vt = γvt−1 + ηt ∇θ E(θt + γvt−1 )
ticle’s position by w, then its motion is described by θt+1 = θt − vt . (28)
One of the major advantages of NAG is that it allows for
d2 w dw
m 2
+µ = −∇w E(w). (24) the use of a larger learning rate than GDM for the same
dt dt
choice of γ.
We can discretize this equation in the usual way to get

wt+∆t − 2wt + wt−∆t wt+∆t − wt E. Methods that use the second moment of the gradient
m +µ = −∇w E(w).
(∆t)2 ∆t
(25) In stochastic gradient descent, with and without mo-
Rearranging this equation, we can rewrite this as mentum, we still have to specify a “schedule” for tuning
the learning rate ηt as a function of time. As discussed in
(∆t)2 m the context of Newton’s method, this presents a number
∆wt+∆t = − ∇w E(w) + ∆wt . (26) of dilemmas. The learning rate is limited by the steepest
m + µ∆t m + µ∆t
direction which can change depending on the current po-
Notice that this equation is identical to Eq. (23) if we sition in the landscape. To circumvent this problem, ide-
identify the position of the particle, w, with the parame- ally our algorithm would keep track of curvature and take
ters θ. This allows us to identify the momentum param- large steps in shallow, flat directions and small steps in
eter and learning rate with the mass of the particle and steep, narrow directions. Second-order methods accom-
the viscous damping as: plish this by calculating or approximating the Hessian
and normalizing the learning rate by the curvature. How-
m (∆t)2 ever, this is very computationally expensive for models
γ= , η= . (27) with extremely large number of parameters. Ideally, we
m + µ∆t m + µ∆t
18

would like to be able to adaptively change the step size respectively, and (βj )t denotes βj to the power t. The
to match the landscape without paying the steep compu- parameters η and  have the same role as in RMSprop.
tational price of calculating or approximating Hessians. Like in RMSprop, the effective step size of a parameter
Recently, a number of methods have been introduced depends on the magnitude of its gradient squared. To
that accomplish this by tracking not only the gradient, understand this better, let us rewrite this expression in
but also the second moment of the gradient. These terms of the variance σt2 = ŝt − (m̂t )2 . Consider a single
methods include AdaGrad (Duchi et al., 2011), AdaDelta parameter θt . The update rule for this parameter is given
(Zeiler, 2012), RMSprop (Tieleman and Hinton, 2012), by
and ADAM (Kingma and Ba, 2014). Here, we discuss
the last two as representatives of this class of algorithms. m̂t
∆θt+1 = −ηt p . (32)
In RMSprop, in addition to keeping a running average σt2 + m̂2t + 
of the first moment of the gradient, we also keep track of
the second moment denoted by st = E[gt2 ]. The update We now examine different limiting cases of this expres-
rule for RMSprop is given by sion. Assume that our gradient estimates are consistent
so that the variance is small. In this case our update
gt = ∇θ E(θ) (29) rule tends to ∆θt+1 → −ηt (here we have assumed that
st = βst−1 + (1 − β)gt2 m̂t  ). This is equivalent to cutting off large persis-
gt tent gradients at 1 and limiting the maximum step size
θt+1 = θt − ηt √ ,
st +  in steep directions. On the other hand, imagine that the
gradient is widely fluctuating between gradient descent
where β controls the averaging time of the second mo-
steps. In this case σ 2  m̂2t so that our update becomes
ment and is typically taken to be about β = 0.9, ηt is a
∆θt+1 → −ηt m̂t /σt . In other words, we adapt our learn-
learning rate typically chosen to be 10−3 , and  ∼ 10−8
ing rate so that it is proportional to the signal-to-noise
is a small regularization constant to prevent divergences.
ratio (i.e. the mean in units of the standard deviation).
Multiplication and division by vectors is understood as
From a physics standpoint, this is extremely desirable:
an element-wise operation. It is clear from this formula
the standard deviation serves as a natural adaptive scale
that the learning rate is reduced in directions where the
for deciding whether a gradient is large or small. Thus,
gradient is consistently large. This greatly speeds up the
ADAM has the beneficial effects of (i) adapting our step
convergence by allowing us to use a larger learning rate
size so that we cut off large gradient directions (and hence
for flat directions.
prevent oscillations and divergences), and (ii) measuring
A related algorithm is the ADAM optimizer. In
gradients in terms of a natural length scale, the stan-
ADAM, we keep a running average of both the first and
dard deviation σt . The discussion above also explains
second moment of the gradient and use this information
empirical observations showing that the performance of
to adaptively change the learning rate for different pa-
both ADAM and RMSprop is drastically reduced if the
rameters. In addition to keeping a running average of the
square root is omitted in the update rule. It is also
first and second moments of the gradient (i.e. mt = E[gt ]
worth noting that recent studies have shown adaptive
and st = E[gt2 ], respectively), ADAM performs an addi-
methods like RMSProp, ADAM, and AdaGrad to gener-
tional bias correction to account for the fact that we are
alize worse than SGD in classification tasks, though they
estimating the first two moments of the gradient using a
achieve smaller training error. Such discussion is beyond
running average (denoted by the hats in the update rule
the scope of this review so we refer readers to (Wilson
below). The update rule for ADAM is given by (where
et al., 2017) for more details.
multiplication and division are once again understood to
be element-wise operations)
gt = ∇θ E(θ) (30) F. Comparison of various methods
mt = β1 mt−1 + (1 − β1 )gt
To better understand these methods, it is helpful to
st = β2 st−1 + (1 − β2 )gt2 visualize the performance of the five methods discussed
mt
m̂t = above – gradient descent (GD), gradient descent with
1 − (β1 )t momentum (GDM), NAG, ADAM, and RMSprop. To
st do so, we will use Beale’s function:
ŝt =
1 − (β2 )t
m̂t f (x, y) = (1.5 − x + xy)2 (33)
θt+1 = θt − ηt √ , 2 2 3 2
ŝt +  +(2.25 − x + xy ) + (2.625 − x + xy ) .
(31)
This function has a global minimum at (x, y) = (3, 0.5)
where β1 and β2 set the memory lifetime of the first and and an interesting structure that can be seen in Fig. 9.
second moment and are typically taken to be 0.9 and 0.99 The figure shows the results of using all five methods
19

4 is always important to randomly shuffle the data


when forming mini-batches. Otherwise, the gra-
2 dient descent method can fit spurious correlations
resulting from the order in which data is presented.
GD
0
y

GDM • Transform your inputs. As we discussed above,


NAG learning becomes difficult when our landscape has
−2 a mixture of steep and flat directions. One simple
RMS
ADAMS trick for minimizing these situations is to standard-
−4 ize the data by subtracting the mean and normaliz-
−4 −2 0 2 4 ing the variance of input variables. Whenever pos-
x sible, also decorrelate the inputs. To understand
why this is helpful, consider the case of linear re-
FIG. 9 Comparison of GD and its generalization for
gression. It is easy to show that for the squared
Beale’s function. Trajectories from gradient descent (GD;
black line), gradient descent with momentum (GDM; magenta error cost function, the Hessian of the energy ma-
line), NAG (cyan-dashed line), RMSprop (blue dash-dot line), trix is just the correlation matrix between the in-
and ADAM (red line) for Nsteps = 104 . The learning rate puts. Thus, by standardizing the inputs, we are
for GD, GDM, NAG is η = 10−6 and η = 10−3 for ADAM ensuring that the landscape looks homogeneous in
and RMSprop. β = 0.9 for RMSprop, β1 = 0.9 and β2 = all directions in parameter space. Since most deep
0.99 for ADAM, and  = 10−8 for both methods. Please see networks can be viewed as linear transformations
corresponding notebook for details.
followed by a non-linearity at each layer, we expect
this intuition to hold beyond the linear case.
for Nsteps = 104 steps for three different initial condi- • Monitor the out-of-sample performance. Always
tions. In the figure, the learning rate for GD, GDM, and monitor the performance of your model on a valida-
NAG are set to η = 10−6 whereas RMSprop and ADAM tion set (a small portion of the training data that is
have a learning rate of η = 10−3 . The learning rates held out of the training process to serve as a proxy
for RMSprop and ADAM can be set significantly higher for the test set – see Sec. XI for more on validation
than the other methods due to their adaptive step sizes. sets). If the validation error starts increasing, then
For this reason, ADAM and RMSprop tend to be much the model is beginning to overfit. Terminate the
quicker at navigating the landscape than simple momen- learning process. This early stopping significantly
tum based methods (see Fig. 9). Notice that in some improves performance in many settings.
cases (e.g. initial condition of (−1, 4)), the trajectories
do not find the global minimum but instead follow the • Adaptive optimization methods do not always have
deep, narrow ravine that occurs along y = 1. This kind of good generalization. As we mentioned, recent stud-
landscape structure is generic in high-dimensional spaces ies have shown that adaptive methods such as
where saddle points proliferate. Once again, the adaptive ADAM, RMSprop, and AdaGrad tend to have poor
step size and momentum of ADAM and RMSprop allows generalization compared to SGD or SGD with mo-
these methods to traverse the landscape faster than the mentum, particularly in the high-dimensional limit
simpler first-order methods. The reader is encouraged to (i.e. the number of parameters exceeds the number
consult the corresponding Jupyter notebook and experi- of data points) (Wilson et al., 2017). Although it is
ment with changing initial conditions, the cost function not clear at this stage why sophisticated methods,
surface being minimized, and hyper-parameters to gain such as ADAM, RMSprop, and AdaGrad, perform
more intuition about all these methods. so well in training deep neural networks such as
generative adversarial networks (GANs) (Goodfel-
low et al., 2014) [see Sec. XVII], simpler procedures
G. Gradient descent in practice: practical tips like properly-tuned plain SGD may work equally
well or better in some applications.
We conclude this chapter by compiling some practical
tips from experts for getting the best performance from
gradient descent based algorithms, especially in the con- V. OVERVIEW OF BAYESIAN INFERENCE
text of deep neural networks discussed later in the review,
see Secs. IX, and XVI.B. This section draws heavily on Statistical modeling usually revolves around estima-
best practices laid out in (Bottou, 2012; LeCun et al., tion or prediction (Jaynes, 1996). Bayesian methods are
1998b; Tieleman and Hinton, 2012). based on the fairly simple premise that probability can
be used as a mathematical framework for describing un-
• Randomize the data when making mini-batches. It certainty. This is not that different in spirit from the
20

main idea of statistical mechanics in physics, where we look at the data then we would like to select an unin-
use probability to describe the behavior of large systems formative prior that reflects our ignorance, otherwise we
where we cannot know the positions and momenta of all should select an informative prior that accurately reflects
the particles even if the system itself is fully determinis- the knowledge we have about θ. This review will focus
tic (at least classically). In practice, Bayesian inference on informative priors that are commonly used for ML
provides a set of principles and procedures for learning applications. However, there is a large literature on un-
from data and for describing uncertainty. In this section, informative priors, including reparameterization invari-
we give a gentle introduction to Bayesian inference, with ant priors, that would be of interest to physicists and
special emphasis on its logic (i.e. Bayesian reasoning) and we refer the interested reader to (Berger and Bernardo,
provide a connection to ML discussed in Sec. II and III. 1992; Gelman et al., 2014; Jaynes, 1996; Jeffreys, 1946;
For a technical account of Bayesian inference in general, Mattingly et al., 2018).
we refer readers to (Barber, 2012; Gelman et al., 2014). Using an informative prior tends to decrease the vari-
ance of the posterior distribution while, potentially, in-
creasing its bias. This is beneficial if the decrease in
A. Bayes Rule variance is larger than the increase in bias. In high-
dimensional problems, it is reasonable to assume that
To solve a problem using Bayesian methods, we have many of the parameters will not be strongly relevant.
to specify two functions: the likelihood function p(X|θ), Therefore, many of the parameters of the model will
which describes the probability of observing a dataset be zero or close to zero. We can express this belief
X for a given value of the unknown parameters θ, and using two commonly used priors: the Gaussian prior
the prior distribution p(θ), which describes any knowl- Q q λ −λθ2
p(θ|λ) = j 2π e j is used to express the assump-
edge we have about the parameters before we collect the
tion that many of the parameters will be small, and the
data. Note that the likelihood should be considered as
Laplace prior p(θ|λ) = j λ2 e−λ|θj | is used to express the
Q
a function of the parameters θ with the data X held
assumption that many of the parameters will be zero.
fixed. The prior distribution and the likelihood function
We’ll come back to this point later in Sec. VI.F.
are used to compute the posterior distribution p(θ|X)
via Bayes’ rule:
B. Bayesian Decisions
p(X|θ)p(θ)
p(θ|X) = R . (34)
dθ 0 p(X|θ 0 )p(θ 0 ) The above section presents the tools for computing the
posterior distribution p(θ|X), which uses probability as
The posterior distribution describes our knowledge about
a framework for expressing our knowledge about the pa-
the unknown parameter θ after observing the data X.
rameters θ. In most cases, however, we need to summa-
In many cases, it will not be possible to analytically
rize our knowledge and pick a single “best” value for the
compute the normalizing constant in the R denominator of parameters. In principle, the specific value of the param-
the posterior distribution, i.e. p(X) = dθ p(X|θ)p(θ),
eters should be chosen to maximize a utility function.
and Markov Chain Monte Carlo (MCMC) methods are
In practice, however, we usually use one of two choices:
needed to draw random samples from p(θ|X).
the posterior mean hθi = dθ θp(θ|X), or the poste-
R
The likelihood function p(X|θ) is a common feature
rior mode θ̂MAP = arg maxθ p(θ|X). Often, hθi is called
of both classical statistics and Bayesian inference, and
is determined by the model and the measurement noise. the Bayes estimate and θ̂MAP is called the maximum-a-
Many common statistical procedures such as least-square posteriori or MAP estimate. While the Bayes estimate
fitting can be cast as Maximum Likelihood Estimation minimizes the mean-squared error, the MAP estimate is
(MLE). In MLE, one chooses the parameters θ̂ that max- often used instead because it is easier to compute.
imize the likelihood (or equivalently the log-likelihood
since log is a monotonic function) of the observed data:
C. Hyperparameters

θ̂ = arg max log p(X|θ). (35) The Gaussian and Laplace prior distributions, used to
θ
express the assumption that many of the model parame-
In other words, in MLE we choose the parameters that ters will be small or zero, both have an extra parameter
maximize the probability of seeing the observed data λ. This hyperparameter or nuisance variable has to be
given our generative model. MLE is an important con- chosen somehow. One standard Bayesian approach is to
cept in both frequentist and Bayesian statistics. define another prior distribution for λ – usually using an
The prior distribution, by contrast, is uniquely uninformative prior – and to average the posterior distri-
Bayesian. There are two general classes of priors: if we bution over all choices of λ. This is called a hierarchical
do not have any specialized knowledge about θ before we prior. Computing averages, however, often requires long
21

Markov Chain Monte Carlo simulations that are compu- the columns X:,j ∈ Rn , j = 1, · · · p being measured fea-
tationally intensive. Therefore, it is simpler if we can tures. Bear in mind that this function f is never known
find a good value of λ using an optimization procedure to us explicitly, though in practice we usually presume
instead. We will discuss how this is done in practice when its functional form. For example, in linear regression, we
discussing linear regression in Sec. VI. assume yi = f (x(i) ; wtrue ) + i = wtrue
T
x(i) + i for some
unknown but fixed wtrue ∈ R . p

We want to find a function g with parameters w fit


VI. LINEAR REGRESSION to the data D that can best approximate f . When this
is done, meaning we have found a ŵ such that g(x; ŵ)
In Section II, we performed our first numerical ML yields our best estimate of f , we can use this g to make
experiments by fitting datasets generated by polynomi- predictions about the response y0 for a new data point
als in the presence of different levels of additive noise. x0 , as we did in Section II.
We used the fitted parameters to make predictions on It will be helpful for our discussion of linear regres-
‘unseen’ observations, allowing us to gauge the perfor- sion to define one last piece of notation. For any real
mance of our model on new data. These experiments number p ≥ 1, we define the Lp norm of a vector
highlighted the fundamental tension common to all ML x = (x1 , · · · , xd ) ∈ Rd to be
models between how well we fit the training dataset and 1
predictions on new data. The optimal choice of predictor ||x||p = (|x1 |p + · · · + |xd |p ) p (36)
depended on, among many other things, the functions
used to fit the data and the underlying noise level. In
Section III, we formalized this by introducing the notion A. Least-square regression
of model complexity and the bias-variance decomposi-
tion, and discussed the statistical meaning of learning. Ordinary least squares linear regression (OLS) is de-
In this section, we take a closer look at these ideas in the fined as the minimization of the L2 norm of the difference
simple setting of linear regression. between the response yi and the predictor g(x(i) ; w) =
wT x(i) :
As in Section II, fitting a given set of samples (yi , xi )
means relating the independent variables xi to their re- n
X
sponses yi . For example, suppose we want to see how min ||Xw − y||22 = minp (wT x(i) − yi )2 . (37)
w∈Rp w∈R
the voltage across two sides of a metal slab V changes i=1

in response to the applied electric current I. Normally In other words, we are looking to find the w which mini-
we would first make a bunch of measurements labeled mizes the L2 error. Geometrically speaking, the predictor
by i and plot them on a two-dimensional scatterplot, function g(x(i) ; w) = wT x(i) defines a hyperplane in Rp .
(Vi , Ii ). The next step is to assume, either from an oracle Minimizing the least squares error is therefore equivalent
or from theoretical reasoning, some models that might to minimizing the sum of all projections (i.e. residuals)
explain the measurements and measuring their perfor- for all points x(i) to this hyperplane (see Fig. 10). For-
mance. Mathematically, this amounts to finding some mally, we denote the solution to this problem as ŵLS :
function f such that Vi = f (Ii ; w), where w is some pa-
rameter (e.g. the electrical resistance R of the metal slab
in the case of Ohm’s law). We then try to minimize the ŵLS = arg min ||Xw − y||22 , (38)
errors made in explaining the given set of measurements w∈Rp
based on our model f by tuning the parameter w. To
which, after straightforward differentiation, leads to
do so, we need to first define the error function (formally
called the loss function) that characterizes the deviation ŵLS = (X T X)−1 X T y. (39)
of our prediction from the actual response.
Before formulating the problem, let us set up the no- Note that we have assumed that X T X is invertible,
tation. Suppose we are given a dataset with n sam- which is often the case when n  p. Formally speak-
ples D = {(yi , x(i) )}ni=1 , where x(i) is the i-th obser- ing, if rank(X) = p, namely, the predictors X:,1 , . . . , X:,p
vation vector while yi is its corresponding (scalar) re- (i.e. columns of X) are linearly independent, then ŵLS is
sponse. We assume that every sample has p features, unique. In the case of rank(X) < p, which happens when
namely, x(i) ∈ Rp . Let f be the true function/model p > n, X T X is singular, implying there are infinitely
that generated these samples via yi = f (x(i) ; wtrue ) + i , many solutions to the least squares problem, Eq. (38).
where wtrue ∈ Rp is a parameter vector and i is some In this case, one can easily show that if w0 is a solution,
i.i.d. white noise with zero mean and finite variance. w0 +η is also a solution for any η which satisfies Xη = 0
Conventionally, we cast all samples into an n × p ma- (i.e. η ∈ null(X)). Having determined the least squares
trix, X ∈ Rn×p , called the design matrix, with the rows solution, we can calculate ŷ, the best fit of our data X,
Xi,: = x(i) ∈ Rp , , i = 1, · · · , n being observations and as ŷ = X ŵLS = PX y, where PX = X(X T X)−1 X T ,
22

c.f. Eq. (37). Geometrically, PX is the projection matrix regularization: the first one employs an L2 penalty and
which acts on y and projects it onto the column space is called Ridge regression, while the second uses an L1
of X, which is spanned by the predictors X:,1 , · · · , X:,p penalty and is called LASSO.
(see FIG. 11). Notice that we found the optimal solu-
tion ŵLS in one shot, without doing any sort of iterative
optimization like that discussed in Section IV. y
span( { X 1 , · · · , X p } )

y − ŷ

Rp FIG. 11 The projection matrix PX projects the response


vector y onto the column space spanned by the columns of
X, span({X:,1 , · · · , X:,p }) (purple area), thus forming a fitted
vector ŷ. The residuals in Eq. (37) are illustrated by the red
vector y − ŷ.
FIG. 10 Geometric interpretation of least squares regression.
The regression function g defines a hyperplane in Rp (green
solid line, here we have p = 2) while the residual of data point
x(i) (hollow circles) is its projection onto this hyperplane (bar- B. Ridge-Regression
ended dashed line).
In this section, we study the effect of adding to the
In Section III we explained that the difference between least squares loss function a regularizer defined as the L2
learning and fitting lies in the prediction on “unseen" norm of the parameter vector we wish to optimize over.
data. It is therefore necessary to examine the out-of- In other words, we want to solve the following penalized
sample error. For a more refined argument on the role regression problem called Ridge regression:
of out-of-sample errors in linear regression, we encour-
age the reader to do the exercises in the corresponding ŵRidge (λ) = arg min ||Xw − y||22 + λ||w||22 . (43)


Jupyter notebooks. The upshot is, following our defini- w∈Rp

tion of Ēin and Ēout in Section III, the average in-sample This problem is equivalent to the following constrained
and out-of-sample error can be shown to be optimization problem
 p
Ēin = σ 2 1 − (40) ŵRidge (t) = arg min ||Xw − y||22 . (44)
n
 p w∈Rp : ||w||22 ≤t
Ēout = σ 2 1 + , (41)
n This means that for any t ≥ 0 and solution ŵRidge in
provided we obtain the least squares solution ŵLS from Eq. (44), there exists a value λ ≥ 0 such that ŵRidge
i.i.d. samples X and y generated through y = Xwtrue + solves Eq. (43), and vice versa4 . With this equivalence, it
 3 . Therefore, we can calculate the average generaliza- is obvious that by adding a regularization term, λ||w||22 ,
tion error explicitly: to our least squares loss function, we are effectively con-
p straining the magnitude of the parameter vector learned
|Ēin − Ēout | = 2σ 2 . (42) from the data.
n
To see this, let us solve Eq. (43) explicitly. Differenti-
This imparts an important message: if we have p  n ating w.r.t. w, we obtain,
(i.e. high-dimensional data), the generalization error is
extremely large, meaning the model is not learning. Even ŵRidge (λ) = (X T X + λIp×p )−1 X T y. (45)
when we have p ≈ n, we might still not learn well due
to the intrinsic noise σ 2 . One way to ameliorate this
is, as we shall see in the following few sections, to use
4
regularization. We will mainly focus on two forms of Note that the equivalence between the penalized and the con-
strained (regularized) form of least square optimization does not
always hold. It holds for Ridge and LASSO (introduced later),
but not for best subset selection which is defined by choosing a
L0 norm: λ||w||0 . In this case, for every λ > 0 and any ŵBS
3 This requires that  is a noise vector whose elements are i.i.d. of that solves the penalized form of best subset selection, there is a
zero mean and variance σ 2 , and is independent of the samples value t ≥ 0 such that ŵBS also solves that constrained form of
X. best subset selection, but the converse is not true.
23

In fact, when X is orthogonal, one can simplify this ex- As in Ridge regression, there is another formulation for
pression further: LASSO based on constrained optimization, namely,
ŵLS ŵLASSO (t) = arg min ||Xw − y||22 . (53)
ŵRidge (λ) = , for orthogonal X, (46)
1+λ w∈Rp : ||w||1 ≤t

where ŵLS is the least squares solution given by Eq. (39). The equivalence interpretation is the same as in Ridge
This implies that the ridge estimate is merely the least regression, namely, for any t ≥ 0 and solution ŵLASSO in
squares estimate scaled by a factor (1 + λ)−1 . Eq. (53), there is a value λ ≥ 0 such that ŵLASSO solves
Can we derive a similar relation between the fitted Eq. (52), and vice versa. However, to get the analytic
vector ŷ = X ŵRidge and the prediction made by least solution of LASSO, we cannot simply take the gradient
squares linear regression? To answer this, let us do a sin- of Eq. (52) with respect to w, since the L1 -regularizer is
gular value decomposition (SVD) on X. Recall that the not everywhere differentiable, in particular at any point
SVD of an n × p matrix X has the form where wj = 0 (see Fig. 13). Nonetheless, LASSO is a
convex problem. Therefore, we can invoke the so-called
X = U DV T , (47)
“subgradient optimality condition" (Boyd and Vanden-
where U ∈ Rn×p and V ∈ Rp×p are orthogonal matrices berghe, 2004; Rockafellar, 2015) in optimization theory
such that the columns of U span the column space of to obtain the solution. To keep the notation simple, we
X while the columns of V span the row space of X. only show the solution assuming X is orthogonal:
D ∈ Rp×p =diag(d1 , d2 , · · · , dp ) is a diagonal matrix with
ŵjLASSO (λ) = sign(ŵjLS )(|ŵjLS | − λ)+ , for orthogonal X,
entries d1 ≥ d2 ≥ · · · dp ≥ 0 called the singular values of
(54)
X. Note that X is singular if there is at least one dj = 0.
where (x)+ denotes the positive part of x and ŵjLS is
By writing X in terms of its SVD, one can recast the
the j-th component of least squares solution. In Fig. 12,
Ridge estimator Eq. (45) as
we compare the Ridge solution Eq. (46) with LASSO
ŵRidge = V (D 2 + λI)−1 DU T y, (48) solution Eq. (54). As we mentioned above, the Ridge
solution is the least squares solution scaled by a factor
which implies that the Ridge predictor satisfies of (1 + λ). Here LASSO does something conventionally
ŷRidge = X ŵRidge called “soft-thresholding" (see Fig. 12). We encourage
interested readers to work out the exercises in Notebook
= U D(D 2 + λI)−1 DU T y
p
3 to explore what this function does.
X d2j
= U:,j 2 U:jT y (49) LASSO Ridge
j=1
dj + λ

≤ U U Ty (50)
scaled by
= X ŷ ≡ ŷLS , (51) λ
λ 1+ λ
where U:,j are the columns of U . Note that in the in-
λ
equality step we assumed λ ≥ 0 and used SVD to sim-
plify Eq. (39). By comparing Eq. (49) with Eq. (51), it is
clear that in order to compute the fitted vector ŷ, both
Ridge and least squares linear regression have to project FIG. 12 [Adapted from (Friedman et al., 2001)] Comparing
y to the column space of X. The only difference is that LASSO and Ridge regression. The black 45 degree line is
Ridge regression further shrinks each basis component j the unconstrained estimate for reference. The estimators are
by a factor d2j /(d2j + λ). We encourage the reader to do shown by red dashed lines. For LASSO, this corresponds to
the exercises in Notebook 3 to develop further intuition the soft-thresholding function Eq. (54) while for Ridge regres-
about how Ridge regression works. sion the solution is given by Eq. (46)

How different are the solutions found using LASSO


C. LASSO and Sparse Regression and Ridge regression? In general, LASSO tends to give
sparse solutions, meaning many components of ŵLASSO
In this section, we study the effects of adding an L1 reg- are zero. An intuitive justification for this result is pro-
ularization penalty, conventionally called LASSO, which vided in Fig. 13. In short, to solve a constrained op-
stands for “least absolute shrinkage and selection opera- timization problem with a fixed regularization strength
tor”. Concretely, LASSO in the penalized form is defined t ≥ 0, for example, Eq. (44) and Eq. (53), one first carves
by the following regularized regression problem: out the “feasible region" specified by the regularizer in the
{w1 , · · · , wd } space. This means that a solution ŵ0 is le-
ŵLASSO (λ) = arg min ||Xw − y||22 + λ||w||1 . (52)
w∈Rp gitimate only if it falls in this region. Then one proceeds
24

by plotting the contours of the least squares regressors in


an increasing manner until the contour touches the fea- 1.0
Train (Ridge)
sible region. The point where this occurs is the solution Test (Ridge)
to our optimization problem (see Fig. 13 for illustration). 0.8 Train (LASSO)
Test (LASSO)
Loosely speaking, since the L1 regularizer of LASSO has
sharp protrusions (i.e. vertices) along the axes, and be-

Performance
0.6
cause the regressor contours are in the shape of ovals (it
is quadratic in w), their intersection tends to occur at 0.4
the vertex of the feasibility region, implying the solution
vector will be sparse. 0.2

0.0
2 1 0 1 2
ŵ 10 10 10 10 10

w2 w2
FIG. 14 Performance of LASSO and ridge regression on the
t
diabetes dataset measured by the R2 coefficient of determina-
t tion. The best possible performance is R2 = 1. See Notebook
w1 w1 3.

LASSO Ridge Ridge LASSO


600
FIG. 13 [Adapted from (Friedman et al., 2001)] Illustra- 600
tion of LASSO (left) and Ridge regression (right). The blue 500
500
concentric ovals are the contours of the regression function
400
while the red shaded regions represent the constraint func- 400
|wi|
tions: (left) |w1 | + |w2 | ≤ t and (right) w12 + w22 ≤ t. In- 300 300
tuitively, since the constraint function of LASSO has more
protrusions, the ovals tend to intersect the constraint at the 200 200
vertex, as shown on the left. Since the vertices correspond to
parameter vectors w with only one non-vanishing component, 100 100
LASSO tends to give sparse solution. 0 0
2 1 0 1 2 2 1 0 1 2
10 10 10 10 10 10 10 10 10 10
In Notebook 3, we analyze a Diabetes dataset using
both LASSO and Ridge regression to predict the dia-
betes outcome one year forward (Efron et al., 2004). In FIG. 15 Regularization parameter λ affects the weights (fea-
Figs. 14, 15, we show the performance of both methods tures) we learned in both Ridge regression (left) and LASSO
regression (right) on the Diabetes dataset. Curves with dif-
and the solutions ŵLASSO (λ), ŵRidge (λ) explicitly. More ferent colors correspond to different wi ’s (features). Notice
details of this dataset and our regression implementation LASSO, unlike Ridge, sets feature weights to zero leading to
can be found in Notebook 3. sparsity. See Notebook 3.

D. Using Linear Regression to Learn the Ising Hamiltonian numbers Ej mean, and the configuration {Sj }L j=1 can be
interpreted in many ways: the outcome of coin tosses,
To gain deeper intuition about what kind of physics black-and-white pixels of an image, the binary represen-
problems linear regression allows us to tackle, consider tation of integers, etc. Your goal is to learn a model that
the following problem of learning the Hamiltonian for predicts Ej from the spin configurations.
the Ising model. Imagine you are given an ensemble of Without any prior knowledge about the origin of the
random spin configurations, and assigned to each state data set, physics intuition may suggest to look for a spin
its energy, generated from the 1D Ising model: model with pairwise interactions between every pair of
L
X variables. That is, we choose the following model class:
H = −J Sj Sj+1 (55)
L X
L
j=1 X
Hmodel [S i ] = − Jj,k Sji Ski , (56)
where J is the nearest-neighbor spin interaction, and j=1 k=1
Sj ∈ {±1} is a spin variable. Let’s assume the data
was generated with J = 1. You are handed the data The goal is to determine the interaction matrix Jj,k by
set D = ({Sj }L
j=1 , Ej ) without knowledge of what the applying linear regression on the data set D. This is a
25

well-defined problem, since the unknown Jj,k enters lin- data, was set to unity, J = 1. Moreover, Jj,k was NOT
early into the definition of the Hamiltonian. To this end, defined to be symmetric (we only used the Jj,j+1 but
we cast the above ansatz into the more familiar linear- never the Jj,j−1 elements). Figure. 17 shows the matrix
regression form: representation of the learned weights Jj,k . Interestingly,
OLS and Ridge regression learn nearly symmetric weights
Hmodel [S i ] = Xi · J. (57) J ≈ −0.5. This is not surprising, since it amounts to tak-
ing into account both the Jj,j+1 and the Jj,j−1 terms, and
The vectors Xi represent all two-body interactions
the weights are distributed symmetrically between them.
j,k=1 , and the index i runs over the samples in
{Sji Ski }L
LASSO, on the other hand, tends to break this symme-
the dataset. To make the analogy complete, we can also
try (see matrix elements plots for λ = 0.01) 5 . Thus,
represent the dot product by a single index p = {j, k},
we see how different regularization schemes can lead to
i.e. Xi · J = Xpi Jp . Note that the regression model does
learning equivalent models but in different ‘gauges’. Any
not include the minus sign. In the following, we apply
information we have about the symmetry of the unknown
ordinary least squares, Ridge, and LASSO regression to
model that generated the data should be reflected in the
the problem, and compare their performance.
definition of the model and the choice of regularization.
In addition to the diabetes dataset in Notebook 3, we
1.0
encourage the reader to work out Notebook 4 in which
linear regression is applied to the one-dimensional Ising
0.8
Train (OLS) model.
0.6 Test (OLS)
R2

Train (Ridge) E. Convexity of regularizer


0.4 Test (Ridge)
Train (LASSO) In the previous section, we mentioned that the analyt-
0.2 ical solution of LASSO can be found by invoking its con-
Test (LASSO)
vexity. In this section, we provide a gentle introduction
0.0 −4
10 10−2 100 102 104 to convexity theory and highlight a few properties which
λ can help us understand the differences between LASSO
and Ridge regression. First, recall that a set C ⊆ Rn is
FIG. 16 Performance of OLS, Ridge and LASSO regression called convex if for any x, y ∈ C and t ∈ [0, 1],
on the Ising model as measured by the R2 coefficient of de-
termination. Optimal performance is R2 = 1.See Notebook tx + (1 − t)y ∈ C. (59)
4.
In other words, every line segment joining x, y lies en-
Figure. 16 shows the R2 of the three regression models. tirely in C. A function f : Rn → R is called con-
Pn true 2 vex if its domain, dom(f ), is a convex set, and for any
pred
i=1 i
y − y i x, y ∈dom(f ) and t ∈ [0, 1] we have
R2 = 1 − P 2 . (58)
n true (60)
Pn pred
i=1 i − 1
i=1 iy f (tx + (1 − t)y) ≤ tf (x) + (1 − t)f (y),
y n
That is, the function lies on or below the line segment
Let us make a few remarks: (i) the regularization pa-
joining its evaluation at x and y. This function f is
rameter λ affects the Ridge and LASSO regressions at
called strictly convex if this inequality holds strictly for
scales separated by a few orders of magnitude. Notice
x 6= y and t ∈ (0, 1). Now, it turns out that for con-
that this is different for the data considered in the di-
vex functions, any local minimizer is a global minimizer.
abetes dataset, cf. Fig. 14. Therefore, it is considered
Algorithmically, this means that in the optimization pro-
good practice to always check the performance for the
cedure, as long as we are “going down the hill” and agree
given model and data as a function of λ. (ii) While
to stop when we reach a minimum, then we have hit
the OLS and Ridge regression test curves are monotonic,
the global minimum. In addition to this, there is an
the LASSO test curve is not – suggesting an optimal
abundance of rich theory regarding convex duality and
LASSO regularization parameter is λ ≈ 10−2 . At this
optimality, which allow us to understand the solutions
sweet spot, the Ising interaction weights J contains only
even before solving the problem itself. We refer interested
nearest-neighbor terms (as did the model the data was
generated from).
Choosing whether to use Ridge or LASSO regression in
this case turns out to be similar to fixing gauge degrees of 5 Look closer, and you will see that LASSO actually splits the
freedom. Recall that the uniform nearest-neighbor inter- weights rather equally for the periodic boundary condition ele-
actions strength Jj,k = J which we used to generate the ment at the edges of the anti-diagonal.
26

FIG. 17 Learned interaction matrix Jij for the Ising model ansatz in Eq. (56) for ordinary least squares (OLS) regression
(left), Ridge regression (middle) and LASSO (right) at different regularization strengths λ. OLS is λ-independent but is shown
for comparison throughout.See Notebook 4.
27

readers to (Boyd and Vandenberghe, 2004; Rockafellar, Using the assumption that samples are i.i.d., we can write
2015). the log-likelihood as
Now let us examine the two regularizers we introduced n
earlier. A close inspection reveals that LASSO and Ridge l(θ) ≡ log p(D|θ) =
X
log p(yi |x(i) , θ). (63)
regressions are both convex problems but only Ridge re- i=1
gression is a strictly convex problem (assuming λ > 0).
From convexity theory, this means that we always have a Note that the conditional dependence of the response
unique solution for Ridge but not necessary for LASSO. variable yi on the independent variable x(i) in the likeli-
In fact, it was recently shown that under mild conditions, hood function is made explicit since in regression the ob-
such as demanding general position for columns of X, served value of data, yi , is predicted based on x(i) using
the LASSO solution is indeed unique (Tibshirani et al., a model that is assumed to be a probability distribution
2013). Apart from this theoretical characterization, (Zou that depends on unknown parameter θ. This distribu-
and Hastie, 2005) introduced the notion of Elastic Net to tion, when endowed with θ, can, as we hope, potentially
retain the desirable properties of both LASSO and Ridge explain our prediction on yi . By definition, such distri-
regression, which is now one of the standard tools for bution is the likelihood function we discussed in Sec. V.
regression analysis and machine learning. We refer to Note that this is consistent with the formal statistical
reader to explore this in Notebook 2. treatment of regression where the goal is to estimate the
conditional expectation of the dependent variable given
the value of the independent variable (sometimes called
F. Bayesian formulation of linear regression the covariate) (Wasserman, 2013). We stress that this
notation does not imply x(i) is unknown– it is still part
In Section V, we gave an overview of Bayesian inference of the observed data!
and phrased it in the context of learning and uncertainty Using Eq. (61), we get
quantification. In this section we formulate least squares n 2 n
regression from a Bayesian point of view. We shall see 1 X
yi − wT x(i) − log 2πσ 2

l(θ) = − 2
that regularization in learning will emerge naturally as 2σ i=1 2
part of the Bayesian inference procedure. 1
From the setup of linear regression, the data D used to =− ||Xw − y||22 + const. (64)
2σ 2
fit the regression model is generated through y = xT w +
. We often assume that  is a Gaussian noise with mean By comparing Eq. (38) and Eq. (64), it is clear that per-
zero and variance σ 2 . To connect linear regression to the forming least squares is the same as maximizing the log-
Bayesian framework, we often write the model as likelihood of this model.
What about adding regularization? In Section V, we
p(y|x, θ) = N (y|µ(x), σ 2 (x)). (61) introduced the maximum a posteriori probability (MAP)
estimate. Here we show that it actually corresponds to
In other words, our regression model is defined by a con- regularized linear regression, where the choice of prior
ditional probability that depends not only on data x but determines the type of regularization. Recall Bayes’ rule
on some model parameters θ. For example, if the mean
is a linear function of x given by µ = xT w, and the p(θ|D) ∝ p(D|θ)p(θ). (65)
variance is fixed σ 2 (x) = σ 2 , then θ = (w, σ 2 ). Now instead of maximizing the log-likelihood, l(θ) =
In statistics, many problems rely on estimation of some log p(D|θ), let us maximize the log posterior, log p(θ|D).
parameters of interest. For example, suppose we are Invoking Eq. (65), the MAP estimator becomes
given the height data of 20 junior students from a regional
high school, but what we are interested in is the average θ̂MAP ≡ arg max log p(D|θ) + log p(θ). (66)
height of all high school juniors in the whole county. It θ

is conceivable that the data we are given are not rep- In Sec. V.C, we discussed that a common choice for the
resentative of the student population as a whole. It is prior is a Gaussian distribution. Consider the Gaussian
therefore necessary to devise a systematic way to pre- prior6 with zero mean and variance τ 2 , namely, p(w) =
form reliable estimation. Here we present the maximum
likelihood estimation (MLE), and show that MLE for θ
is the one that minimizes the mean squared error (MSE)
used in OLS, see Sec.VI.A. 6 Indeed, a Gaussian prior is the conjugate prior that gives a Gaus-
MLE is defined by maximizing the log-likelihood sian posterior. For a given likelihood, conjugacy guarantees the
preservation of prior distribution at the posterior level. For ex-
w.r.t. the parameters θ: ample, for a Gaussian (Geometric) likelihood with a Gaussian
(Beta) prior, the posterior distribution is still Gaussian (Beta)
θ̂ ≡ arg max log p(D|θ). (62) distribution.
θ
28

N (wj |0, τ 2 ). Then, we can recast the MAP estimator probably aware of the time of day, that it is a Wednes-
Q
j
into day, your friend Alice being in attendance, your friend
  Bob being absent with a cold, the country in which you
n n
1 X 1 X are doing the experiment, and the planet you are on, but
θ̂MAP ≡ arg max − 2 (yi − wT x(i) )2 − 2 w2 
θ 2σ i=1 2τ j=1 j you almost assuredly haven’t written these down in your
  notebook. Why not? The reason is because you entered
1 1 the classroom with strongly held prior beliefs that none of
= arg max − 2 ||Xw − y||2 − 2 ||w||2 . (67)
2 2
θ 2σ 2τ those things affect the physics which takes place in that
room. Even of the things you did write down in an effort
Note that we dropped constant terms that do not de-
to be a careful scientist you probably hold some doubt
pend on the maximization parameters θ. The equiva-
as to their importance to your result and what is serving
lence between MAP estimation with a Gaussian prior
you here is the intuition that probably only a few things
and Ridge regression is established by comparing Eq. (67)
matter in the physics of pendula. Hence again you are
and Eq. (44) with λ ≡ σ 2 /τ 2 . We relegate the analogous
approaching the experiment with prior beliefs about how
derivation for LASSO to an exercise in Notebook 3.
many features you will need to pay attention to in order
to predict what will happen when you swing an unknown
G. Recap and a general perspective on regularizers pendulum. This example might seem a bit contrived, but
the point is that we live in a high-dimensional world of
In this section, we explored least squares linear regres- information and while we have good intuition about what
sion with and without regularization. We motivated the to write down in our notebook for well-known problems,
need for regularization due to poor generalization, in par- often in the field of ML we cannot say with any confi-
ticular in the “high-dimensional limit" (p  n). Instead dence a priori what the small list of things to write down
of showing the average in-sample and out-of-sample er- will be, but we can at least use regularization to help us
rors for the regularized problem explicitly, we conducted enforce that the list not be too long so that we don’t end
numerical experiments in Notebook 3 on the diabetes up predicting that the period of a pendulum depends on
dataset and showed that regularization typically leads Bob having a cold on Wednesdays.
to better generalization. Due to the equivalence between Of course, in both LASSO and Ridge regression there
the constrained and penalized form of regularized regres- is a parameter λ involved. In principle, this hyper-
sion (in LASSO and Ridge, but not generally true in cases parameter is usually predetermined, which means that
such as L0 penalization), we can regard the regularized it is not part of the regression process. As we saw in
regression problem as an un-regularized problem but on Fig. 15, our learning performance and solution depends
a constrained set of parameters. Since the size of the al- strongly on λ, thus it is vital to choose it properly. As
lowed parameter space (e.g. w ∈ Rp when un-regularized we discussed in Sec. V.C, one approach is to assume an
vs. w ∈ C ⊂ Rp when regularized) is roughly a proxy for uninformative prior on the hyper-parameters, p(λ), and
model complexity, solving the regularized problem is in average the posterior over all choices of λ following this
effect solving the un-regularized problem with a smaller distribution. However, this comes with a large computa-
model complexity class. This implies that we’re less likely tional cost. Therefore, it is simpler to choose the regular-
to overfit. ization parameter through some optimization procedure.
We also showed the connection between using a reg- We’d like to emphasize that linear regression can be
ularization function and the use of priors in Bayesian applied to model non-linear relationship between input
inference. This connection can be used to develop more and response. This can be done by replacing the input
intuition about why regularization implies we are less x with some nonlinear function φ(x). Note that doing
likely to overfit the data: Let’s say you are a young so preserves the linearity as a function of the parame-
Physics student taking a laboratory class where the goal ters w, since model is defined by the their inner product
of the experiment is to measure the behavior of several φT (x)w. This method is known as basis function expan-
different pendula and use that to predict the formula sion (Bishop, 2006; Murphy, 2012).
(i.e. model) that determines the period of oscillation. Recent years have also seen a surge of interest in un-
In your investigation you would probably record many derstanding generalized linear regression models from a
things (hopefully including the length and mass!) in an statistical physics perspective. Much of this research has
effort to give yourself the best possible chance of deter- focused on understanding high-dimensional linear regres-
mining the unknown relationship, perhaps writing down sion and compressed sensing (Donoho, 2006) (see (Ad-
the temperature of the room, any air currents, if the ta- vani et al., 2013; Zdeborová and Krzakala, 2016) for ac-
ble were vibrating, etc. What you have done is create a cessible reviews for physicists). On a technical level,
high-dimensional dataset for yourself. However you actu- this research imports and extends the machinery of spin
ally possess an even higher-dimensional dataset than you glass physics (replica method, cavity method, and mes-
probably would admit to yourself. For example you are sage passing) to analyze high-dimensional linear models
29

0 1 2 3

(1, 0, 0, 0) (0, 1, 0, 0) (0, 0, 1, 0) (0, 0, 0, 1)

FIG. 18 Pictorial representation of four data categories la-


beled by the integers 0 through 3 (above), or by one-hot vec-
tors with binary inputs (below).

(Advani and Ganguli, 2016; Fisher and Mehta, 2015a,b;


Krzakala et al., 2014, 2012a,b; Ramezanali et al., 2015; FIG. 19 Classifying data in the simplest case of only two
Zdeborová and Krzakala, 2016). This is a rich area categories, labeled “noise” and “signal” (or “cats” and “dogs”),
of activity at the intersection of physics, computer sci- is the subject of Logistic Regression.
ence, information theory, and machine learning and in-
terested readers are encouraged to consult the literature
for further information (see also (Mezard and Montanari, output classes from the design matrix X ∈ Rn×p made of
2009)). n samples, each of which bears p features. The primary
goal is to identify the classes to which new unseen samples
belong.
Before delving into the details of logistic regression, it
VII. LOGISTIC REGRESSION
is helpful to consider a slightly simpler classifier: a lin-
ear classifier that categorizes examples using a weighted
So far we have focused on learning from datasets for
linear-combination of the features and an additive offset:
which there is a “continuous” output. For example, in
linear regression we were concerned with learning the co- si = xTi w + b0 ≡ xTi w, (68)
efficients of a polynomial to predict the response of a
continuous variable yi on unseen data based on its inde- where we use the short-hand notation xi = (1, xi ) and
pendent variables xi . However, a wide variety of prob- w = (b0 , w). This function takes values on the entire real
lems, such as classification, are concerned with outcomes axis. In the case of logistic regression, however, the labels
taking the form of discrete variables (i.e. categories). yi are discrete variables. One simple way to get a discrete
For example, we may want to detect if there is a cat or output is to have sign functions that map the output of
a dog in an image. Or given a spin configuration of, say, a linear regressor to {0, 1}, σ(si ) = sign(si ) = 1 if si ≥ 0
the 2D Ising model, we would like to identify its phase and 0 otherwise. Indeed, this is commonly known as the
(e.g. ordered/disordered). In this section, we introduce “perceptron” in the machine learning literature.
logistic regression which deals with binary, dichotomous
outcomes (e.g. True or False, Success or Failure, etc.).
A. The cross-entropy as a cost function for logistic regression
We encourage the reader to use the opportunity to build
their intuition about the inner workings of logistic regres- The perceptron is an example of a “hard classification”:
sion, as this will prove valuable later on in the study of each datapoint is assigned to a category (i.e. yi = 0 or
modern supervised Deep Learning models (see Sec. IX). yi = 1). Even though the perceptron is an extremely
This section is structured as follows: first, we define simple model, it is favorable in many cases (e.g. when
logistic regression and derive its corresponding cost func- dealing with noisy data) to have a “soft” classifier that
tion (the cross entropy) using a Bayesian approach, and outputs the probability of a given category. For example,
discuss its minimization. Then, we generalize logistic re- given xi , the classifier returns the probability of being in
gression to the case of multiple categories which is called category m. One such function is the logistic (or sigmoid)
SoftMax regression. We demonstrate how to apply logis- function:
tic regression using three different problems: (i) classify-
1
ing phases of the 2D Ising model, (ii) learning features σ(s) = . (69)
in the SUSY dataset, and (iii) MNIST handwritten digit 1 + e−s
classification. Note that 1 − σ(s) = σ(−s), which will be useful shortly.
Throughout this section, we consider the case where In many cases, it is favorable to work with a “soft” clas-
the dependent variables yi ∈ Z are discrete and only sifier.
take values from m = 0, . . . , M − 1 (which enumerate Logistic regression is the canonical example of a soft
the M classes), see Fig. 18. The goal is to predict the classifier. In logistic regression, the probability that a
30

data point xi belongs to a category yi = {0, 1} is given Since the cost (error) function is just the negative log-
by likelihood, for logistic regression we find

1 C(w) = −l(w) (76)


P (yi = 1|xi , θ) = T , n
1 + e−xi θ X
−yi log σ(xTi w) − (1 − yi ) log 1 − σ(xTi w) .
 
P (yi = 0|xi , θ) = 1 − P (yi = 1|xi , θ), (70) =
i=1

where θ = w are the weights we wish to learn from the The right-hand side in Eq. (76) is known in statistics as
data. To gain some intuition for these equations, consider the cross entropy.
a collection of non-interacting two-state systems coupled Having specified the cost function for logistic regres-
to a thermal bath (e.g. a collection of atoms that can be sion, we note that, just as in linear regression, in practice
in two states). Furthermore, denote the state of system we usually supplement the cross-entropy with additional
i by a binary variable: yi ∈ {0, 1}. From elementary regularization terms, usually L1 and L2 regularization
statistical mechanics, we know that if the two states have (see Sec. VI for discussion of these regularizers).
energies 0 and 1 the probability for finding the system
in a state yi is:
B. Minimizing the cross entropy
e−β0 1
P (yi = 1) = −β0 = ,
e + e−β1 1 + e−β∆ The cross entropy is a convex function of the weights w
P (yi = 1) = 1 − P (yi = 0). (71) and, therefore, any local minimizer is a global minimizer.
Minimizing this cost function leads to the following equa-
Notice that in these expressions, as is often the case in tion
physics, only energy differences are observable. If the n
difference in energies between two states is given by ∆ = 0 = ∇C(w) =
X 
σ(xTi w) − yi xi ,

(77)
xTi w, we recover the expressions for logistic regression. i=1
We shall use this mapping between partition functions
and classification to generalize the logistic regressor to where we made use of the logistic function identity
SoftMax regression in Sec. VII.D. Notice that in terms ∂z σ(s) = σ(s)[1−σ(s)]. Equation (77) defines a transcen-
of the logistic function, we can write dental equation for w, the solution of which, unlike linear
regression, cannot be written in a closed form. For this
P (yi = 1) = σ(xTi w) = 1 − P (yi = 0). (72) reason, one must use numerical methods such as those
introduced in Sec. IV to solve this optimization problem.
We now define the cost function for logistic regression
using Maximum Likelihood Estimation (MLE). Recall,
that in MLE we choose parameters to maximize the prob- C. Examples of binary classification
ability of seeing the observed data. Consider a dataset
D = {(yi , xi )} with binary labels yi ∈ {0, 1} from which Let us now show how to use logistic regression in
the data points are drawn independently. The likelihood practice. In this section, we showcase two pedagogi-
of observing the data under our model is just: cal examples to train a logistic regressor to classify bi-
nary data. Each example comes with a corresponding
n
Y yi  1−yi Jupyter notebook, see https://physics.bu.edu/ panka-
σ(xTi w) 1 − σ(xTi w)

P (D|w) = jm/MLnotebooks.html.
i=1
(73)
1. Identifying the phases of the 2D Ising model
from which we can readily compute the log-likelihood:
The goal of this example is to show how one can employ
n
X logistic regression to classify the states of the 2D Ising
yi log σ(xTi w) + (1 − yi ) log 1 − σ(xTi w) .
 
l(w) = model according to their phase of matter.
i=1
(74) The Hamiltonian for the classical Ising model is given
The maximum likelihood estimator is defined as the set by
of parameters that maximize the log-likelihood: X
H = −J Si Sj , Sj ∈ {±1}, (78)
n
X hiji
yi log σ(xTi w)+(1−yi ) log 1 − σ(xTi w) .
 
ŵ = arg max
θ i=1 where the lattice site indices i, j run over all nearest
(75) neighbors of a 2D square lattice, and J is an interaction
31

ordered phase critical region disordered phase


0 0 0

10 10 10

20 20 20

30 30 30

0 20 0 20 0 20

FIG. 20 Examples of typical states of the 2D Ising model for three different temperatures in the ordered phase (T /J = 0.75,
left), the critical region (T /J = 2.25, middle) and the disordered phase (T /J = 4.0, right). The linear system dimension is
L = 40 sites.

energy scale. We adopt periodic boundary conditions. to, among other things, critical slowing down of the MC
Onsager proved that this model undergoes a phase tran- algorithm. Perhaps identifying the phases is also harder
sition in the thermodynamic limit from an ordered fer- in the critical region. With this in mind, consider the
romagnet with all spins aligned to a disordered √ phase at following three types of states: ordered (T /J < 2.0),
the critical temperature Tc /J = 2/ log(1 + 2) ≈ 2.26. near-critical (2.0 ≤ T /J ≤ 2.5) and disordered (T /J >
For any finite system size, this critical point is smeared 2.5). We use both ordered and disordered states to train
out to a critical region around Tc . the logistic regressor and, once the supervised training
An interesting question to ask is whether one can procedure is complete, we will evaluate the performance
train a statistical classifier to distinguish between the two of our classification model on unseen ordered, disordered,
phases of the Ising model. If successful, this can be used and near-critical states.
to locate the position of the critical point in more compli- Here, we deploy the liblinear routine (the default for
cated models where an exact analytical solution has so far Scikit’s logistic regression) and stochastic gradient de-
remained elusive (Morningstar and Melko, 2017; Zhang scent (SGD, see Sec. IV for details) to optimize the logis-
et al., 2017b). In other words, given an Ising state, we tic regression cost function with L2 regularization. We
would like to classify whether it belongs to the ordered or define the accuracy of the classifier as the percentage of
the disordered phase, without any additional information correctly classified data points. Comparing the accuracy
other than the spin configuration itself. This categorical on the training and test data, we can study the degree
machine learning problem is well suited for logistic re- of overfitting. The first thing to notice in Fig. 21 is the
gression, and will thus consist of recognizing whether a small degree of overfitting, as suggested by the training
given state is ordered by looking at its bit configurations. (blue) and test (red) accuracy curves being very close to
Notice that, for the purposes of applying logistic regres- each other. Interestingly, the liblinear minimizer outper-
sion, the 2D spin state of the Ising model will be flattened forms SGD on the training and test data, but not on the
out to a 1D array, so it will not be possible to learn in- near-critical data for certain values of the regularization
formation about the structure of the contiguous ordered strength λ. Moreover, similar to the linear regression
2D domains [see Fig. 20]. Such information can be incor- examples, we find that there exists a sweet spot for the
porated using deep convolutional neural networks, see SGD regularization strength λ that results in optimal
Section IX. performance of the logistic regressor, at about λ ∼ 10−1 .
To this end, we consider the 2D Ising model on a 40×40 We might expect that the difficulty of the phase recogni-
square lattice, and use Monte-Carlo (MC) sampling to tion problem depends on the temperature of the queried
prepare 104 states at every fixed temperature T out of sample. Looking at the states in the near-critical region,
a pre-defined set. We furthermore assign a label to each c.f. Fig. 20, it is no longer easy for a trained human eye
state according to its phase: 0 if the state is disordered, to distinguish between the ferromagnetic and the disor-
and 1 if it is ordered. dered phases close to Tc . Therefore, it is interesting to
It is well-known that near the critical temperature Tc , also compare the training and test accuracies to the ac-
the ferromagnetic correlation length diverges, which leads curacy of the near-critical state predictions. (Recall that
32

nal state particles directly, we will use the output of our


0.7 logistic regression to define a part of phase space that is
enriched in signal events (see Jupyter notebookNotebook
5).
0.6 The dataset we are using comes from the UC Irvine
accuracy

ML repository and has been produced using Monte Carlo


simulations to contain events with two leptons (electrons
0.5 or muons) (Baldi et al., 2014). Each event has the value
train of 18 kinematic variables (“features”). The first 8 fea-
test tures are direct measurements of final state particles, in
0.4 this case the pT , pseudo-rapidity η, and azimuthal an-
critical gle φ of two leptons in the event and the amount of
missing transverse momentum (MET) together with its
10−4 10−2 100 102 104 azimuthal angle. The last ten features are higher or-
λ der functions of the first 8 features; these features are
derived by physicists to help discriminate between the
FIG. 21 Accuracy as a function of the regularization param-
two classes. These high-level features can be thought of
eter λ in classifying the phases of the 2D Ising model on the
training (blue), test (red), and critical (green) data. The solid as the physicists’ attempt to use non-linear functions to
and dashed lines compare the ‘liblinear’ and ‘SGD’ solvers, re- classify signal and background events, having been de-
spectively. veloped with formidable theoretical effort. Here, we will
use only logistic regression to attempt to classify events
as either signal (that is, coming from a SUSY process)
the model is not trained on near-critical states.) Indeed, or background (events from some already observed Stan-
the liblinear accuracy is about 7% smaller for the criti- dard Model process). Later on in the review, in Sec. IX,
cal states (green curves) compared to the test data (red we shall revisit the same problem with the tools of Deep
line). Learning.
Finally, it is important to note that all of Scikit’s logis- As stated before, we never know the true underlying
tic regression solvers have in-built regularizers. We did process, and hence the goal in these types of analyses
not emphasize the role of the regularizers in this section, is to find regions enriched in signal events. If we find
but they are crucial in order to prevent overfitting. We an excess of events above what is expected, we can have
encourage the interested reader to play with the different confidence that they are coming from the type of sig-
regularization types and numerical solvers in Notebook 6 nal we are searching for. Therefore, the two metrics of
and compare model performances. import are the efficiency of signal selection, and the back-
ground rejection achieved (also called detection/rejection
rates and similar to recall/precision). Oftentimes, rather
2. SUSY than thinking about just a single working point, perfor-
mance is characterized by Receiver Operator Charecter-
In high energy physics experiments, such as the AT- istic curves (ROC curves). These ROC curves plot signal
LAS and CMS detectors at the CERN LHC, one major efficiency versus background rejection at various thresh-
hope is the discovery of new particles. To accomplish this olds of some discriminating variable. Here that variable
task, physicists attempt to sift through events and clas- will be the output signal probability of our logistic re-
sify them as either a signal of some new physical process gression. Figure 22 shows examples of these outputs for
or particle, or as a background event from already un- true signal events (left) and background events (right)
derstood Standard Model processes. Unfortunately, we using L2 regularization with a regularization parameter
don’t know for sure what underlying physical process oc- of 10−5 .
curred (the only information we have access to are the Notice that while the majority of signal events receive
final state particles). However, we can attempt to de- high probabilities of passing our discriminator and the
fine parts of phase space that will have a high percentage majority of background events receive low probabilities,
of signal events. Typically this is done by using a se- some signal events look background-like, and some back-
ries of simple requirements on the kinematic quantities ground events look signal-like to our discriminator. This
of the final state particles, for example having one or is further reason to characterize performance of our selec-
more leptons with large amounts of momentum that are tion in terms of ROC curves. Figure 23 shows examples
transverse to the beam line (pT ). Instead, here we will of these curves using L2 regularization for many different
use logistic regression in an attempt to find the relative regularization parameters using two different ML python
probability that an event is from a signal or a background packages, either TensorFlow (top) or Sci-Kit Learn (bot-
event. Rather than using the kinematic quantities of fi- tom), when using the full set of 18 input variables. Notice
33

FIG. 22 The probability of an event being a classified as a signal event for true signal events (left, blue) and background events
(right, red).

there is minimal overfitting, in part because we trained we’ve already come up with a set of discriminating vari-
on such a large dataset (4.5 million events). More impor- ables, including higher order ones derived from theories
tantly, however, is the underlying data we are working about SUSY particles, it’s worth reflecting on whether
with: each input variable is an important feature. there is utility to the increased sophistication of ML. To
show why we would want to use such a technique, recall
that, even to the learning algorithm, some signal events
and background events look similar. We can illustrate
this directly by looking at a plot comparing the pT spec-
trum of the two highest pT leptons (often referred to as
the leading and sub-leading leptons) for both signal and
background events. Figure 24 shows these two distribu-
tions, and one can see that while some signal events are
easily distinguished, many live in the same part of phase
space as the background. This effect can also be seen by
looking at figure 22 where you can see that some signal
events look like background events and vice-versa.

FIG. 24 Comparison of leading vs. sub-leading lepton pT for


FIG. 23 ROC curves for a variety of regularization parame- signal (blue) and background events (red). Recall that these
ters with L2 regularization using TensorFlow (top) or Sci-Kit variables have been scaled to have a mean of one.
Learn (bottom).
One could then ask how much discrimination power
While figure 23 shows nice discrimination power be- is obtained by simply putting different requirements on
tween signal and background events, the adoption of ML the input variables rather than using ML techniques. In
techniques adds complication to any analysis. Given that order to compare this strategy (often referred to as cut-
34

based in the field of HEP) to our regression results, differ-


ent ROC curves have been made for each of the following 0 5 10 15 20 25
cases: logistic regression with just the simple kinematic
0
variables, logistic regression with the full set of variables,
and simply putting a requirement on the leading lepton
pT . Figure 25 shows that there is a clear performance 5
benefit from using logistic regression. Note also that in
the cut-based approach we have only used one variable
where we could have put requirements on all of them. 10
While putting more requirements would indeed increase
background rejection, it would also decrease signal effi-
ciency. Hence, the cut-based approach will never yield as 15
strong discrimination as the logistic regression we have
performed. One other interesting point about these re-
sults is that the higher-order variables noticeably help the 20
ML techniques. In later sections, we will return to this
point to see if more sophisticated techniques can provide
further improvement. 25

FIG. 26 An example of an input datapoint from the MNIST


data set. Each datapoint is a 28 × 28-pixel image of a hand-
written digit, with its corresponding label belonging to one
of the 10 digits. Each pixel contains a greyscale value repre-
sented by an integer between 0 and 255.

the probability of xi being in class m0 is given by


T
e−xi wm0
P (yim0 = 1|xi , {wk }M −1
k=0 ) = PM −1 −xT wm , (79)
m=0 e
i

where yim0 ≡ [yi ]m0 refers to the m0 -th component of vec-


FIG. 25 A comparison of discrimination power from using lo- tor yi . This is known as the SoftMax function. There-
gistic regression with only simple kinematic variables (green), fore, the likelihood of this M -class classifier is simply
logistic regression using both simple and higher-order kine- (cf. Sec. VII.A):
matic variables (purple), and a cut-based approach that varies
n M −1
the requirements on the leading lepton pT . Y Y yim
P (D|{wk }M −1
k=0 ) = [P (yim = 1|xi , wm )]
i=1 m=0
1−yim
× [1 − P (yim = 1|xi , wm )] (80)
D. Softmax Regression from which we can define the cost function in a similar
fashion:
So far we have focused only on binary classification,
n M −1
in which the labels are dichotomous variables. Here we X X
C(w) = − yim log P (yim = 1|xi , wm )
generalize logistic regression to multi-class classification.
i=1 m=0
One approach is to treat the label as a vector yi ∈ ZM 2 ,
+ (1 − yim ) log (1 − P (yim = 1|xi , wm )) . (81)
namely a binary string of length M with only one com-
ponent of yi being 1 and the rest zero. For example, As expected, for M = 1, we recover the cross entropy for
yi = (1, 0, · · · , 0) means data the sample xi belongs to logistic regression, cf. Eq. (76).
class 17 , cf. Fig. 18. Following the notation in Sec. VII.A,

E. An Example of SoftMax Classification: MNIST Digit


Classification
7 For an alternative mathematical description of the categories,
which labels the classes by integers, see http://ufldl.stanford. A paradigmatic example of SoftMax regression is to
edu/wiki/index.php/Softmax_Regression. classify handwritten digits from the MNIST dataset.
35

Yann LeCun and collaborators first collected and pro- (Freund et al., 1999; Freund and Schapire, 1995; Schapire
cessed 70000 handwritten digits, each of which is laid and Freund, 2012), random forests (Breiman, 2001),
out on a 28 × 28-pixel grid. Every pixel assumes one and gradient boosted trees such as XGBoost (Chen and
of 256 grayscale values, interpolating between white and Guestrin, 2016).
black. A representative input sample is show in Fig. 26.
Since there are 10 categories for the digits 0 through 9,
this corresponds to SoftMax regression with M = 10. We A. Revisiting the Bias-Variance Tradeoff for Ensembles
encourage readers to experiment with Notebook 7 to ex-
plore SoftMax regression applied to MNIST. We include The bias-variance tradeoff summarizes the fundamen-
in Fig. 27 the learned weights wk , where k corresponds to tal tension in machine learning between the complexity
class labels (i.e. digits). We shall come back to SoftMax of a model and the amount of training data needed to fit
regression in Sec. IX. it (see Sec. III). Since data is often limited, in practice
it is frequently useful to use a less complex model with
higher bias – a model whose asymptotic performance is
VIII. COMBINING MODELS worse than another model – because it is easier to train
and less sensitive to sampling noise arising from having a
One of the most powerful and widely-applied ideas in finite-sized training dataset (i.e. smaller variance). Here,
modern machine learning is the use of ensemble methods we will revisit the bias-variance tradeoff in the context
that combine predictions from multiple, often weak, sta- of ensembles, drawing upon the beautiful discussion in
tistical models to improve predictive performance (Diet- Ref. (Louppe, 2014).
terich et al., 2000). Ensemble methods, such as random A key property that will emerge from this analysis is
forests (Breiman, 2001; Geurts et al., 2006; Ho, 1998), the correlation between models that constitute the en-
and boosted gradient trees, such as XGBoost (Chen and semble. The degree of correlation between models9 is
Guestrin, 2016; Friedman, 2001), undergird many of the important for two distinct reasons. First, holding the en-
winning entries in data science competitions such as Kag- semble size fixed, averaging the predictions of correlated
gle, especially on structured datasets 8 . Even in the con- models reduces the variance less than averaging uncor-
text of neural networks, see Sec. IX, it is common to related models. Second, in some cases, correlations be-
combine predictions from multiple neural networks to in- tween models within an ensemble can result in an in-
crease performance on tough image classification tasks crease in bias, offsetting any potential reduction in vari-
(He et al., 2015; Ioffe and Szegedy, 2015). ance gained from ensemble averaging. We will discuss
In this section, we give an overview of ensemble meth- this in the context of bagging below. One of the most
ods and provide rules of thumb for when and why they dramatic examples of increased bias from correlations is
work. On one hand, the idea of training multiple models the catastrophic predictive failure of almost all derivative
and then using a weighted sum of the predictions of the models used by Wall Street during the 2008 financial cri-
all these models is very natural. After all, the idea of the sis.
“wisdom of the crowds” can be traced back, at least, to
the writings of Aristotle in Politics. On the other hand,
one can also imagine that the ensemble predictions can 1. Bias-Variance Decomposition for Ensembles
be much worse than the predictions from each of the in-
dividual models that constitute the ensemble, especially We will discuss the bias-variance tradeoff in the con-
when pooling reinforces weak but correlated deficiencies text of continuous predictions such as regression. How-
in each of the individual predictors. Thus, it is impor- ever, many of the intuitions and ideas discussed here also
tant to understand when we expect ensemble methods to carry over to classification tasks. Before discussing en-
work. sembles, let us briefly review the bias-variance tradeoff in
In order to do this, we will revisit the bias-variance the context of a single model. Consider a data set consist-
trade-off, discussed in Sec. III, and generalize it to con- ing of data XL = {(yj , xj ), j = 1 . . . N }. Let us assume
sider an ensemble of classifiers. We will show that the that the true data is generated from a noisy model
key to determining when ensemble methods work is the y = f (x) + , (82)
degree of correlation between the models in the ensemble
(Louppe, 2014). Armed with this intuition, we will intro- where  is a normally distributed with mean zero and
duce some of the most widely-used and powerful ensem- standard deviation σ .
ble methods including bagging (Breiman, 1996), boosting
9 For example, the correlation coefficient between the predictions
made by two randomized models based on the same training set
8 Neural networks generally perform better than ensemble meth- but with different random seeds, see Sec. VIII.A.1 for precise
ods on unstructured data, images, and audio. definition.
36

classification weights vector wj for digit class j

Class 0 Class 1 Class 2 Class 3 Class 4

Class 5 Class 6 Class 7 Class 8 Class 9

FIG. 27 Visualization of the weights wj after training a SoftMax Regression model on the MNIST dataset (see Notebook
7). We emphasize that SoftMax Regression does not have explicit 2D spatial knowledge; the model learns from data points
flattened out in a one-dimensional array.

Assume that we have a statistical procedure (e.g. least- where the bias,
squares regression) for forming a predictor ĝL (x) that X
gives the prediction of our model for a new data point x Bias2 = (f (xi ) − EL [ĝL (xi )])2 , (85)
given that we trained the model using a dataset L. This i
estimator is chosen by minimizing a cost function which,
for the sake of concreteness, we take to be the squared measures the deviation of the expectation value of our es-
error timator (i.e. the asymptotic value of our estimator in the
limit of infinite data) from the true value. The variance
X
C(X, g(x)) = (yi − ĝL (xi ))2 . (83) X
i
V ar = EL [(ĝL (xi ) − EL [ĝL (xi )])2 ], (86)
i
The dataset L is drawn from some underlying distribu-
measures how much our estimator fluctuates due to
tion that describes the data. If we imagine drawing many
finite-sample effects. The noise term
datasets {Lj } of the same size as L from this distribu-
tion, we know that the corresponding estimators ĝLj (x) X
N oise = σ2i (87)
will differ from each other due to stochastic effects aris-
i
ing from sampling noise. For this reason, we can view
our estimator ĝL (x) as a random variable and define an is the part of the error due to intrinsic noise in the data
expectation value EL in the usual way. Note that the sub- generation process that no statistical estimator can over-
script denotes that the expectation is taken over L. In come.
practice, EL is computed by by drawing infinitely many Let us now generalize this to ensembles of estimators.
different datasets {Lj } of the same size, fitting the corre- Given a dataset XL and hyper-parameters θ that param-
sponding estimator, and then averaging the results. We eterize members of our ensemble, we will consider a pro-
will also average over different instances of the “noise” . cedure that deterministically generates a model ĝL (xi , θ)
The expectation value over the noise will be denoted by given XL and θ. We assume that the θ includes some
E . random parameters that introduce stochasticity into our
As discussed in Sec. III, we can decompose the ex- ensemble (e.g. an initial condition for stochastic gradient
pected generalization error as descent or a random subset of features or data points
used for training.) Concretely, with a giving dataset L,
EL, [C(X, g(x))] = Bias2 + V ar + N oise. (84) one has a learning algorithm A that generates a model
37

A(θ, L) based on a deterministic procedure which intro- Note that the expectation EL,θm [·] is computed over the
duced stochasticity through θ in its execution on dataset joint distribution of L and θm . Also, by definition, we
L. We will be concerned with the expected prediction assume m 6= m0 in CL,θm ,θm0 .
error of the aggregate ensemble predictor
M
1 X We can now ask about the expected generalization
A
ĝL (xi , {θ}) = ĝL (xi , θm ). (88) (out-of-sample) error for the ensemble
M m=1

For future reference, let us define the mean, variance,


and covariance (i.e. the connected correlation function in
the language of physics), and the normalized correlation
coefficient of a single randomized model ĝL (x, θm ) as: " #
X
A A 2
 
EL,θm [ĝL (x, θm )] = µL,θm (x) EL,,θ C(X, ĝL (x)) = EL,,θ (yi − ĝL (xi , {θ})) .
i
EL,θm [ĝL (x, θm ) ] − EL,θm [ĝL (x, θ)]2 = σL,θ
2 2
m
(x) (90)
EL,θm [ĝL (x, θm )ĝL (x, θm0 )] − Eθ [ĝL (x, θm )]2 = CL,θm ,θm0 (x) As in the single estimator case, we decompose the error
CL,θm ,θm0 (x) into a noise term, a bias-term, and a variance term. To
ρ(x) = 2 . (89) see this, note that
σL,θ

" #
X
A A
EL,,θ [C(X, ĝL (x))] = EL,,θ (yi − f (xi ) + f (xi ) − ĝL (xi , {θ}))2
i
X
= EL,,θ [(yi − f (xi ))2 + (f (xi ) − ĝL
A
(xi , {θ}))2 + 2(yi − f (xi ))(f (xi ) − ĝL
A
(xi , {θ}))]
i
X X
= σ2i + A
EL,θ [(f (xi ) − ĝL (xi , {θ}))2 ], (91)
i i

where in the last line we have used the fact that E [yi ] = f (xi ) to eliminate the last term. We can further decompose
the second term as
A
EL,θ [(f (xi ) − ĝL (xi , {θ}))2 ] = EL,θ [(f (xi ) − EL,θ [ĝL
A A
(xi , {θ})] + EL,θ [ĝL A
(xi , {θ})] − ĝL (xi , {θ}))2 ]
A
= EL,θ [(f (xi ) − EL,θ [ĝL (xi , {θ})])2 ] + EL,θ [(EL,θ [ĝL
A A
(xi , {θ})] − ĝL (xi , {θ}))2 ]
A A A
+ 2EL,θ [(EL,θ [ĝL (xi , {θ})] − ĝL (xi , {θ}))(f (xi ) − EL,θ [ĝL (xi , {θ})])]
A
= (f (xi ) − EL,θ [ĝL (xi , {θ})])2 + EL,θ [(ĝL
A A
(xi , {θ}) − EL,θ [ĝL (xi , {θ})])2 ]
≡ Bias2 (xi ) + V ar(xi ), (92)

where we have defined the bias of an aggregate predictor So far the calculation for ensembles is almost iden-
as tical to that of a single estimator. However, since the
aggregate estimator is a sum of estimators, its variance
Bias2 (x) ≡ (f (x) − EL,θ [ĝL
A
(x, {θ})])2 (93) implicitly depends on the correlations between the indi-
vidual estimators in the ensemble. Using the definition
and the variance as of the aggregate estimator Eq. (88) and the definitions in
Eq. (89), we see that
A
V ar(x) ≡ EL,θ [(ĝL A
(x, {θ}) − EL,θ [ĝL (x, {θ})])2 ]. (94)

A A
V ar(x) = EL,θ [(ĝL (x, {θ}) − EL,θ [ĝL (x, {θ})])2 ]
 
1 X X
= 2 EL,θ [ĝL (x, θm )ĝL (x, θm0 )] − M 2 [µL,θ (x)]2 
M 0 i
m,m

1 − ρ(x) 2
2
= ρ(x)σL,θ + σL,θ . (95)
M
38

The first reason is statistical. When the


learning set is too small, a learning algorithm
can typically find several models in the hy-
pothesis space H that all give the same per-
formance on the training data. Provided their
predictions are uncorrelated, averaging sev-
eral models reduces the risk of choosing the
wrong hypothesis. The second reason is com-
putational. Many learning algorithms rely on
Aggregating different linear Linear perceptron hypothesis some greedy assumption or local search that
hypotheses
may get stuck in local optima. As such, an en-
FIG. 28 Why combining models? On the left we show that semble made of individual models built from
by combining simple linear hypotheses (grey lines) one can many different starting points may provide
achieve better and more flexible classifications (dark line), a better approximation of the true unknown
which is in stark contrast to the case in which one only uses function than any of the single models. Fi-
a single perceptron hypothesis as shown on the right. nally, the third reason is representational. In
most cases, for a learning set of finite size, the
true function cannot be represented by any
This last formula is the key to understanding the power of the candidate models in H. By combin-
of random ensembles. Notice that by using large ensem- ing several models in an ensemble, it may be
bles (M → ∞), we can significantly reduce the variance, possible to expand the space of representable
and for completely random ensembles where the mod- functions and to better model the true func-
els are uncorrelated (ρ(x) = 0), maximally suppresses tion.
the variance! Thus, using the aggregate predictor beats
down fluctuations due to finite-sample effects. The key, The increase in representational power of ensembles
as the formula indicates, is to decorrelate the models as can be simply visualized. For example, the classification
much as possible while still using a very large ensemble. task shown in Fig. 28 reveals that it is more advanta-
One can be worried that this comes at the expense of a geous to combine a group of simple hypotheses (verti-
very large bias. This turns out not to be the case. When cal or horizontal lines) than to utilize a single arbitrary
models in the ensemble are completely random, the bias linear classifier. This of course comes with the price of
of the aggregate predictor is just the expected bias of a introducing more parameters to our learning procedure.
single model But if the problem itself can never be learned through a
simple hypothesis, then there is no reason to avoid ap-
Bias2 (x) = (f (x) − EL,θ [ĝL
A
(x, {θ})])2
plying a more complex model. Since ensemble methods
M
1 X reduce the variance and are often easier to train than a
= (f (x) − EL,θ [ĝL (x, θm )])2 (96)
M m=1 single complex model, they are a powerful way of increas-
ing representational power (also called expressivity in the
= (f (x) − µL,θ )2 . (97) ML literature).
Thus, for a random ensemble one can always add more Our analysis also gives several intuitions for how we
models without increasing the bias. This observation lies should construct ensembles. First, we should try to ran-
behind the immense power of random forest methods dis- domize ensemble construction as much as possible to re-
cussed below. For other methods, such as bagging, we duce the correlations between predictors in the ensemble.
will see that the bootstrapping procedure actually does This ensures that our variance will be reduced while min-
increase the bias. But in many cases, this increase in bias imizing an increase in bias due to correlated errors. Sec-
is negligible compared to the reduction in variance. ond, the ensembles will work best for procedures where
the error of the predictor is dominated by the variance
and not the bias. Thus, these methods are especially well
2. Summarizing the Theory and Intuitions behind Ensembles suited for unstable procedures whose results are sensitive
to small changes in the training dataset.
Before discussing specific methods, let us briefly sum- Finally, we note that although the discussion above
marize why ensembles have proven so successful in many was derived in the context of continuous predictors such
ML applications. Dietterich (Dietterich et al., 2000) as regression, the basic intuition behind using ensembles
identifies three distinct shortcomings that are fixed by applies equally well to classification tasks. Using an en-
ensemble methods: statistical, computational, and rep- semble allows one to reduce the variance by averaging the
resentational. These are explained in the following dis- result of many independent classifiers. As with regres-
cussion from Ref. (Louppe, 2014): sion, this procedure works best for unstable predictors
39

for which errors are dominated by variance due to finite This bootstrapping procedure allows us to construct an
sampling rather than bias. approximate ensemble and thus reduce the variance. For
unstable predictors, this can significantly improve the
predictive performance. The price we pay for using boot-
B. Bagging strapped training datasets, as opposed to really partition-
ing the dataset, is an increase in the bias of our bagged es-
BAGGing, or Bootstrap AGGregation, first introduced timators. To see this, note that as the number of datasets
by Leo Breiman, is one of the most widely employed and M goes to infinity, the expectation with respect to the
simplest ensemble-inspired methods (Breiman, 1996). bootstrapped samples converges to the empirical distri-
Imagine we have a very large dataset L that we could bution describing the training data set pL (x) (e.g. a delta
partition into M smaller data sets which we label function at each datapoint in L) which in general is dif-
{L1 , . . . , LM }. If each partition is sufficiently large to ferent from the true generative distribution for the data
learn a predictor, we can create an ensemble aggregate p(x).
predictor composed of predictors trained on each subset
of the data. For continuous predictors like regression,
this is just the average of all the individual predictors:
M
1 X
A
ĝL (x) = gL (x). (98)
M i=1 i

For classification tasks where each predictor predicts a


class label j ∈ {1, . . . , J}, this is just a majority vote of
all the predictors,
M
X
A
ĝL (x) = arg max I[gLi (x) = j], (99)
j
i=1

where I[gLi (x) = j] is an indicator function that is equal


to one if gLi (x) = j and zero otherwise. From the the-
oretical discussion above, we know that this can signifi-
cantly reduce the variance without increasing the bias.
While simple and intuitive, this form of aggregation
clearly works only when we have enough data in each par-
titioned set Li . To see this, one can consider the extreme
limit where Li contains exactly one point. In this case,
the base hypothesis gLi (x) (e.g. linear regressor) becomes
extremely poor and the procedure above fails. One way
to circumvent this shortcoming is to resort to empir-
ical bootstrapping, a resampling technique in statis-
tics introduced by Efron (Efron, 1979) (see accompany- In Fig. 30 we demonstrate bagging with a perceptron
ing box and Fig. 29). The idea of empirical bootstrap- (linear classifier) as the base classifier that constitutes
ping is to use sampling with replacement to create new the elements of the ensemble. It is clear that, although
“bootstrapped” datasets {LBS each individual classifier in the ensemble performs poorly
1 , . . . , LM } from our origi-
BS

nal dataset L. These bootstrapped datasets share many at classification, bagging these estimators yields reason-
points, but due to the sampling with replacement, are ably good predictive performance. This raises questions
all somewhat different from each other. In the bagging like why bagging works and how many bootstrap samples
procedure, we create an aggregate estimator by replac- are needed. As mentioned in the discussion above, bag-
ing the M independent datasets by the M bootstrapped ging is effective on “unstable” learning algorithms where
estimators: small changes in the training set result in large changes
in predictions (Breiman, 1996). When the procedure is
M
1 X unstable, the prediction error is dominated by the vari-
BS
ĝL (x) = g BS (x). (100)
M i=1 Li ance and one can exploit the aggregation component of
bagging to reduce the prediction error. In contrast, for
and a stable procedure the accuracy is limited by the bias
M introduced by using bootstrapped datasets. This means
that there is an instability-to-stability transition point
X
BS
ĝL (x) = arg max I[gLBS (x) = j]. (101)
j
i=1
i
beyond which bagging stops improving our prediction.
40

M̂ n ( D )
Brief Introduction to Bootstrapping

σ σ Suppose we are given a finite set of n data points


D = {X1 , · · · , Xn } as training samples and our
job is to construct measures of confidence for our
sample estimates (e.g. the confidence interval or
M n (1) M n (2) M n(B ) Bootstrap mean-squared error of sample median estimator).
replications
To do so, one first samples n points with re-
placement from D to get a new set D?(1) =
?(1) ?(1)
(1) (2) Bootstrap {X1 , · · · , Xn }, called a bootstrap sample,
D D . . . . . . . . . . . (B )
D samples which possibly contains repetitive elements. Then
we repeat the same procedure to get in total B
such sets: D?(1) , · · · , D?(B) . The next step is to
use these B bootstrap sets to get the bootstrap
estimate of the quantity of interest. For example,
Training ?(k)
D = { X 1, · · · , X n } samples let Mn = M edian(D?(k) ) be the sample median
of bootstrap data D?(k) . Then we can construct
FIG. 29 Shown here is the procedure of empirical bootstrap- the variance of the distribution of bootstrap medi-
ping. The goal is to assess the accuracy of a statistical quan- ans as :
tity of interest, which in the main text is illustrated as the
B
sample median M̂n (D). We start from a given dataset D and 1 X  ?(k) 2
bootstrap B size n datasets D?(1) , · · · , D?(B) called the boot-
Vd
arB (Mn ) = Mn − M̄n? , (102)
B−1
strap samples. Then we compute the statistical quantity of k=1
?(k)
interest on these bootstrap samples to get the median Mn , where
for k = 1, · · · , B. These are then used to evaluate the accu-
racy of M̂n (D) (see also box on Bootstrapping in main text). B
1 X ?(k)
It can be shown that in the n → ∞ limit the distribution M̄n? = Mn (103)
of Mn
?(k)
would be a Gaussian centered around M̂n (D) with B
k=1
variance σ 2 defined by Eq. (102) scales as 1/n.
is the mean of the median of all bootstrap sam-
ples. Specifically, Bickel and Freedman (Bickel and
Freedman, 1981) and Singh (Singh, 1981) showed
that in the n → ∞ limit, the distribution of the
bootstrap estimate will be a Gaussian centered
around M̂n (D) = M edian(X1 , · · · √
, Xn ) with stan-
dard deviation proportional to 1/ n. This means
that the bootstrap distribution M̂n? − M̂n approxi-
mates fairly well the sampling distribution M̂n −M
from which we obtain the training data D. Note
that M is the median based on which the true dis-
tribution D is generated. In other words, if we plot
?(k)
the histogram of {Mn }B k=1 , we will see that in
the large n limit it can be well fitted by a Gaus-
sian which sharp peaks at M̂n (D) and vanishing
variance whose definition is given by Eq. (102) (see
Fig. 29).

C. Boosting

Another powerful and widely used ensemble method is


Boosting. In bagging, the contribution of all predictors
is weighted equally in the bagged (aggregate) predictor.
However, in principle, there are myriad ways to combine
different predictors. In some problems one might prefer
to use an autocratic approach that emphasizes the best
predictors, while in others it might be better to opt for
41

esis/classifier g : X → Y to classify the data. Let


5
Bagging: o, True label: x H = {g : X → Y} be the family of classifiers available
4
in our ensemble. In the AdaBoost setting, we are con-
cerned with the classifiers that perform somehow better
3 than “tossing a fair coin”. This means that for each clas-
sifier, the family H can predict yi correctly at least half
2
of the time.
1 We construct the boosted classifier as follows:
x2

0 • Initialize wt=1 (xn ) = 1/N, n = 1, · · · , N .


−1 • For t = 1 · · · , T (desired termination step), do:
−2 1. Select a hypothesis gt ∈ H that minimizes the
−3 weighted error
−1.0 −0.5 0.0 0.5 1.0
x1 N
X
t = wt (xi )1(gt (xi ) 6= yi ) (105)
FIG. 30 Bagging applied to the perceptron learning
i=1
algorithm (PLA). Training data size n = 500, number of
bootstrap datasets B = 25, each contains 50 points. Col-
ors corresponds to different classes while the marker indicates t , update the weight for each
2. Let αt = 12 ln 1− t

how these points are labelled: cross for true label and circle data xn by
for that obtained by bagging. Each gray dashed line indicates
the prediction made, based on every bootstrap set while the exp[−αt yn gt (xn )]
wt+1 (xn ) ← wt (xn ) ,
dark dashed black line is the average of these. Zt
PN
where Zt = n=1 wt (xn )e−αt yn gt (xn ) ensures
more ‘democratic’ ways as is done in bagging. In all cases, all weights add up to unity.
the idea is to build a strong predictor by combining many P 
T
weaker classifiers. • Output gA (x) = sign α g
t=1 t t (x)
In boosting, an ensemble of weak classifiers {gk (x)}
is combined into an aggregate, boosted classifier. How- There are many theoretical and empirical studies on the
ever, unlike bagging, each classifier is associated with a performance of AdaBoost but they are beyond the scope
weight αk that indicates how much it contributes to the of this review. We refer interested readers to the exten-
aggregate classifier sive literature on boosting (Freund et al., 1999).

M
X
gA (x) = αk gk (x), (104) D. Random Forests
K=1

where k αk = 1. For the reasons outlined above, boost- Data


P
x = ( x1, x 2, x 3)
ing, like all ensemble methods, works best when we com- y= { }
bine simple, high-variance classifiers into a more complex
x1 ≥ 0
whole.
Here, we focus on “adaptive boosting” or AdaBoost, True False
first proposed by Freund and Schapire in the mid 1990s
(Freund et al., 1999; Freund and Schapire, 1995; Schapire x2 ≥ 0 x3 ≥ 0
and Freund, 2012). The basic idea behind AdaBoost, True False True False
is to form the aggregate classifier in an iterative pro-
cess. Importantly, at each iteration we reweight the error
function to "highlight" data points where the aggregate
classifier performs poorly (so that in the next round the
procedure put more emphasis on making those right.) In FIG. 31 Example of a decision tree. For an input observation
this way, we can successively ensure that our classifier x, its label y is predicted by traversing it from the root all
has good performance over the whole dataset. the way down the leaves, following branches it satisfies.
We now discuss the AdaBoost procedure in greater
detail. Suppose that we are given a data set L = We now briefly review one of the most widely used and
{(xi , yi ), i = 1, · · · , N } where xi ∈ X and yi ∈ Y = versatile algorithms in data science and machine learning,
{+1, −1}. Our objective is to find an optimal hypoth- Random Forests (RF). Random Forests is an ensemble
42

method widely deployed for complex classification tasks.


A random forest is composed of a family of (randomized)
tree-based classifier decision trees (discussed below). De-
cision trees are high-variance, weak classifiers that can
be easily randomized, and as such, are ideally suited for
ensemble-based methods. Below, we give a brief high-
level introduction to these ideas.
A decision tree uses a series of questions to hierarchi-
cally partition the data. Each branch of the decision tree
consists of a question that splits the data into smaller
subsets (e.g. is some feature larger than a given num-
ber? See Fig. 31), with the leaves (end points) of the
tree corresponding to the ultimate partitions of the data.
When using decision trees for classification, the goal is
to construct trees such that the partitions are informa-
tive about the class label (see Fig. 31). It is clear that FIG. 32 Classifying Iris dataset with aggregation models for
scikit learn tutorial. This dataset seeks to classify iris flow-
more complex decision trees lead to finer partitions that ers into three types (labeled in red, blue, or yellow) based on
give improved performance on the training set. How- a measurement of four features: septal length septal width,
ever, this generally leads to over-fitting10 , limiting the petal length, and petal width. To visualize the decision sur-
out-of-sample performance. For this reason, in practice face, we trained classifiers using only two of the four potential
almost all decision trees use some form of regularization features (e..g septal length, septal width). Each row corre-
(e.g. maximum depth for the tree) to control complex- sponds to a different subset of two features and the columns
ity and reduce overfitting. Decision trees also have ex- to a Decision Tree with 10-fold CV (first column), Random
Forest with 30 trees and 10-fold CV (second column) and
tremely high variance, and are often extremely sensitive AdaBoost with 30 base hypotheses (third column). Decision
to many details of the training data. This is not surpris- surface learned is highlighted by color shades. See the corre-
ing since decision trees are learned by partitioning the sponding tutorial for more details (Pedregosa et al., 2011)
training data. Therefore, individual decision trees are
weak classifiers. However, these same properties make
them ideal for incorporation in an ensemble method. though this reduces the predictive power of each indi-
In order to create an ensemble of decision trees, we vidual decision tree, it still often improves the predictive
must introduce a randomization procedure. As discussed power of the ensemble because it dramatically reduces
above, the power of ensembles to reduce variance only correlations between members and prevents overfitting.
manifests when randomness reduces correlations between Examples of the kind of decision surfaces found by de-
the classifiers within the ensemble. Randomness is usu- cision trees, random forests, and Adaboost are shown in
ally introduced into random forests in one of three dis- Fig. 32. We invite the reader to check out the correspond-
tinct ways. The first is to use bagging and simply “bag” ing scikit-learn tutorial for more details of how these are
the decision trees by training each decision tree on a dif- implemented in python (Pedregosa et al., 2011).
ferent bootstrapped dataset (Breiman, 2001). Strictly There are many different types of decision trees and
speaking, this procedure does not constitute a random training procedures. A full discussion of decision trees
forest but rather a bagged decision tree. The second (and random forests) lies beyond the scope of this review
procedure is to only use a different random subset of and we refer readers to the extensive literature on these
the features at each split in the tree. This “feature topics (Lim et al., 2000; Loh, 2011; Louppe, 2014). Re-
bagging” is the distinguishing characteristic of random cently, decision trees were applied in high-energy physics
forests (Breiman, 2001; Ho, 1998). Using feature bag- to study to learn non-Higgsable gauge groups (Wang and
ging reduces correlations between decision trees that can Zhang, 2018).
arise when only a few features are strongly predictive
of the class label. Finally, extremized random forests
(ERFs) combine ordinary and feature bagging with an E. Gradient Boosted Trees and XGBoost
extreme randomization procedure where splitting is done
randomly instead of using optimality criteria (see for de- Before we turn to applications of these techniques, we
tails Refs. (Geurts et al., 2006; Louppe, 2014)). Even briefly discuss one final class of ensemble methods that
has become increasingly popular in the last few years:
Gradient-Boosted Trees (Chen and Guestrin, 2016; Fried-
man, 2001). The basic idea of gradient-boosted trees is
10 One extreme limit is an n−node tree, with n being the number to use intuition from boosting and gradient descent (in
of data point in the dataset given. particular Newton’s method, see Sec. IV) to construct
43

ensembles of decision trees. Like in boosting, the ensem- nalizes both large weights on the leaves (similar to L2 -
bles are created by iteratively adding new decision trees regularization) and having large partitions with many
to the ensemble. In gradient boosted trees, one critical leaves.
component is the a cost function that measures the per- As in boosting, we form the ensemble iteratively. For
formance of our ensemble. At each step, we compute (t)
this reason, we define a family of predictors ŷi as
the gradient of the cost function with respect to the pre-
t
dicted value of the ensemble and add trees that move us (t)
X (t−1)
ŷi = gj (xi ) = ŷi + gt (xi ). (109)
in the direction of the gradient. Of course, this requires
j=1
a clever way of mapping gradients to decision trees. We
give a brief overview of how this is done within XGBoost Note that by definition yi
(M )
= gA (xi ). The central idea
(Extreme Gradient Boosting), which has recently been is that for large t, each decision tree is a small pertur-
applied, to classify and rank transcription factor binding bation to the predictor (of order 1/T ) and hence we can
in DNA sequences (Li et al., 2018). Below, we follow perform a Taylor expansion on our loss function to second
closely the XGboost tutorial. order:
Our starting point is a clever parametrization of de- N
cision trees. Here, we use notation where the deci- X (t−1)
Ct = l(yi , ŷi + gt (xi )) + Ω(gt )
sion tree makes continuous predictions (regression trees),
i=1
though this can also easily be generalized to classifica-
≈ Ct−1 + ∆Ct , (110)
tion tasks. We parametrize a decision tree j, denoted
as gj (x), with T leaves by two quantities: a function with
q(x) that maps each data point to one of the leaves of 1
the tree, q : x ∈ Rd → {1, 2 . . . , T } and a weight vector ∆Ct = ai gt (xi ) + bi gt (xi )2 + Ω(gt ), (111)
2
w ∈ RT that assigns a predicted value to each leaf. In
other words, the j-th decision tree’s prediction for the where
datapoint xi is simply: gj (xi ) = wq(xi ) . ai = ∂ŷ(t−1) l(yi , ŷi
(t−1)
), (112)
In addition to a parametrization of decision trees, we i

also have to specify a cost function which measures pre-


(t−1)
dictions. The prediction of our ensemble for a datapoint bi = ∂ŷ2(t−1) l(yi , ŷi ). (113)
(yi , xi ) is given by i

We then choose the t-th decision tree gt to minimize ∆Ct .


M
X This is almost identical to how we derived the Newton
ŷi = gA (xi ) = gj (xi ), gj ∈ F (106)
method update in the section on gradient descent, see
j=1
Sec. IV.
where gj (xi ) is the prediction of the j-th decision tree on We can actually derive an expression for the param-
datapoint xi , M is the number of members of the ensem- eters of gt that minimize ∆Ct analytically. To simplify
ble, and F = {g(x) = wq(x) } is the space of trees. As notation, it is useful to define the set of points xi that get
discussed in the context of random trees above, without mappedP to leaf j: Ij = {i P : qt (xi ) = j} and the functions
regularization, decision trees tend to overfit the data by Bj = i∈Ij bi and Aj = i∈Ij ai . Notice that in terms
dividing it into smaller and smaller partitions. For this of these quantities, we can write
reason, our cost function is generally composed of two
T
terms, a term that measures the goodness of predictions X 1
∆Ct = [Aj wj + (Bj + λ)wj2 ] + γT, (114)
on each datapoint, li (yi , ŷi ), which is assumed to be dif- 2
j=1
ferentiable and convex, and for each tree in the ensemble,
a regularization term Ω(gj ) that does not depend on the where we made the t-dependence of all parameters im-
data: plicit. Note that λ comes from the regularization term,
N M Ω(gt ), through Eq.(108). To find the optimal wj , just as
in Newton’s method we take the gradient of the above
X X
C(X, gA ) = l(yi , ŷi ) + Ω(gj ), (107)
i=1 j=1 expression with respect to wj and set this equal to zero,
to get
where the index i runs over data points and the index j
runs over decision trees in our ensemble. In XGBoost, wjopt = −
Aj
. (115)
the regularization function is chosen to be Bj + λ
λ Plugging this expression into ∆Ct gives
Ω(g) = γT + ||w||22 , (108)
2 T
with γ and λ regularization parameters that must be 1 X A2j
∆Ctopt = − + γT. (116)
chosen appropriately. Notice that this regularization pe- 2 j=1 Bj + λ
44

It is clear that ∆Ctopt measures the in-sample performance 1.00


Train (coarse)
of gt and we should find the decision tree that minimizes 0.95 Test (coarse)
Critical (coarse)
this value. In principle, one could enumerate all possi- 0.90 Train (fine)
ble trees over the data and find the tree that minimizes Test (fine)
0.85 Critical (coarse)

Accuracy
∆Ctopt . However, in practice this is impossible. Instead,
0.80
an approximate greedy algorithm is run that optimizes
one level of the tree at a time by trying to find optimal 0.75

splits of the data. This leads to a tree that is a good 0.70


local minimum of ∆Ctopt which is then added to the en- 0.65
10 20 30 40 50 60 70 80 90 100
semble. We emphasize that this is only a very high level Nestimators
sketch of how the algorithm works. In practice, addi-
tional regularization such as shrinkage(Friedman, 2002) 90
and feature subsampling(Breiman, 2001; Friedman et al., 80 Fine
2003) is also used. In addition, there are many numerical
Coarse
70
and technical tricks used for the approximate algorithm
60
and how to find splits of the data that give good decision

Run time (s)


trees (Chen and Guestrin, 2016). 50
40
30
F. Applications to the Ising model and Supersymmetry 20
Datasets 10
0
We now illustrate some of these ideas using two exam- 10 20 30 40 50 60 70 80 90 100
Nestimators
ples drawn from physics: (i) classifying the phases of the
spin configurations of the 2D-Ising model above and be-
FIG. 33 Using Random Forests (RFs) to classify Ising Phases.
low the critical temperature using random forests and (ii)
(Top) Accuracy of RFs for classifying the phase of samples
classifying Monte-Carlo simulations of collision events in from the Ising mode for the training set (blue), test set (red),
the SUSY dataset as supersymmetric or standard using and critical region (green) using coarse trees with a few leaves
an XGBoost implementation of gradient-boosted trees. (triangles) and fine decision trees with many leaves (filled cir-
Both examples were analyzed in Sec. VII.C using logistic cles). RFs were trained on samples from ordered and disor-
regression. Here we show that on the Ising dataset, the dered phases but were not trained on samples from the critical
RFs perform significantly better than logistic regression region. (Bottom) The time it takes to train RFs scales lin-
early with the number of estimators in the ensemble. For the
models whereas gradient boosted trees seem to yield an
upper panel, note that the train case (blue) overlaps with the
accuracy of about 80%, comparable to published results. test case (red). Here ‘fine’ and ‘coarse’ refer to trees with 2
The two accompanying Jupyter notebooks discuss practi- and 10,000 leaves, respectively. For implementation details,
cal details of implementing these examples and the read- see Jupyter notebooks 9
ers are encouraged to experiment with the notebooks.
The Ising dataset used for classification by RFs here
is identical to that used to study logistic regression in shown in Figure 33. We used two types of RF classifiers,
Sec. VII.C. We assign a label to each state according to one where the ensemble consists of coarse decision trees
its phase: 0 if the state is disordered, and 1 if it is ordered. with a few leaves and another with finer decision trees
We divide the dataset into three categories according to with many leaves (see corresponding notebook). RFs
the temperature at which samples are drawn: ordered have extremely high accuracy on the training and test
(T /J < 2.0), near-critical (2.0 ≤ T /J ≤ 2.5) and disor- sets (over 99%) for both coarse and fine trees. How-
dered (T /J > 2.5) (see Figure 20). We use the ordered ever, notice that the RF consisting of coarse trees per-
and disordered states to train a random forest and eval- form extremely poorly on samples from the critical region
uate our learned model on a test set of unseen ordered whereas the RF with fine trees classifies critical samples
and disordered states (test sets). We also ask how well with an accuracy of nearly 85%. Interestingly, and unlike
our RF can predict the phase of samples drawn in the with logistic regression, this performance in the critical
critical region (i.e. predict whether the temperature of region requires almost no parameter tuning. This is be-
a critical sample is above or below the critical tempera- cause, as discussed above, RFs are largely immune to
ture). Since our model is never trained on samples in the overfitting problems even as the number of estimators in
critical region, prediction in this region is a test of the the ensemble becomes large. Increasing the number of es-
algorithm’s ability to generalize to new regions in phase timators in the ensemble does increase performance but
space. at a large cost in computational time (Fig. 33 bottom).
The results of fits using RFs to predict phases are In the second application of ensemble methods to
45

Feature importance Learning” in the mid 2000s (Hinton et al., 2006; Hinton
axial MET 517 and Salakhutdinov, 2006). DNNs truly caught the atten-
missing energy magnitude 505 tion of the wider machine learning community and indus-
MET_rel 461
dPhi_r_b 443 try in 2012 when Alex Krizhevsky, Ilya Sutskever, and
lepton 2 eta 416
lepton 1 eta 396 Geoff Hinton used a GPU-based DNN model (AlexNet)
missing energy phi 361
cos(theta_r1) 352 to lower the error rate on the ImageNet Large Scale
Features

lepton 1 pT 351 Visual Recognition Challenge (ILSVRC) by an incred-


lepton 2 pT 348
S_R 346 ible twelve percent from 28% to 16% (Krizhevsky et al.,
M_R 331
R 319 2012). Just three years later, a machine learning group
lepton 1 phi 314
MT2 314 from Microsoft achieved an error of 3.57% using an ultra-
lepton 2 phi 290
M_TR_2 283 deep residual neural network (ResNet) with 152 layers
M_Delta_R 273 (He et al., 2016)! Since then, DNNs have become the
0 100 200 300 400 500 workhorse technique for many image and speech recogni-
F score
tion based machine learning tasks. The large-scale indus-
FIG. 34 Feature Importance Scores in SUSY dataset from trial deployment of DNNs has given rise to a number of
applying XGBoost to 100, 000 samples. See Notebook 10 for high-level libraries and packages (Caffe, Keras, Pytorch,
more details. TensorFlow, etc.) that make it easy to quickly code and
deploy DNNs.
Conceptually, it is helpful to divide neural networks
physics-related datasets, we used the XGBoost imple- into four categories: (i) general purpose neural net-
mentation of gradient boosted trees to classify Monte- works for supervised learning, (ii) neural networks de-
Carlo collisions from the SUSY dataset. With default signed specifically for image processing, the most promi-
parameters using a small subset of the data (100, 000 out nent example of this class being Convolutional Neural
of the full 5, 000, 000 samples), we were able to achieve Networks (CNNs), (iii) neural networks for sequential
a classification accuracy of about 79%, which could be data such as Recurrent Neural Networks (RNNs), and
improved to nearly 80% after some fine-tuning (see ac- (iv) neural networks for unsupervised learning such as
companying notebook). This is comparable to published Deep Boltzmann Machines. Here, we will limit our dis-
results (Baldi et al., 2014) and those obtained using lo- cussions to the first two categories (unsupervised learn-
gistic regression in earlier chapters. One nice feature of ing is discussed later in the review). Though increas-
ensemble methods such as XGBoost is that they auto- ingly important for many applications such as audio and
matically allow us to calculate feature scores (Fscores) speech recognition, for the sake of brevity, we omit a dis-
that rank the importance of various features for clas- cussion of sequential data and RNNs from this review.
sification. The higher the Fscore, the more important For an introduction to RNNs and LSTM networks see
the feature for classification. Figure 34 shows the feature Chris Olah’s blog, https://colah.github.io/posts/2015-
scores from our XGBoost algorithm for the production of 08-Understanding-LSTMs/, and Chapter 13 of (Bishop,
electrically-charged supersymmetric particles (χ±) which 2006) as well as the introduction to RNNs in Chapter 10
decay to W bosons and an electrically neutral supersym- of (Goodfellow et al., 2016) for sequential data.
metric particle χ0 , which is invisible to the detector. The Due to the number of recent books on deep learning
features are a mix of eight directly measurable quanti- (see for example Michael Nielsen’s introductory online
ties from the detector, as well as ten hand crafted fea- book (Nielsen, 2015) and the more advanced (Goodfel-
tures chosen using physics knowledge. Consistent with low et al., 2016)), the goal of this section is to give a
the physics of these supersymmetric decays in the lepton high-level introduction to the basic ideas behind DNNs,
channel, we find that the most informative features for and provide some practical knowledge for coding simple
classification are the missing transverse energy along the neural nets for supervised learning tasks (see the accom-
vector defined by the charged leptons (Axial MET) and panying Notebooks). This section assumes the reader
the missing energy magnitude due to χ0 . is familiar with the basic concepts introduced in earlier
sections on logistic and linear regression. Throughout,
we strive to provide intuition behind the inner workings
IX. AN INTRODUCTION TO FEED-FORWARD DEEP of DNNs, as well as highlight limitations of present-day
NEURAL NETWORKS (DNNS) algorithms.
The influx of corporate and industrial interests has
Over the last decade, neural networks have emerged rapidly transformed the field in the last few years. This
as the one of most powerful and widely-used supervised massive influx of money and researchers has given rise to
learning techniques. Deep Neural Networks (DNNs) have new dogmas and best practices that change rapidly. As
a long history (Bishop, 1995b; Schmidhuber, 2015), but with most intellectual fields experiencing rapid expan-
re-emerged to prominence after a rebranding as “Deep sion, many commonly accepted heuristics many turn out
46

not to be as powerful as thought (Wilson et al., 2017), et al., 2018). Representing quantum states as DNNs (Gao
and widely held beliefs not as universal as once imagined et al., 2017; Gao and Duan, 2017; Levine et al., 2017;
(Lee et al., 2017; Zhang et al., 2016). This is especially Saito and Kato, 2017) and quantum state tomogra-
true in modern neural networks where results are largely phy (Torlai et al., 2018) are among some of the impres-
empirical and heuristic and lack the firm footing of many sive achievements to reveal the potential of deep learn-
earlier machine learning methods. For this reason, in ing to facilitate the study of quantum systems. Machine
this review we have chosen to emphasize tried and true learning techniques involving neural networks were also
fundamentals, while pointing out what, from our current used to study quantum and fault-tolerant error correc-
vantage point, seem like promising new techniques. The tion (Baireuther et al., 2017; Breuckmann and Ni, 2017;
field is rapidly evolving and readers are urged to read Chamberland and Ronagh, 2018; Davaasuren et al., 2018;
papers and to implement these algorithms themselves in Krastanov and Jiang, 2017; Maskara et al., 2018), es-
order to gain a deep appreciation for the incredible power timate rates of coherent and incoherent quantum pro-
of modern neural networks, especially in the context of cesses (Greplova et al., 2017), to obtain spectra of 1/f -
image, speech, and natural language processing, as well noise in spin-qubit devices (Zhang and Wang, 2018), and
as limitations of the current methods. the recognition of state and charge configurations and
In physics, DNNs and CNNs have already found auto-tuning in quantum dots (Kalantre et al., 2017). In
numerous applications. In statistical physics, they quantum information theory, it has been shown that one
have been applied to detect phase transitions in 2D can perform gate decompositions with the help of neural
Ising (Tanaka and Tomiya, 2017a) and Potts (Li nets (Swaddle et al., 2017). In lattice quantum chromo-
et al., 2017) models, lattice gauge theories (Wetzel and dynamics, DNNs have been used to learn action param-
Scherzer, 2017), and different phases of polymers (Wei eters in regions of parameter space where principal com-
et al., 2017). It has also been shown that deep neural net- ponent analysis fails (Shanahan et al., 2018). CNNs were
works can be used to learn free-energy landscapes (Sidky applied to data from a high-energy experiment to iden-
and Whitmer, 2017). At the same time, methods from tify particle interactions in sampling calorimeters used
statistical physics have been applied to the field of deep commonly in neutrino physics (Aurisano et al., 2016).
learning to study the thermodynamic efficiency of learn- Last but not least, DNNs also found place in the study
ing rules (Goldt and Seifert, 2017), to explore the hy- of quantum control (Yang et al., 2017), and in scattering
pothesis space that DNNs span, make analogies between theory to learn the s-wave scattering length (Wu et al.,
training DNNs and spin glasses (Baity-Jesi et al., 2018; 2018) of potentials.
Baldassi et al., 2017), and to characterize phase transi-
tions with respect to network topology in terms of er-
rors (Li and Saad, 2017). In relativistic hydrodynam- A. Neural Network Basics
ics, deep learning has been shown to capture features
of non-linear evolution and has the potential to accel- Neural networks (also called neural nets) are neural-
erate numerical simulations (Huang et al., 2018), while inspired nonlinear models for supervised learning. As
in mechanics CNNs have been used to predict eigenval- we will see, neural nets can be viewed as natural, more
ues of photonic crystals (Finol et al., 2018). Deep CNNs powerful extensions of supervised learning methods such
were employed in lensing reconstruction of the cosmic as linear and logistic regression and soft-max methods.
microwave background (Caldeira et al., 2018). Recently,
DNNs have been used to improve the efficiency of Monte-
Carlo algorithms (Shen et al., 2018). 1. The basic building block: neurons
Deep learning has also found interesting applications
in quantum physics. Various quantum phase transi- The basic unit of a neural net is a stylized “neu-
tions (Arai et al., 2017; Broecker et al., 2017; Iakovlev ron” i that takes a vector of d input features x =
et al., 2018; van Nieuwenburg et al., 2017b; Suchs- (x1 , x2 , . . . , xd ) and produces a scalar output ai (x). A
land and Wessel, 2018) can be detected and studied neural network consists of many such neurons stacked
using DNNs and CNNs, including the transverse-field into layers, with the output of one layer serving as the
Ising model (Ohtsuki and Ohtsuki, 2017), topological input for the next (see Figure 35). The first layer in the
phases (Yoshioka et al., 2017; Zhang et al., 2017a,b) neural net is called the input layer, the middle layers are
and non-invasive topological quality control (Caio et al., often called “hidden layers”, and the final layer is called
2019). DNNs found applications even in non-equilibrium the output layer.
many-body localization (van Nieuwenburg et al., 2017a,b; The exact function ai varies depending on the type of
Schindler et al., 2017; Venderley et al., 2017), and the non-linearity used in the neural network. However, in
characterization of photoexcited quantum states (Shinjo essentially all cases ai can be decomposed into a linear
et al., 2019). Experimentally, DNNs were recently em- operation that weights the relative importance of the var-
ployed in cold atoms to identify critical points (Rem ious inputs, and a non-linear transformation σi (z) which
47

A descent. For this reason, until recently the most pop-


x1 linear nonlinearity ular choice of non-linearity was the tanh function or a
w1
w2
sigmoid/Fermi function. However, this choice of non-
input x2 w. x + b output linearity has a major drawback. When the input weights
w3
become large, as they often do in training, the activation
x3 function saturates and the derivative of the output with
hidden respect to the weights tends to zero since ∂σ/∂z → 0
B
layers for z  1. Such “vanishing gradients” are a feature of
any saturating activation function (top row of Fig. 36),
{ output
layer
making it harder to train deep networks. In contrast, for
a non-saturating activation function such as ReLUs or

{
{
input
ELUs, the gradients stay finite even for large inputs.
layer

2. Layering neurons to build deep networks: network


architecture.
FIG. 35 Basic architecture of neural networks. (A)
The basic components of a neural network are stylized neu- The basic idea of all neural networks is to layer neurons
rons consisting of a linear transformation that weights the in a hierarchical fashion, the general structure of which is
importance of various inputs, followed by a non-linear activa-
known as the network architecture (see Fig. 35). In the
tion function. (b) Neurons are arranged into layers with the
output of one layer serving as the input to the next layer. simplest feed-forward networks, each neuron in the in-
put layer of the neurons takes the inputs x and produces
an output ai (x) that depends on its current weights, see
is usually the same for all neurons. The linear trans- Eq. (118). The outputs of the input layer are then treated
formation in almost all neural networks takes the form as the inputs to the next hidden layer. This is usually
of a dot product with a set of neuron-specific weights repeated several times until one reaches the top or output
(i) (i) (i)
w(i) = (w1 , w2 , . . . , wd ) followed by re-centering with layer. The output layer is almost always a simple clas-
a neuron-specific bias b : (i) sifier of the form discussed in earlier sections: a logistic
regression or soft-max function in the case of categorical
z (i) = w(i) · x + b(i) = xT · w(i) , (117) data (i.e. discrete labels) or a linear regression layer in
the case of continuous outputs. Thus, the whole neural
where x = (1, x) and w(i) = (b(i) , w(i) ). In terms of z (i) network can be thought of as a complicated nonlinear
and the non-linear function σi (z), we can write the full transformation of the inputs x into an output ŷ that de-
input-output function as pends on the weights and biases of all the neurons in the
input, hidden, and output layers.
ai (x) = σi (z (i) ), (118) The use of hidden layers greatly expands the represen-
tational power of a neural net when compared with a sim-
see Figure 35. ple soft-max or linear regression network. Perhaps, the
Historically in the neural network literature, common most formal expression of the increased representational
choices of nonlinearities included step-functions (percep- power of neural networks (also called the expressivity) is
trons), sigmoids (i.e. Fermi functions), and the hyper- the universal approximation theorem which states that a
bolic tangent. More recently, it has become more com- neural network with a single hidden layer can approxi-
mon to use rectified linear units (ReLUs), leaky recti- mate any continuous, multi-input/multi-output function
fied linear units (leaky ReLUs), and exponential linear with arbitrary accuracy. The reader is strongly urged
units (ELUs) (see Figure 36). Different choices of non- to read the beautiful graphical proof of the theorem in
linearities lead to different computational and training Chapter 4 of Nielsen’s free online book (Nielsen, 2015).
properties for neurons. The underlying reason for this is The basic idea behind the proof is that hidden neurons
that we train neural nets using gradient descent based allow neural networks to generate step functions with ar-
methods, see Sec. IV, that require us to take derivatives bitrary offsets and heights. These can then be added
of the neural input-output function with respect to the together to approximate arbitrary functions. The proof
weights w(i) and the bias b(i) . also makes clear that the more complicated a function,
Notice that the derivatives of the aforementioned non- the more hidden units (and free parameters) are needed
linearities σ(z) have very different properties. The to approximate it. Hence, the applicability of the ap-
derivative of the perceptron is zero everywhere except proximation theorem to practical situations should not
where the input is zero. This discontinuous behavior be overemphasized. In condensed matter physics, a good
makes it impossible to train perceptrons using gradient analogy are matrix product states, which can approxi-
48

Perceptron Sigmoid Tanh


1 1 1

0 0 0

-1 -1 -1
-5 0 5 -5 0 5 -5 0 5
ReLU Leaky ReLU ELU
6 6 6
4 4 4
2 2 2
0 0 0

-5 0 5 -5 0 5 -5 0 5

FIG. 36 Possible non-linear activation functions for neurons. In modern DNNs, it has become common to use non-linear
functions that do not saturate for large inputs (bottom row) rather than saturating functions (top row).

mate any quantum many-body state to an arbitrary ac- that works best. However, a general rule of thumb that
curacy, provided the bond dimension can be increased seems to be emerging is that the number of parameters in
arbitrarily – a severe requirement not met in any useful the neural net should be large enough to prevent under-
practical implementation of the theory. fitting (see theoretical discussion in (Advani and Saxe,
Modern neural networks generally contain multiple 2017)).
hidden layers (hence the “deep” in deep learning). There Empirically, the best architecture for a problem de-
are many ideas of why such deep architectures are fa- pends on the task, the amount and type of data that is
vorable for learning. Increasing the number of layers in- available, and the computational resources at one’s dis-
creases the number of parameters and hence the represen- posal. Certain architectures are easier to train, while
tational power of neural networks. Indeed, recent numer- others might be better at capturing complicated depen-
ical experiments suggests that as long as the number of dencies in the data and learning relevant input features.
parameters is larger than the number of data points, cer- Finally, there have been numerous works that move be-
tain classes of neural networks can fit arbitrarily labeled yond the simple deep, feed-forward neural network ar-
random noise samples (Zhang et al., 2016). This suggests chitectures discussed here. For example, modern neural
that large neural networks of the kind used in practice can networks for image segmentation often incorporate “skip
express highly complex functions. Adding hidden layers connections” that skip layers of the neural network (He
is also thought to allow neural nets to learn more complex et al., 2016). This allows information to directly propa-
features from the data. Work on convolutional networks gate to a hidden or output layer, bypassing intermediate
suggests that the first few layers of a neural network learn layers and often improving performance.
simple, “low-level” features that are then combined into
higher-level, more abstract features in the deeper layers.
Other works suggest that it is computationally and al- B. Training deep networks
gorithmically easier to train deep networks rather than
shallow, wider nets, though this is still an area of major In the previous section, we introduced the basic ar-
controversy and active research (Mhaskar et al., 2016). chitecture for neural networks. Here we discuss how to
Choosing the exact network architecture for a neural efficiently train large neural networks. Luckily, the basic
network remains an art that requires extensive numer- procedure for training neural nets is the same as we used
ical experimentation and intuition, and is often times for training simpler supervised learning algorithms, such
problem-specific. Both the number of hidden layers and as logistic and linear regression: construct a cost/loss
the number of neurons in each layer can affect the per- function and then use gradient descent to minimize the
formance of a neural network. There seems to be no cost function and find the optimal weights and biases.
single recipe for the right architecture for a neural net Neural networks differ from these simpler supervised pro-
49

cedures in that generally they contain multiple hidden m|xi ; w). Then, the categorical cross-entropy is defined
layers that make taking the gradient computationally as
more difficult. We will return to this in Sec. IX.C which n M −1
discusses the “backpropagation” algorithm for computing
X X
E(w) = − yim log ŷim (w)
gradients. i=1 m=0
Like all supervised learning procedures, the first thing +(1 − yim ) log [1 − ŷim (w)] . (122)
one must do to train a neural network is to specify a
loss function. Given a data point (xi , yi ), xi ∈ Rd+1 , As in linear and logistic regression, this loss function is
the neural network makes a prediction ŷi (w), where w often supplemented by additional terms that implement
are the parameters of the neural network. Recall that regularization.
in most cases, the top output layer of our neural net Having defined an architecture and a cost function, we
is either a continuous predictor or a classifier that makes must now train the model. Similar to other supervised
discrete (categorical) predictions. Depending on whether learning methods, we make use of gradient descent-based
one wants to make continuous or categorical predictions, methods to optimize the cost function. Recall that the
one must utilize a different kind of loss function. basic idea of gradient descent is to update the parame-
For continuous data, the loss functions that are com- ters w to move in the direction of the gradient of the cost
monly used to train neural networks are identical to those function ∇w E(w). In Sec. IV, we discussed numerous
used in linear regression, and include the mean squared optimizers that implement variations of stochastic gra-
error dient descent (SGD, Nesterov, RMSProp, Adam, etc.)
1X
n Most modern neural network packages, such as Keras,
E(w) = (yi − ŷi (w))2 , (119) allow the user to specify which of these optimizers they
n i=1
would like to use in order to train the neural network.
where n is the number of data points, and the mean- Depending on the architecture, data, and computational
absolute error (i.e. L1 norm) resources, different optimizers may work better on the
problem, though vanilla SGD is a good first choice.
1X Finally, we note that unlike in linear and logistic re-
E(w) = |yi − ŷi (w)|. (120)
n i gression, calculating the gradients for a neural network
requires a specialized algorithm, called Backpropagation
The full cost function often includes additional terms that (often abbreviated backprop) which forms the heart of
implement regularization (e.g. L1 or L2 regularizers), see any neural network training procedure. Backpropaga-
Sec. VI. tion has been discovered multiple times independently
For categorical data, the most commonly used loss but was popularized for modern neural networks in 1985
function is the cross-entropy (Eq. (76) and Eq. (81)), (Rumelhart and Zipser, 1985). We will turn to the back-
since the output layer is often taken to be a logistic clas- propagation algorithm in the next section. Before read-
sifier for binary data with two types of labels, or a soft- ing it, the reader is strongly encouraged to play with
max classifier if there are more than two types of labels. Notebook 11 in order to gain some intuition about how
The cross-entropy was already discussed extensively in to build a DNN in practice using the high-level Keras
earlier sections on logistic regression and soft-max classi- Python package. Notebook 11 discusses a simple exam-
fiers, see Sec. VII. Recall that for classification of binary ple where we build a feed-forward deep neural network for
data, the output of the top layer of the neural network is classifying hand-written digits from the MNIST dataset.
the probability ŷi (w) = p(yi = 1|xi ; w) that data point Figures 37 and 38 show the accuracy and the loss as a
i is predicted to be in category 1. The cross-entropy be- function of the training episodes.
tween the true labels yi ∈ {0, 1} and the predictions is
given by
n
X C. The Backpropagation algorithm
E(w) = − yi log ŷi (w) + (1 − yi ) log [1 − ŷi (w)] .
i=1 In the last section, we saw how to deploy a high-level
More generally, for categorical data, y can take on M package, Keras, to design and train a simple neural net-
values so that y ∈ {0, 1, . . . , M − 1}. For each datapoint work. This training procedure requires us to be able to
i, define a vector yim called a ‘one-hot’ vector, such that calculate the derivative of the cost function with respect
( to all the parameters of the neural network (the weights
1, if yi = m and biases of all the neurons in the input, hidden, and
yim = (121) visible layers). A brute force calculation is out of the
0, otherwise.
question since it requires us to calculate as many gradi-
We can also define the probability that the neural net- ents as parameters at each step of the gradient descent.
work assigns a datapoint to category m: ŷim (w) = p(yi = The backpropagation algorithm (Rumelhart and Zipser,
50

nection from the k-th neuron in layer l − 1 to the j-th


0.975 train neuron in layer l. We denote the bias of this neuron by
test blj . By construction, in a feed-forward neural network the
0.950 activation alj of the j-th neuron in the l-th layer can be
related to the activities of the neurons in the layer l − 1
model accuracy

0.925 by the equation


!
0.900 X
l−1
l
aj = σ l
wjk ak + bj = σ(zjl ),
l
(123)
k
0.875
where we have defined the linear weighted sum
0.850 X
zjl = l
wjk al−1
k + blj . (124)
k
0 2 4 6 8
epoch By definition, the cost function E depends directly on
j . It of course also indi-
the activities of the output layer aL
rectly depends on all the activities of neurons in lower lay-
FIG. 37 Model accuracy of a DNN to study the MNIST prob-
lem as a function of the training epochs (see Notebook 11).
ers in the neural network through iteration of Eq. (123).
Besides the input and output layers, the DNN has four layers Let us define the error ∆L j of the j-th neuron in the L-th
of size (100,400,400,50) with different nonlinearities σ(z). layer as the change in cost function with respect to the
weighted input zjL
∂E
train ∆L
j = . (125)
0.5 ∂zjL
test
This definition is the first of the four backpropagation
0.4 equations.
We can analogously define the error of neuron j in
model loss

0.3
layer l, ∆lj , as the change in the cost function w.r.t. the
weighted input zjl :
0.2 ∂E ∂E 0 l
∆lj = l
= σ (zj ), (I)
∂zj ∂alj
0.1 where σ 0 (x) denotes the derivative of the non-linearity
σ(·) with respect to its input evaluated at x. Notice
0 2 4 6 8 that the error function ∆lj can also be interpreted as the
epoch
partial derivative of the cost function with respect to the
bias blj , since
FIG. 38 Model loss of a DNN to study the MNIST problem as
a function of the training epochs (see Notebook 11). Besides ∂E ∂E ∂blj ∂E
the input and output layers, the DNN has four layers of size ∆lj = = = l, (II)
∂zjl ∂blj ∂zjl ∂bj
(100,400,400,50) with different nonlinearities σ(z).
where in the last line we have used the fact that
∂blj /∂zjl = 1, cf. Eq. (124). This is the second of the
1985) is a clever procedure that exploits the layered struc- four backpropagation equations.
ture of neural networks to more efficiently compute gra- We now derive the final two backpropagation equations
dients (for a more detailed discussion with Python code using the chain rule. Since the error depends on neurons
examples see Chapter 2 of (Nielsen, 2015)). in layer l only through the activation of neurons in the
subsequent layer l + 1, we can use the chain rule to write
∂E X ∂E ∂z l+1
1. Deriving and implementing the backpropagation equations ∆lj = = k
∂zjl k
∂zk
l+1 ∂z l
j
At its core, backpropagation is simply the ordinary
∂zkl+1
chain rule for partial differentiation, and can be summa-
X
= ∆l+1
k
rized using four equations. In order to see this, we must k
∂zjl
first establish some useful notation. We will assume that
!
X
there are L layers in our network with l = 1, . . . , L in- = ∆l+1 l+1
k wkj σ 0 (zjl ). (III)
dexing the layer. Denote by wjk l
the weight for the con- k
51

This is the third backpropagation equation. The final network. However, until fairly recently it was widely be-
equation can be derived by differentiating of the cost lieved that training deep networks was an extremely dif-
function with respect to the weight wjk
l
as ficult task. One reason for this was that even with back-
propagation, gradient descent on large networks is ex-
∂E ∂E ∂zjl tremely computationally expensive. However, the great
= l = ∆lj al−1 (IV)
l
∂wjk l
∂zj ∂wjk k advances in computational hardware (and the widespread
use of GPUs) has made this a much less vexing prob-
Together, Eqs. (I), (II), (III), and (IV) define the four lem than even a decade ago. It is hard to understate
backpropagation equations relating the gradients of the the impact these advances in computing have had on the
activations of various neurons alj , the weighted inputs practical utility of neural networks.
P l l−1 l
zjl = k wjk ak +bj , and the errors ∆lj . These equations
On a more technical and mathematical note, another
can be combined into a simple, computationally efficient
problem that occurs in deep networks, which transmit
algorithm to calculate the gradient with respect to all
information through many layers, is that gradients can
parameters (Nielsen, 2015).
vanish or explode. This is, appropriately, known as the
The Backpropagation Algorithm problem of vanishing or exploding gradients. This prob-
lem is especially pronounced in neural networks that try
1. Activation at input layer: calculate the activa- to capture long-range dependencies, such as Recurrent
tions a1j of all the neurons in the input layer. Neural Networks for sequential data. We can illustrate
2. Feedforward: starting with the first layer, exploit this problem by considering a simple network with one
the feed-forward architecture through Eq. (123) to neuron in each layer. We further assume that all weights
compute z l and al for each subsequent layer. are equal, and denote them by w. The behavior of the
backpropagation equations for such a network can be in-
3. Error at top layer: calculate the error of the top ferred from repeatedly using Eq. (III):
layer using Eq. (I). This requires to know the ex-
pression for the derivative of both the cost function
E(w) = E(aL ) and the activation function σ(z). L−1
Y L−1
Y
∆1j = ∆L
j wσ 0 (zj ) = ∆L
j (w)
L
σ 0 (zj ), (126)
4. “Backpropagate” the error: use Eq. (III) to j=0 j=0
propagate the error backwards and calculate ∆lj for
all layers.
5. Calculate gradient: use Eqs. (II) and (IV) to where ∆L j is the error in the L-th topmost layer, and
calculate ∂b
∂E
l and ∂w l .
∂E (w)L is the weight to the power L. Let us now also
j jk
assume that the magnitude σ 0 (zj ) is fairly constant and
We can now see where the name backpropagation we can approximate σ 0 (zj ) ≈ σ00 . In this case, notice
comes from. The algorithm consists of a forward pass that for large L, the error ∆1j has very different behavior
from the bottom layer to the top layer where one calcu- depending on the value of wσ00 . If wσ00 > 1, the errors
lates the weighted inputs and activations of all the neu- and the gradient blow up. On the other hand, if wσ00 < 1
rons. One then backpropagates the error starting with the errors and gradients vanish. Only when the weights
the top layer down to the input layer and uses these errors satisfy wσ00 ≈ 1 and the neurons are not saturated will
to calculate the desired gradients. This description makes the gradient stay well behaved for deep networks.
clear the incredible utility and computational efficiency
This basic behavior holds true even in more compli-
of the backpropagation algorithm. We can calculate all
cated networks. Rather than considering a single weight,
the derivatives using a single “forward” and “backward”
we can ask about the eigenvalues (or singular values) of
pass of the neural network. This computational efficiency
the weight matrices wjk l
. In order for the gradients to
is crucial since we must calculate the gradient with re-
be finite for deep networks, we need these eigenvalues to
spect to all parameters of the neural net at each step
stay near unity even after many gradient descent steps.
of gradient descent. These basic ideas also underly al-
In modern feedforward and ReLU neural networks, this
most all modern automatic differentiation packages such
is achieved by initializing the weights for the gradient de-
as Autograd (Pytorch).
scent in clever ways and using non-linearities that do not
saturate, such as ReLUs (recall that for saturating func-
2. Computing gradients in deep networks: what can go wrong tions, σ 0 → 0, which will cause the gradient to vanish).
with backprop? Proper initialization and regularization schemes such as
gradient clipping (cutting-off gradients with very large
Armed with backpropagation and gradient descent, it values), and batch normalization also help mitigate the
seems like it should be straightforward to train any neural vanishing and exploding gradient problem.
52

D. Regularizing neural networks and other practical tions, the dataset we train on, and a smaller validation
considerations set that serves as a proxy for out-of-sample performance
on the test set. As we train the model, we plot both the
DNNs, like all supervised learning algorithms, must training error and the validation error. We expect the
navigate the bias-variance tradeoff. Regularization tech- training error to continuously decrease during training.
niques play an important role in ensuring that DNNs However, the validation error will eventually increase due
generalize well to new data. The last five years have seen to overfitting. The basic idea of early stopping is to halt
a wealth of new specialized regularization techniques for the training procedure when the validation error starts to
DNNs beyond the simple L1 and L2 penalties discussed in rise. This Early Stopping procedure ensures that we stop
the context of linear and logistic regression, see Secs. VI the training and avoid fitting sample specific features in
and VII. These new techniques include Dropout and the data. Early Stopping is a widely used essential tool
Batch Normalization. In addition to these specialized in the deep learning regularization toolbox.
regularization techniques, large DNNs seem especially
well-suited to implicit regularization that already takes
place in the Stochastic Gradient Descent (SGD) (Wilson 2. Dropout
et al., 2017), cf. Sec. IV. The implicit stochasticity and
local nature of SGD often prevent overfitting of spurious Another important regularization schemed that has
correlations in the training data, especially when com- been widely adopted in the neural networks literature
bined with techniques such as Early Stopping. In this is Dropout (Srivastava et al., 2014). The basic idea of
section, we give a brief overview of these regularization Dropout is to prevent overfitting by reducing spurious
techniques. correlations between neurons within the network by in-
troducing a randomization procedure similar to that un-
derlying ensemble models such as Bagging. Recall that
1. Implicit regularization using SGD: initialization, the basic idea behind ensemble methods is to train an en-
hyper-parameter tuning, and Early Stopping semble of models that are created using a randomization
procedure to ensure that the members of the ensemble
The most commonly employed and effective optimizer are uncorrelated, see Sec. VIII. This reduces the vari-
for training neural networks is SGD (see Sec. IV for other ance of statistical predictions without creating too much
alternatives). SGD acts as an implicit regularizer by in- additional bias.
troducing stochasticity (from the use of mini-batches) In the context of neural networks, it is extremely costly
that prevents overfitting. In order to achieve good per- to train an ensemble of networks, both from the point of
formance, it is important that the weight initialization is view of the amount of data needed, as well as computa-
chosen randomly, in order to break any leftover symme- tional resources and parameter tuning required. Dropout
tries. One common choice is drawing the weights from a circumnavigates these problems by randomly dropping
Gaussian centered around zero with some variance that out neurons (along with their connections) from the neu-
scales inversely with number of inputs to the neuron (He ral network during each step of the training (see Figure
et al., 2015; Sutskever et al., 2013). Since SGD is a lo- 39). Typically, for each mini-batch in the gradient de-
cal procedure, as networks get deeper, choosing a good scent step, a neuron is dropped from the neural network
weight initialization becomes increasingly important to with a probability p. The gradient descent step is then
ensure that the gradients are well behaved. Choosing performed only on the weights of the “thinned” network
an initialization with a variance that is too large or too of individual predictors.
small will cause gradients to vanish and the network to Since during training, on average weights are only
train poorly – even a factor of 2 can make a huge differ- present a fraction p of the time, predictions are made
ence in practice (He et al., 2015). For this reason, it is by reweighing the weights by p: wtest = pwtrain .The
important to experiment with different variances. learned weights can be viewed as some “average” weight
The second important thing is to appropriately choose over all possible thinned neural network. This averag-
the learning rate or step-size by searching over five log- ing of weights is similar in spirit to the Bagging proce-
arithmic grid points (Wilson et al., 2017). If the best dure discussed in the context of ensemble models, see
performance occurs at the edge of the grid, repeat this Sec. VIII.
procedure until the optimal learning rate is in the middle
of the grid parameters. Finally, it is common to center
or whiten the input data (just as we did for linear and 3. Batch Normalization
logistic regression).
Another important form of regularization that is of- Batch Normalization is a regularization scheme that
ten employed in practice is Early Stopping. The idea of has been quickly adopted by the neural network com-
Early Stopping is to divide the training data into two por- munity since its introduction in 2015 (Ioffe and Szegedy,
53

new parameters γkl and βkl can be learned just like the
weights and biases using backpropagation (since this is
just an extra layer for the chain rule). We initialize the
neural network so that at the beginning of training the
Standard
inputs are being standardized. Backpropagation then ad-
Neural Net
justs γ and β during training.
In practice, Batch Normalization considerably im-
proves the learning speed by preventing gradients from
vanishing. However, it also seems to serve as a power-
ful regularizer for reasons that are not fully understood.
One plausible explanation is that in batch normalization,
After applying X the gradient for a sample depends not only on the sam-
Dropout ple itself but also on all the properties of the mini-batch.
Since a single sample can occur in different mini-batches,
this introduces additional randomness into the training
procedure which seems to help regularize training.

FIG. 39 Dropout During the training procedure neurons E. Deep neural networks in practice: examples
are randomly “dropped out” of the neural network with some
probability p giving rise to a thinned network. This prevents Now that we have gained sufficient high-level back-
overfitting by reducing correlations among neurons and re-
ground knowledge about deep neural nets, let us discuss
ducing the variance in a method similar in spirit to ensemble
methods. how to use them in practice.

2015). The basic inspiration behind Batch Normalization 1. Deep learning packages
is the long-known observation that training in neural net-
works works best when the inputs are centered around In Notebook 11, we demonstrated that the numerical
zero with respect to the bias. The reason for this is that implementation of DNNs is greatly facilitated by open
it prevents neurons from saturating and gradients from source python packages, such as Keras, TensorFlow, Py-
vanishing in deep nets. In the absence of such center- torch, and others. The complexity and learning curves
ing, changes in parameters in lower layers can give rise for these packages differ, depending on the user’s level of
to saturation effects in higher layers, and vanishing gra- familiarity with Python. The reader should keep mind
dients. The idea of Batch Normalization is to introduce mind that there are DNN packages written in other lan-
additional new “BatchNorm” layers that standardize the guages, such as Caffe which uses C++, but we do not
inputs by the mean and variance of the mini-batch. discuss them in this review for brevity.
Consider a layer l with d neurons whose inputs are Keras is a high-level framework which does not require
(z1l , . . . , zdl ). We standardize each dimension so that any knowledge about the inner workings of the underly-
ing deep learning algorithms. Coding DNNs in Keras is
zkl − E[zkl ]
zkl −→ ẑkl = q , (127) particularly simple, see Notebook 11, and allows one to
Var[zkl ] quickly grasp the big picture behind the theoretical con-
cepts which we introduced above. However, for advanced
where the mean and variance are taken over all sam- applications, which may require more direct control over
ples in the mini-batch. One problem with this procedure the operations in between the layers, Keras’ high-level
is that it may change the representational power of the design may turn out insufficient.
neural network. For example, for tanh non-linearities, it If one opens up the Keras black box, one will find that
may force the network to live purely in the linear regime it wraps the functionality of another package – Tensor-
around z = 0. Since non-linearities are crucial to the Flow11 . Over the last years, TensorFlow, which is sup-
representational power of DNNs, this could dramatically ported by Google, has been gaining popularity and has
alter the power of the DNN. become the preferred library for deep learning. It is fre-
For this reason, one introduces two new parameters γkl quently used in Kaggle competitions, university classes,
and βkl for each neuron that can additionally shift and and industry. In TensorFlow one constructs data flow
scale the normalized input
ẑkl −→ ẑlk = γkl ẑkl + βkl . (128)
One can think of Eqs. (127) and (128) as adding new 11 While Keras can also be used with a Theano backend, we do not
extra layers ẑlk in the deep net architecture. Hence, the discuss this here since Theano support has been discontinued.
54

graphs, the nodes of which represent mathematical oper- data serves as a major bottleneck on the ultimate per-
ations, while the edges encode multidimensional tensors formance of DNNs. In such cases one can consider data
(data arrays). A deep neural net can then be thought of augmentation, i.e. distorting data samples from the ex-
as a graph with a particular architecture and connectiv- isting dataset in some way to enhance size the dataset.
ity. One needs to understand this concept well before one Obviously, if one knows how to do this, one already has
can truly unleash TensorFlow’s full potential. The learn- partial information about the important features in the
ing curve can sometimes be rather steep for TensorFlow data.
beginners, and requires a certain degree of perseverance One of the first questions we are typically faced with is
and devoted time to internalize the underlying ideas. how to determine the sizes of the training and test data
There are, however, many other open source packages sets. The MNIST dataset, which has 10 classification
which allow for control over the inter- and intra-layer op- categories, uses 80% of the available data for training
erations, without the need to introduce computational and 20% for testing. On the other hand, the ImageNet
graphs. Such an example is Pytorch, which offers li- data which has 1000 categories is split 50% − 50%. As
braries for automatic differentiation of tensors at GPU a rule of thumb, the more classification categories there
speed. As we discussed above, manipulating neural nets are in the task, the closer the sizes of the training and
boils down to fast array multiplication and contraction test datasets should be in order to prevent overfitting.
operations and, therefore, the torch.nn library often Once the size of the training set is fixed, it is common to
does the job of providing enough access and controlla- reserve 20% of it for validation, which is used to fine-tune
bility to manipulate the linear algebra operations under- the hyperparameters of the model.
lying deep neural nets. Also related to data preprocessing is the standardiza-
For the benefit of the reader, we have prepared Jupyter tion of the dataset. It has been found empirically that if
notebooks for DNNs using all three packages for the deep the original values of the data differ by orders of magni-
learning problems we discuss below. We invite the reader tude, training can be slowed down or impeded. This can
to carefully examine the differences in the code which be traced back to the vanishing and exploding gradient
should help them decide on which package they prefer to problem in backprop discussed in Sec. IX.C. To avoid
use. such unwanted effects, one often resorts to two tricks:
(i) all data should be mean-centered, i.e. from every data
point we subtract the mean of the entire dataset, and (ii)
2. Approaching the learning problem rescale the data, for which there are two ways: if the data
is approximately normally distributed, one can rescale by
Let us now analyze a typical procedure for using neural the standard deviation. Otherwise, it is typically rescaled
networks to solve supervised learning problems. As can by the maximum absolute value so the rescaled data lies
be seen already from the code snippets in Notebook 11, within the interval [−1, 1]. Rescaling ensures that the
constructing a deep neural network to solve ML problems weights of the DNN are of a similar order of magnitude
is a multiple-stage process. Generally, one can identify a (notice the similarity of this idea to Batch Normalization,
set of key steps: cf. Sec. IX.D.3).
The next issue is how to choose the right hyperparam-
1. Collect and pre-process the data.
eters to start training the model. According to Bengio,
2. Define the model and its architecture. the optimal learning rate is often an order of magnitude
lower than the smallest learning rate that blows up the
3. Choose the cost function and the optimizer. loss (Bengio, 2012). One should also keep in mind that,
depending on how ambitious of a problem one is dealing
4. Train the model. with, training the model can take a considerable amount
of time. This can severely slow down any progress on
5. Evaluate and study the model performance
improving the model in Step 6. Therefore, it is usu-
on the test data.
ally a good idea to play with a small enough fraction of
6. Use the validation data to adjust the hyper- the training data to get a rough feeling about the cor-
parameters (and, if necessary, network ar- rect hyperparameter regimes, the usefulness of the DNN
chitecture) to optimize performance for the architecture, and to debug the code. The size of this
specific dataset. small ‘play set’ should be such that training on it can
be done fast and in real time to allow to quickly adjust
At this point a few remarks are in order. While we the hyperparameters. A typical strategy of exploring the
treat Step 1 above as consisting mainly of loading and hyperparameter landscape is to use grid searches.
reshaping a dataset prepared ahead of time, we empha- Whereas it is always possible to view Steps 1-5 as
size that obtaining a sufficient amount of data is a typical generic and independent of the particular problem we
challenge in many applications. Oftentimes insufficient are trying to solve, it is only when these steps are put
55

100% Unlike the MNIST example where we used Keras, here


1e-05 0.0001 0.001 0.01 0.1 we use the opportunity to introduce the Pytorch package,
see the corresponding notebook. We leave the discussion
1000 54.5% 51.5% 74.5% 77.5% 65.5% 80% of the code-specific details for the accompanying note-
book.
To classify the SUSY collision events, we construct a

accuracy (%)
data set size

10000 44.6% 65.0% 74.6% 77.0% 78.2% 60%


DNN with two dense hidden layers of 200 and 100 neu-
rons, respectively. We use ReLU activation between the
100000 42.7% 48.8% 74.1% 78.6% 79.6% 40% input and the hidden layers, and a sofmax output layer.
We apply dropout regularization on the weights of the
DNN. Similar to MNIST, we use the cross-entropy as a
200000 56.7% 59.9% 76.0% 78.9% 79.9% cost function and minimize it using SGD with batches of
20%
size 10% of the training data size. We train the DNN for
learning rate 10 epochs.
0% Figure 40 shows the accuracy of our DNN on the test
data as a function of the learning rate and the size of the
FIG. 40 Grid search results for the test set accuracy of the dataset. It is considered good practice to start with a
DNN for the SUSY problem as a function of the learning rate logarithmic scale to search through the hyperparameters,
and the size of the dataset. The data used includes all high- to get an overall idea for the order of magnitude of the
and low-level features.
optimal values. In this example, the performance peaks
at the largest size of the dataset and a learning rate of 0.1,
together in Step 6 that the real benefit of deep learning and is of the order of 80%. Since the optimal performance
is revealed, compared to less sophisticated methods such is obtained at the edge of the grid, we encourage the
as regression or bagging, see Secs. VI, VII, and VIII. The reader to extend the grid size to beat our result. For
optimal choice of network architecture, cost function, and comparison, in the original study (Baldi et al., 2014),
optimizer is determined by the properties of the training the authors achieved ≈ 89% by using the entire dataset
and test datasets, which are usually revealed when we with 5, 000, 000 points and a more sophisticated network
try to improve the model. architecture, trained using GPUs.
While there is no “one-size-fits-them-all” recipe to ap-
proach ML problems, we believe that the above list gives
a good overview and can be a useful guideline to the lay- 4. Phases of the 2D Ising model
man. Furthermore, as it becomes clear, this ‘recipe’ can
be applied to generic supervised learning tasks, not just As a second example from physics, we discuss a DNN
DNNs. We refer the reader to Sec. XI for more useful approach to the Ising dataset introduced in Sec. VII.C.1.
hints and tips on how to use the validation data during We study the problem of classifying the states of the 2D
the training process. Ising model with a DNN (Tanaka and Tomiya, 2017a),
focussing on the model performance as a function of both
the number of hidden neurons and the learning rate.
3. SUSY dataset The discussion is accompanied by a notebook written in
TensorFlow. As in the previous example, the interested
As a first example from physics, we discuss a DNN reader can find the discussion of the code-specific details
approach to the SUSY dataset already introduced in the in the notebook.
context of logistic regression in Sec. VII.C.2, and Bagging To classify whether a given spin configuration is in the
in Sec. VIII.F. For a detailed description of the SUSY ordered or disordered phase, we construct a minimalistic
dataset and the corresponding classification problem, we model for a DNN with a single hidden layer containing
refer the reader to Sec. VII.C.2. There is an interest in a number of hidden neurons. The network architecture
using deep learning methods to automate the discovery thus includes a ReLU-activated input layer, the hidden
of collision features from data. Benchmark results using layer, and the softmax output layer. We pick the cate-
Bayesian Decision Trees from a standard physics pack- gorical cross-entropy as a cost function and minimize it
age, and five-layer neural networks using Dropout were using SGD with mini-batches of size 100. We train the
presented in the original paper (Baldi et al., 2014); they DNN for 100 epochs.
demonstrate the ability of deep learning to bypass the Figure 41 shows the outcome of a grid search over a
need of using hand-crafted high-level features. Our goal log-spaced learning rate and the number of neurons in the
here is to study systematically the accuracy of a DNN hidden layer. We see that about 10 neurons are enough
classifier as a function of the learning rate and the dataset at a learning rate of 0.1 to get to a very high accuracy on
size. the test set. However, if we aim at capturing the physics
56

100% gauge theories, to critical phenomena.


Like physical systems, many datasets and supervised
1e-06 1e-05 0.0001 0.001 0.01 0.1 learning tasks also possess additional symmetries and
80% structure. For instance, consider a supervised learning
1 50.5% 49.3% 50.8% 49.7% 52.0% 68.4%
task where we want to label images from some dataset as
hidden neurons

being pictures of cats or not. Our statistical procedure

accuracy (%)
10 60.7% 43.1% 28.0% 75.6% 95.7% 99.2% 60%
must first learn features associated with cats. Because
a cat is a physical object, we know that these features
100 68.9% 70.8% 85.1% 93.3% 99.7% 99.9%
40% are likely to be local (groups of neighboring pixels in the
two-dimensional image corresponding to whiskers, tails,
1000 79.2% 53.9% 84.2% 97.9% 99.8% 99.9% eyes, etc). We also know that the cat can be anywhere
20% in the image. Thus, it does not really matter where in
learning rate the picture these features occur (though relative positions
of features likely do matter). This is a manifestation of
0% translational invariance that is built into our supervised
100%
learning task. This example makes clear that, like many
physical systems, many ML tasks (especially in the con-
1e-06 1e-05 0.0001 0.001 0.01 0.1
text of computer vision and image processing) also pos-
80% sess additional structure, such as locality and translation
1 50.2% 50.1% 49.8% 49.2% 53.7% 60.1% invariance.
The all-to-all coupled neural networks in the previous
hidden neurons

accuracy (%)
10 68.6% 46.4% 39.3% 74.5% 83.7% 84.2% 60% section fail to exploit this additional structure. For exam-
ple, consider the image of the digit ‘four’ from the MNIST
dataset shown in Fig. 26. In the all-to-all coupled neural
100 67.6% 63.9% 55.5% 67.1% 73.1% 93.7%
40% networks used there, the 28 × 28 image was considered
a one-dimensional vector of size 282 = 796. This clearly
1000 67.6% 51.9% 56.2% 59.9% 74.0% 96.0%
throws away lots of the spatial information contained in
20%
learning rate the image. Not surprisingly, the neural networks com-
munity realized these problems and designed a class of
0% neural network architectures, convolutional neural net-
works or CNNs, that take advantage of this additional
FIG. 41 Grid search results for the test set accuracy (top) structure (locality and translational invariance) (LeCun
and the critical set accuracy (bottom) of the DNN for the et al., 1995). Furthermore, what is especially interest-
Ising classification problem as a function of the learning rate ing from a physics perspective is the recent finding that
and the number of hidden neurons. these CNN architectures are intimately related to mod-
els such as tensor networks (Stoudenmire, 2018; Stouden-
mire and Schwab, 2016) and, in particular, MERA-like
close to criticality, clearly more neurons are required to architectures that are commonly used in physical mod-
reliably learn the more complex correlations in the Ising els for quantum condensed matter systems (Levine et al.,
configurations. 2017).

X. CONVOLUTIONAL NEURAL NETWORKS (CNNS) A. The structure of convolutional neural networks

One of the core lessons of physics is that we should ex- A convolutional neural network is a translationally in-
ploit symmetries and invariances when analyzing physi- variant neural network that respects locality of the in-
cal systems. Properties such as locality and translational put data. CNNs are the backbone of many modern deep
invariance are often built directly into the physical laws. learning applications and here we just give a high-level
Our statistical physics models often directly incorporate overview of CNNs that should allow the reader to delve
everything we know about the physical system being an- directly into the specialized literature. The reader is also
alyzed. For example, we know that in many cases it is strongly encouraged to consult the excellent, succinct
sufficient to consider only local couplings in our Hamilto- notes for the Stanford CS231n Convolutional Neural Net-
nians, or work directly in momentum space if the system works class developed by Andrej Karpathy and Fei-Fei Li
is translationally invariant. This basic idea, tailoring our (https://cs231n.github.io/). We have drawn heavily
analysis to exploit additional structure, is a key feature of on the pedagogical style of these notes in crafting this
modern physical theories from general relativity, through section.
57

H Fully
Connected
Layer

W
Convolution Coarse-graining Convolution Coarse-graining
(pooling) (pooling)

FIG. 42 Architecture of a Convolutional Neural Network (CNN). The neurons in a CNN are arranged in three
dimensions: height (H), width (W ), and depth (D). For the input layer, the depth corresponds to the number of channels (in
this case 3 for RGB images). Neurons in the convolutional layers calculate the convolution of the image with a local spatial
filter (e.g. 3 × 3 pixel grid, times 3 channels for first layer) at a given location in the spatial (W, H)-plane. The depth D of the
convolutional layer corresponds to the number of filters used in the convolutional layer. Neurons at the same depth correspond
to the same filter. Neurons in the convolutional layer mix inputs at different depths but preserve the spatial location. Pooling
layers perform a spatial coarse graining (pooling step) at each depth to give a smaller height and width while preserving the
depth. The convolutional and pooling layers are followed by a fully connected layer and classifier (not shown).

There are two kinds of basic layers that make up a the input with P zeros (see Fig. 43). For an input
CNN: a convolution layer that computes the convolu- of width W , the number of neurons (outputs) in the
tion of the input with a bank of filters (as a math- layer is given by (W − F + 2P )/S + 1. We invite the
ematical operation, see this practical guide to image reader to check out this visualization of the convolution
kernels: http://setosa.io/ev/image-kernels/), and procedure, https://github.com/vdumoulin/conv_
pooling layers that coarse-grain the input while main- arithmetic/blob/master/README.md, for a square
taining locality and spatial structure, see Fig. 42. For input of unit depth. After computing the filter, the
two-dimensional data, a layer l is characterized by three output is passed through a non-linearity, a ReLU in Fig.
numbers: height Hl , width Wl , and depth Dl 12 . The 43. In practice, one often inserts a BatchNorm layer
height and width correspond to the sizes of the two- before the non-linearity, cf. Sec. IX.D.3.
dimensional spatial (Wl , Hl )-plane (in neurons), and the These convolutional layers are interspersed with pool-
depth Dl (marked by the different colors in Fig. 42) – ing layers that coarse-grain spatial information by per-
to the number of filters in that layer. All neurons corre- forming a subsampling at each depth. One common pool-
sponding to a particular filter have the same parameters ing operation is the max pool. In a max pool, the spatial
(i.e. shared weights and bias). dimensions are coarse-grained by replacing a small region
In general, we will be concerned with local spatial (say 2×2 neurons) by a single neuron whose output is the
filters (often called a receptive field in analogy with maximum value of the output in the region. In physics,
neuroscience) that take as inputs a small spatial patch this pooling step is very similar to the decimation step
of the previous layer at all depths. For instance, a of RG (Iso et al., 2018; Koch-Janusz and Ringel, 2017;
square filter of size F is a three-dimensional array of Lin et al., 2017; Mehta and Schwab, 2014). This gener-
size F × F × Dl−1 . The convolution consists of running ally reduces the dimension of outputs. For example, if
this filter over all locations in the spatial plane. To the region we pool over is 2 × 2, then both the height
demonstrate how this works in practice, let us a consider and the width of the output layer will be halved. Gen-
the simple example consisting of a one-dimensional erally, pooling operations do not reduce the depth of the
input of depth 1, shown in Fig. 43. In this case, a filter convolutional layers because pooling is performed sepa-
of size F × 1 × 1 can be specified by a vector of weights rately at each depth. A simple example of a max-pooling
w of length F . The stride, S, encodes by how many operation is shown in Fig. 44. There are some studies
neurons we translate the filter by when performing suggesting that pooling might be unnecessary (Springen-
the convolution. In addition, it is common to pad berg et al., 2014), but pooling layers remain a staple of
most CNNs.
In a CNN, the convolution and max-pool layers are
12 The depth Dl is often called “number of channels”, to distin-
generally followed by an all-to-all connected layer and a
guish it from the depth of the neural network itself, i.e. the total high-level classifier such as a soft-max. This allows us
number of layers (which can be convolutional, pooling or fully- to train CNNs as usual using the backprop algorithm,
connected), cf. Fig. 42. cf. Sec. IX.C. From a backprop perspective, CNNs are
58

almost identical to fully connected neural network archi- (a) F=3


tectures except with tied parameters. weight=[1,-1,1]
Apart from introducing additional structure, such as S=1
(units to shift bias=-2 ReLU
translational invariance and locality, this convolutional 0 (unit slope)
structure also has important practical and computational filter by)
benefits. All neurons at a given layer represent the same 1 1 -1 0
filter, and hence can all be described by a single set of
weights and biases. This reduces the number of free pa- 2 1 -1 0
rameters by a factor of H ×W at each layer. For example,
for a layer with D = 102 and H = W = 102 , this gives P=1 2 -1 -3 0
a reduction in parameters of nearly 106 ! This allows for
the training of much larger models than would otherwise -1 6 4 4
be possible with fully connected layers. We are familiar
with similar phenomena in physics: e.g. in translation- 3 -4 -6 0
ally invariant systems we can parametrize all eigenmodes
by specifying only their momentum (wave number) and 0 output
functional form (sin, cos, etc.), while without translation
invariance much more information is required.
input
W=5

B. Example: CNNs for the 2D Ising model


(b) F=4
S=2 weight=[1,-1,2,1]
The inclusion of spatial structure in CNNs is an im- (units to shift
portant feature that can be exploited when designing
neural networks for studying physical systems. In the
filter by) bias=-1 ReLU
accompanying notebook, we used Pytorch to implement 1 (unit slope)
a simple CNN composed of a single convolutional layer
2
followed by a soft-max layer. Every input data point
(i.e. Ising configuration) is shaped as a two-dimensional
2 1 1
array. We varied the output depth (i.e. the number of 2
P=0
output channels) of the convolutional layer from unity –
a single set of weights and one bias – to an output depth
-1 1 0 0
of 50 distinct weights and biases. The CNN was then
trained using SGD for five epochs using a training set
0 output
consisting of samples from far in the paramagnetic and
ordered phases. The results are shown in Fig. 45. The
-2
CNN achieved a 100% accuracy on the test set for all
input
architectures, even for a CNN with depth one. We also
checked the performance of the CNN on samples drawn W=6
from the near-critical region for temperatures T slightly FIG. 43 Two examples to illustrate a one-dimensional
above and below the critical temperature Tc . The CNN convolutional layer with ReLU nonlinearity. Convolu-
performed admirably even on these critical samples with tional layer for a spatial filter of size F for a one-dimensional
an accuracy of between 80% and 90%. As is the case input of width W with stride S and padding P followed by a
with all ML and neural networks, the performance on ReLU non-linearity.
parts of the data that are missing from the training set
is considerably worse than on test data that is similar
to the training data. This highlights the importance of Regarding the SUSY dataset, we stress that the absence
properly constructing an accurate training dataset and of spatial locality in the collision features renders apply-
the considerable obstacles of generalizing to novel situ- ing CNNs to that problem inadequate.
ations. We encourage the interested reader to explore
the corresponding notebook and design better CNN ar-
chitectures with improved generalization performance on C. Pre-trained CNNs and transfer learning
the near-critical set.
The reader may wish to check out the second part of The immense success of CNNs for image recognition
the MNIST notebook for a discussion of CNNs applied to has resulted in the training of huge networks on enormous
the digit recognition using the high-level Keras package. datasets, often by large industrial research teams from
59

3 0 1 0 110
0 1 1 1 3 1
100

Accuracy
4 2
90
2 3 2 1
80
4 1 0 1 test
70 critical
. .
.. .. 60 1 5 10 20 50
Depth of hidden layer
2 5 2 1 FIG. 45 Single-layer convolutional network for classi-
fying phases in the Ising mode. Accuracy on test set and
critical samples for a convolutional neural network with sin-
1 1 0 1 5 2 gle layer of varying depth with filters of size 2, max-pool layer
with receptive field of size 2, followed by soft-max classifier.
Notice that the test accuracy is 100% even for a CNN of depth
1 0 1 0 3 1 one with a single set of weights. Accuracy on the near-critical
dataset is significantly below that for the test set.
3 1 0 1
CS231n mentioned in the introduction to this section.

• Use CNN as fixed feature detector at top


FIG. 44 Illustration of Max Pooling. Illustration of max-
pooling over a 2 × 2 region. Notice that pooling is done at layer. If the new dataset we want to train on is
each depth (vertical axis) separately. The number of outputs small and similar to the original dataset, we can
is halved along each dimension due to this coarse-graining. simply use the CNN as a fixed feature detector
and retrain our classifier. In other words, we re-
move the classifier (soft-max) layer at the top of the
Google, Microsoft, Amazon, etc. Many of these mod- CNN and replace it with a new classifier (linear sup-
els are known by name: AlexNet, GoogLeNet, ResNet, port vector machine (SVM) or soft-max) relevant
InceptionNet, VGGNet, etc. Most researchers and prac- to our supervised learning problem. In this proce-
titioners do not have the resources, data, or time to train dure, the CNN serves as a fixed map from images
networks on this scale. Luckily, the trained models have to relevant features (the outputs of the top fully-
been released and are now available in standard packages connected layer right before the original classifier).
such as the Torch Vision library in Pytorch or the Caffe This procedure prevents overfitting on small, simi-
framework. These models can be used directly as a basis lar datasets and is often a useful starting point for
for fine-tuning in different supervised image recognition transfer learning.
tasks through a process called transfer learning.
• Use CNN as fixed feature detector at inter-
The basic idea behind transfer learning is that the fil- mediate layer. If the dataset is small and quite
ters (receptive fields) learned by the convolution layers different from the dataset used to train the origi-
of these networks should be informative for most im- nal image, the features at the top level might not
age recognition based tasks, not just the ones they were be suitable for our dataset. In this case, one may
originally trained for. In other words, we expect that, want to instead use features in the middle of the
since images reflect the natural world, the filters learned CNN to train our new classifier. These features are
by these CNNs should transfer over to new tasks with thought to be less fine-tuned and more universal
only slight modifications and fine-tuning. In practice, (e.g. edge detectors). This is motivated by the idea
this turns out to be true for many tasks one might be that CNNs learn increasingly complex features the
interested in. deeper one goes in the network (see discussion on
There are three distinct ways one can take a pre- representational learning in next section).
trained CNN and repurpose it for a new task. The follow-
ing discussion draws heavily on the notes from the course • Fine-tune the CNN. If the dataset is large, in
60

addition to replacing and retraining the classifier proxy for the test error in order to make tweaks to our
in the top layer, we can also fine-tune the weights model. It is crucial that we do not use any of the test
of the original CNN using backpropagation. One data to train the algorithm. This is a cardinal sin in
may choose to freeze some of the weights in the ML. We thus suggest the following workflow:
CNN during the procedure or retrain all of them
simultaneously. Estimate optimal error rate (Bayes rate).—The
first thing one should establish is the difficulty of the
All these procedures can be carried out easily by us- task and the best performance one can expect to achieve.
ing packages such as Caffe or the Torch Vision library No algorithm can do better than the “signal” in the
in PyTorch. PyTorch provides a nice python notebook dataset. For example, it is likely much easier to classify
that serves as tutorial on transfer learning. The reader objects in high-resolution images than in very blurry,
is strongly urged to read the Pytorch tutorials carefully low-resolution images. Thus, one needs to establish
if interested in this topic. a proxy or baseline for the optimal performance that
can be expected from any algorithm. In the context of
Bayesian statistics, this is often called the Bayes rate.
XI. HIGH-LEVEL CONCEPTS IN DEEP NEURAL
Since we do not know this a priori, we must get an
NETWORKS
estimate of this. For many tasks such as speech or object
In the previous sections, we introduced deep neural recognition, we can approximate this by the performance
networks and discussed how we can use these networks of humans on the task. For a more specialized task,
to perform supervised learning. Here, we take a step back we would like to ask how well experts, trained at the
and discuss some high-level questions about the practice task, perform. This expert performance then serves as a
and performance of neural networks. The first part of this proxy for our Bayes rate.
section presents a deep learning workflow inspired by the
bias-variance tradeoff. This workflow is especially rele- Minimize underfitting (bias) on training data
vant to industrial applications where one is often trying set.—After we have established the Bayes rate, we want
to employ neural networks to solve a particular problem. to make sure that we are using a sufficiently complex
In the second part of this section, we shift gears and ask model to avoid underfitting on the training dataset.
the question, why have neural networks been so success- In practice, this means comparing the training error
ful? We provide three different high-level explanations rate to the Bayes rate. Since the training error does
that reflect current dogmas. Finally, we end the section not care about generalization (variance), our model
by discussing the limitations of supervised learning meth- should approach the Bayes rate on the training set. If
ods and current neural network architectures. it does not, the bias of the DNN model is too large
and one should try training the model longer and/or
using a larger model. Finally, if none of these techniques
A. Organizing deep learning workflows using the bias-variance work, it is likely that the model architecture is not
tradeoff well suited to the dataset, and one should modify the
neural architecture in some way to better reflect the un-
Imagine that you are given some data and asked derlying structure of the data (symmetries, locality, etc.).
to design a neural network for learning how to per-
form a supervised learning task. What are the best Make sure you are not overfitting.— Next, we
practices for organizing a systematic workflow that run our algorithm on the validation or dev set. If the
allows us to efficiently do this? Here, we present error is similar to the training error rate and Bayes rate,
a simple deep learning workflow inspired by think- we are done. If it is not, then we are overfitting the
ing about the bias-variance tradeoff (see Figure 46). training data. Possible solutions include, regularization
This section draws heavily on Andrew Ng’s tuto- and, importantly, collecting more data. Finally, if
rial at the Deep Learning School (available online none of these work, one likely has to change the DNN
at https://www.youtube.com/watch?v=F1ka6a13S9I) architecture.
which readers are strongly encouraged to watch.
If the validation and test sets are drawn from the same
The first thing we would like to do is divide the data distributions, then good performance on the validation
into three parts. A training set, a validation or dev set should lead to similarly good performance on the
(development) set, and a test set. The test set is the test set. (Of course performance will typically be slightly
data on which we want to make predictions. The dev set worse on the test set because the hyperparameters were
is a subset of the training data we use to check how well fit to the validation set.) However, sometimes the train-
we are doing out-of-sample, after training the model on ing data and test data differ in subtle ways because, for
the training dataset. We use the validation error as a example, they are collected using slightly different meth-
61

Establish proxy for op;mal error rate (e.g. expert performance)


1. Neural networks as representation learning

One important and powerful aspect of the deep learn-


ing paradigm is the ability to learn relevant features
Yes of the data with relatively little domain knowledge, i.e.
Bigger model
Training error high? Train longer with minimal hand-crafting. Often, the power of deep
Underfi9ng New model architecture learning stems from its ability to act like a black box
No
that can take in a large stream of data and find good
features that capture properties of the data we are in-
Yes terested in. This ability to learn good representations
Valida;on error high? More data with very little hand-tuning is one of the most attractive
Regulariza;on
Overfi9ng
New model architecture
properties of DNNs. Many of the other supervised learn-
No ing algorithms discussed here (regression-based models,
ensemble methods such as random forests or gradient-
boosted trees) perform comparably or even better than
DONE! neural networks but when using hand-crafted features
with small-to-intermediate sized datasets.
FIG. 46 Organizing a workflow for Deep Learning. The hierarchical structure of deep learning models is
Schematic illustrating a deep learning workflow inspired by
thought to be crucial to their ability to represent com-
navigating the bias-variance tradeoff (Figure based on An-
drew Ng’s talk at the 2016 Deep Learning School available at plex, abstract features. For example, consider the use
https://www.youtube.com/watch?v=F1ka6a13S9I.) In this of CNNs for image classification tasks. The analysis of
diagram, we have assumed that there in no mismatch be- CNNs suggests that the lower-levels of the neural net-
tween the distributions the training and test sets are drawn works learn elementary features, such as edge detectors,
from. which are then combined into higher levels of the net-
works into more abstract, higher-level features (e.g. the
famous example of a neuron that “learned to respond to
ods, or because it is cheaper to collect data in one way cats”) (Le, 2013). More recently, it has been shown that
versus another. In this case, there can be a mismatch CNNs can be thought of as performing tensor decompo-
between the training and test data. This can lead to sitions on the data similar to those commonly used in
the neural network overfitting these small differences be- numerical methods in modern quantum condensed mat-
tween the test and training sets, and a poor performance ter (Cohen et al., 2016).
on the test set despite having a good performance on One of the interesting consequences of this line of
the validation set. To rectify this, Andrew Ng suggests thinking is the idea that one can train a CNN on one
making two validation or dev sets, one constructed from large dataset and the features it learns should also be use-
the training data and one constructed from the test data. ful for other supervised tasks. This results in the ability
The difference between the performance of the algorithm to learn important and salient features directly from the
on these two validation sets quantifies the train-test mis- data and then transfer this knowledge to a new task. In-
match. This can serve as another important diagnostic deed, this ability to learn important, higher-level, coarse-
when using DNNs for supervised learning. grained features is reminiscent of ideas like the renormal-
ization group (RG) in physics where the RG flows sep-
arate out relevant and irrelevant directions, and certain
unsupervised deep learning architectures have a natural
interpretation in terms of variational RG schemes (Mehta
B. Why neural networks are so successful: three high-level and Schwab, 2014).
perspectives on neural networks

Having discussed the basics of neural networks, we con- 2. Neural networks can exploit large amounts of data
clude by giving three complementary perspectives on the
success of DNNs and Deep Learning. This high-level dis- With the advent of smartphones and the internet, there
cussion reflects various dogmas and intuitions about the has been an explosion in the amount of data being gen-
success of DNNs and is in no way definitive or conclusive. erated. This data-rich environment favors supervised
As the reader was already warned in the introduction to learning methods that can fully exploit this rich data
DNNs, the field is rapidly expanding and many of these world. One important reason for the success of DNNs
perspectives may turn out to be only partially true or is that they are able to exploit the additional signal in
even false. Nonetheless, we include them here as a guide- large datasets for difficult supervised learning tasks. Fun-
post for readers. damentally, modern DNNs are unique in that they con-
62

3. Neural networks scale up well computationally


Small
data A final feature that is thought to underlie the success
regime Large NN of modern neural networks is that they can harness the
immense increase in computational capability that has
occurred over the last few decades. The architecture of
Performance

Medium NN neural networks naturally lends itself to parallelization


and the exploitation of fast but specialized processors
Small NN such as graphical processing units (GPUs). Google and
NVIDIA set on a course to develop TPUs (tensor pro-
cessing units) which will be specifically designed for the
Traditional mathematical operations underlying deep learning archi-
(e.g. logistic reg) tectures. The layered architecture of neural networks also
makes it easy to use modern techniques such as automatic
differentiation that make it easy to quickly deploy them.
Algorithms such as stochastic gradient descent and the
use of mini-batches make it easy to parallelize code and
Amount of Data train much larger DNNs than was thought possible fifteen
years ago. Furthermore, many of these computational
FIG. 47 Large neural networks can exploit the vast
amount of data now available. Schematic of how neural
gains are quickly incorporated into modern packages with
network performance depends on amount of available data industrial resources. This makes it easy to perform nu-
(Figure based on Andrew Ng’s talk at the 2016 Deep Learn- merical experiments on large datasets, leading to further
ing School available at https://www.youtube.com/watch?v= engineering gains.
F1ka6a13S9I.)

C. Limitations of supervised learning with deep networks

Like all statistical methods, supervised learning using


tain millions of parameters, yet can still be trained on neural networks has important limitations. This is es-
existing hardwares. The complexity of DNNs (in terms pecially important when one seeks to apply these meth-
of parameters) combined with their simple architecture ods, especially to physics problems. Like all tools, DNNs
(layer-wise connections) hit a sweet spot between expres- are not a universal solution. Often, the same or better
sivity (ability to represent very complicated functions) performance on a task can be achieved by using a few
and trainability (ability to learn millions of parameters). hand-engineered features (or even a collection of random
features). This is especially important for hard physics
Indeed, the ability of large DNNs to exploit huge problems where data (or Monte-Carlo samples) may be
datasets is thought to differ from many other commonly hard to come by.
employed supervised learning methods such as Support Here we list some of the important limitations of su-
Vector Machines (SVMs). Figure 47 shows a schematic pervised neural network based models.
depicting the expected performance of DNNs of differ-
ent sizes with the number of data samples and compares • Need labeled data.—Like all supervised learn-
them to supervised learning algorithms such as SVMs or ing methods, DNNs for supervised learning require
ensemble methods. When the amount of data is small, labeled data. Often, labeled data is harder to ac-
DNNs offer no substantial benefit over these other meth- quire than unlabeled data (e.g. one must pay for
ods and often perform worse. However, large DNNs seem human experts to label images).
to be able to exploit additional data in a way other meth-
ods cannot. The fact that one does not have to hand • Supervised neural networks are extremely
engineer features makes the DNN even more well suited data intensive.—DNNs are data hungry. They
for handling large datasets. Recent theoretical results perform best when data is plentiful. This is doubly
suggest that as long as a DNN is large enough, it should so for supervised methods where the data must also
generalize well and not overfit (Advani and Saxe, 2017). be labeled. The utility of DNNs is extremely lim-
In the data-rich world we live in (at least in the context ited if data is hard to acquire or the datasets are
of images, videos, and natural language), this is a recipe small (hundreds to a few thousand samples). In
for success. In other areas where data is more limited, this case, the performance of other methods that
deep learning architectures have (at least so far) been less utilize hand-engineered features can exceed that of
successful. DNNs.
63

• Homogeneous data.—Almost all DNNs deal A. Some of the challenges of high-dimensional data
with homogeneous data of one type. It is very hard
to design architectures that mix and match data Before we begin exploring some specific dimensional
types (i.e. some continuous variables, some discrete reduction techniques, it is useful to highlight some of the
variables, some time series). In applications beyond generic difficulties encountered when dealing with high-
images, video, and language, this is often what is dimensional data.
required. In contrast, ensemble models like random
forests or gradient-boosted trees have no difficulty
handling mixed data types. a. High-dimensional data lives near the edge of sample space.
Geometry in high-dimensional space can be counterintu-
itive. One example that is pertinent to machine learning
• Many physics problems are not about is the following. Consider data distributed uniformly at
prediction.—In physics, we are often not inter- random in a D-dimensional hypercube C = [−e/2, e/2]D ,
ested in solving prediction tasks such as classifi- where e is the edge length. Consider also a D-dimensional
cation. Instead, we want to learn something about hypersphere S of radius e/2 centered at the origin and
the underlying distribution that generates the data. contained within C. The probability that a data point x
In this case, it is often difficult to cast these ideas in drawn uniformly at random in C is contained within S
a supervised learning setting. While the problems is well approximated by the ratio of the volume of S to
are related, it’s possible to make good predictions that of C : p(kxk2 < e/2) ∼ (1/2)D . Thus, as the di-
with a “wrong” model. The model might or might mension of the feature space D increases, p goes to zero
not be useful for understanding the physics. exponentially fast. In other words, most of the data will
concentrate outside the hypersphere, in the corners of
Some of these remarks are particular to DNNs, oth- the hypercube. In physics, this basic observation under-
ers are shared by all supervised learning methods. This lies many properties of ideal gases such as the Maxwell
motivates the use of unsupervised methods which in part distribution and the equipartition theorem (see Chapter
circumnavigate these problems. 3 of (Sethna, 2006) for instance).

b. Real-world data vs. uniform distribution. Fortunately,


XII. DIMENSIONAL REDUCTION AND DATA real-world data is not random or uniformly distributed!
VISUALIZATION In fact, real data usually lives in a much lower dimen-
sional space than the original space in which the fea-
Unsupervised learning is concerned with discovering tures are being measured. This is sometimes referred to
structure in unlabeled data. In this section, we will be- as the “blessing of non-uniformity” (in opposition to the
gin our foray into unsupervised learning by way of data curse of dimensionality). Data will typically be locally
visualization. Data visualization methods are important smooth, meaning that a local variation of the data will
for modeling as they can be used to identify correlated or not incur a change in the target variable (Bishop, 2006).
redundant features along with irrelevant features (noise) This idea is central to statistical physics and field the-
from raw or processed data. Conceivably, being able to ories, where properties of systems with an astronomical
identify and capture such characteristics in a dataset can number of degrees of freedom can be well characterized
help in designing better predictive models. For data in- by low-dimensional “order parameters” or effective de-
volving a relatively small number of features, studying grees of freedom. Another instantiation of this idea is
pair-wise correlations (i.e. pairwise scatter plots of all manifest in the description of the bulk properties of a
features) may suffice in performing a complete analysis. gas of weakly interacting particles, which can be sim-
This rapidly becomes impractical for datasets involving ply described by the thermodynamic variables (temper-
a large number of measured featured (such as images). ature, pressure, etc.) that enter the equation of state
Thus, in practice, we often have to perform dimensional rather than the enormous number of dynamical variables
reduction, namely, project or embed the data onto a lower (i.e. position and momentum) of each particle in the gas.
dimensional space, which we refer to as the latent space.
As we will discuss, part of the complication of dimen-
sional reduction lies in the fact that low-dimensional rep- c. Intrinsic dimensionality and the crowding problem. A re-
resentations of high-dimensional data necessarily incurs current objective of dimensional reduction techniques is
information lost. Below, we introduce some common lin- to preserve the relative pairwise distances (or defined sim-
ear and nonlinear methods for performing dimensional ilarities) between data points from the original space to
reduction with applications in data visualization of high- the latent space. This is a natural requirement, since
dimensional data. we would like for nearby data points (as measured in the
64

a) b)
2D 1D

FIG. 48 The “Swiss roll”. Data distributed in a three- FIG. 49 Illustration of the crowding problem. (Left) A two-
dimensional space (a) that can effectively be described on a dimensional dataset X consisting of 3 equidistant points.
two-dimensional surface (b). A common goal of dimensional (Right) Mapping X to a one-dimensional space while try-
reduction techniques is to preserve ordination in the data: ing to preserve relative distances leads to a collapse of the
points that are close-by in the original space are also near-by mapped data points.
in the mapped (latent) space. This is true of the mapping (a)
to (b) as can be seen by inspecting the color gradient.
B. Principal component analysis (PCA)

A ubiquitous method for dimensional reduction, data


visualization and analysis is Principal Component Anal-
original space) to remain close-by after the corresponding ysis (PCA). The goal of PCA is to perform an orthog-
mapping to the latent space. onal transformation of the data in order to find high-
variance directions. PCA is inspired by the observation
Consider the example of the “Swiss roll” presented in that in many cases, the relevant information in a signal
FIG. 48a. There, the relevant structure of the data cor- is contained in the directions with largest13 variance (see
responds to nearby points with similar colors and is en- FIG. 50). Directions with small variance are ascribed to
coded in the “unrolled” data in the latent space, see FIG. “noise” and can potentially be removed or ignored.
48b. Clearly, in this example a two-dimensional space
is sufficient to capture almost the entirety of the infor-
mation in the data. A concept which stems from signal
processing that is relevant to our current exposition is signal
that of the intrinsic dimensionality of the data. Quali-
tatively, it refers to the minimum number of dimensions
required to capture the signal in the data. In the case
noise
of the Swiss roll, it is 2 since the Swiss roll can effec-
tively be parametrized using only two parameters, i.e.
X ∈ {(x1 sin(x1 ), x1 cos(x1 ), x2 )}. The minimum num-
ber of parameters required for such a parametrization is
the intrinsic dimensionality of the data (Bennett, 1969).
Attempting to represent data in a space of dimension-
ality lower than its intrinsic dimensionality can lead to
a “crowding” problem (Maaten and Hinton, 2008) (see
schematic, FIG. 49). In short, because we are attempting
to satisfy too many constraints (e.g. preserve all relative
FIG. 50 PCA seeks to find the set of orthogonal directions
distances of the original space), this results in a trivial so- with largest variance. This can be seen as “fitting” an ellipse
lution for the latent space where all mapped data points to the data with the major axis corresponding to the first
collapse to the center of the map. principal component (direction of largest variance). PCA as-
sumes that directions with large variance correspond to the
To alleviate this, one needs to weaken the constraints true signal in the data while directions with low variance cor-
imposed on the visualization scheme. Powerful methods respond to noise.
such as t-distributed stochastic embedding (Maaten and
Hinton, 2008) (in short, t-SNE, see section XII.D) and
uniform manifold approximation and projection (UMAP)
(McInnes et al., 2018) have been devised to circumvent 13 This assumes that the features are measured and compared using
this issue in various ways. the same units.
65

cently, a correspondence between PCA and Renormal-


ization Group flows across the phase transition in the 2D
Ising model (Foreman et al., 2017) and in a more general
setting (Bradde and Bialek, 2017) has been proposed.
In statistical physics, PCA has also found application
in detecting phase transitions (Wetzel, 2017), e.g. in the
XY model on frustrated triangular and union jack lat-
tices (Wang and Zhai, 2017). PCA was also used to clas-
sify dislocation patterns in crystals (Papanikolaou et al.,
2017; Wang and Zhai, 2018), and to find correlations in
the shear flow of athermal amorphous solids (Ruscher
and Rottler, 2018). PCA is widely employed in biolog-
ical physics when working with high-dimensional data.
Physics has also inspired PCA-based algorithms to infer
relevant features in unlabelled data (Bény, 2018). Con-
cretely, consider N data points, {x1 , . . . xN } that live in
a p-dimensional feature space Rp . Without loss of gener-
ality, we assume that the empirical mean x̄ = N −1 i xi
P
of these data points is zero14 . Denote the N × p design
matrix as X = [x1 , x2 , . . . ; xN ]T whose rows are the data
points and columns correspond to different features. The
p × p (symmetric) covariance matrix is therefore

1
Σ(X) = X T X. (129)
N −1
Notice that the j-th diagonal entry of Σ(X) corresponds
to the variance of the j-th feature and Σ(X)ij measures
the covariance (i.e. connected correlation in the language
of physics) between feature i and feature j.
FIG. 51 (a) The first 2 principal component of the Ising We are interested in finding a new basis for the data
dataset with temperature indicated by the coloring. PCA that emphasizes highly variable directions while reducing
was performed on a joined dataset of 1000 samples taken at redundancy between basis vectors. In particular, we will
each temperatures T = 0.25, 0.5, · · · , 4.0. Almost all the vari- look for a linear transformation that reduces the covari-
ance is explained in the first component which corresponds ance between different features. To do so, we first per-
to the magnetization order parameter (linear combination of
form singular value decomposition (SVD) on the design
the features with weights all roughly equal). The paramag-
netic phase corresponds to the middle cluster and the left and matrix X, namely, X = U SV T , where S is a diagonal
right clusters correspond to the symmetry-related ferromag- matrix of singular value si , the orthogonal matrix U con-
netic phases (b) Log of the spectrum of the covariance matrix tains (as its columns) the left singular vectors of X, and
versus rank ordering. Only one dimension has high-variance. similarly V contains (as its columns) the right singular
vectors of X. With this, one can rewrite the covariance
matrix as

Surprisingly, such PCA-based projections often cap- 1


Σ(X) = V SU T U SV T
ture a lot of the large scale structure of many datasets. N −1
S2
 
For example, Figure 51 shows the projection of samples =V VT
drawn from the 2D Ising model at various temperatures N −1
on the first two principal components. Despite living in ≡ V ΛV T . (130)
a 1600 dimensional space (the samples are 40 × 40 spin
configurations), a single principal component (i.e. a sin- where Λ is a diagonal matrix with eigenvalues λi in the
gle direction in this 1600 dimensional space) can cap- decreasing order along the diagonal (i.e. eigendecompo-
ture 50% of the variability contained in our samples. sition). It is clear that the right singular vectors of X
In fact, one can verify that this direction weights all (i.e. the columns of V ) are principal directions of Σ(X),
1600 spins nearly equally and thus corresponds to the
magnetization order parameter. Thus, even without any
prior physical knowledge, one can extract relevant order
14
parameters using a simple PCA-based projection. Re- We can always center around the mean: x̄ ← xi − x̄
66

and the singular values of X are related to the eigenval- to the number of data points, and are thus very limited
ues of the covariance matrix Σ(X) via λi = s2i /(N − 1). in their application to large datasets. However, sample-
To reduce the dimensionality of data from p to p̃ < p, we based methods have been introduce to reduce this scaling
first construct the p× p̃ projection matrix Ṽp0 by selecting to O(N log N ) (Yang et al., 2006). In the case of PCA,
the singular components with the p̃ largest singular val- a complete decomposition has a scaling of O(N p2 + p3 ),
ues. The projection of the data from p to a p̃ dimensional where p is the number of features. Note that the first
space is simply Ỹ = X Ṽp0 . The same idea is central term N p2 is due to the computation of covariance ma-
to matrix-product-state-like techniques used to compress trix Eq.(129) while the second, p3 , stems from eigenvalue
the number of components in quantum wavefunctions in decomposition. Nothe that PCA can be improved to bear
studies of low-dimensional many-body lattice systems. complexity O(N p2 +p) if only the first few principal com-
The singular vector with the largest singular value (i.e ponents are desired (using iterative approaches). PCA
the largest variance) is referred to as the first principal and MDS are often among the first data visualization
component; the singular vector with the second largest techniques one resorts to.
singular value as the second principal component,
Pp and so
on. An important quantity is the ratio λi / i=1 λi which
is referred as the percentage of the explained variance D. t-SNE
contained in a principal component (see FIG. 51.b).
It is common in data visualization to present the data It is often desirable to preserve local structures in
projected on the first few principal components. This is high-dimensional datasets. However, when dealing with
valid as long as a large part of the variance is explained datasets having clusters delimitated by complicated sur-
in those components. Low values of explained variance faces or datasets with a large number of clusters, preserv-
may imply that the intrinsic dimensionality of the data is ing local structures becomes difficult using linear tech-
high or simply that it cannot be captured by a linear rep- niques such as PCA. Many non-linear techniques such as
resentation. For a detailed introduction to PCA, see the non-classical MDS (Cox and Cox, 2000), self-organizing
tutorials by Shlens (Shlens, 2014) and Bishop (Bishop, map (Kohonen, 1998), Isomap (Tenenbaum et al., 2000)
2006). and Locally Linear Embedding (Roweis and Saul, 2000)
have been proposed and to address this class of problems.
These techniques are generally good at preserving local
C. Multidimensional scaling structures in the data but typically fail to capture struc-
tures at the larger scale such as the clusters in which the
Multidimensional scaling (MDS) is a non-linear dimen- data is organized (Maaten and Hinton, 2008).
sional reduction technique which preserves the pairwise Recently, t-stochastic neighbor embedding (t-SNE) has
distance or dissimilarity dij between data points (Cox emerged as one of the go-to methods for visualizing high-
and Cox, 2000). Moving forward, we use the term “dis- dimensional data. It has been shown to offer insight-
tance” and “dissimilarity” interchangeably. There are two ful visualization for many benchmark high-dimensional
types of MDS: metric and non-metric. In metric MDS, datasets (Maaten and Hinton, 2008). t-SNE is a non-
the distance is computed under a pre-defined metric and parametric15 method that constructs non-linear embed-
the latent coordinates Ỹ are obtained by minimizing the dings. Each high-dimensional training point is mapped
difference between the distance measured in the original to low-dimensional embedding coordinates, which are op-
space (dij (X)) and that in the latent space (dij (Y )): timized in a way to preserve the local structure in the
X data.
Ỹ = arg min wij |dij (X) − dij (Y )|, (131) When used appropriately, t-SNE is a powerful tech-
Y
i<j nique for unraveling the hidden structure of high-
dimensional datasets while at the same time preserv-
where wij ≥ 0 are weight values. The weight matrix wij
ing locality. In physics, t-SNE has recently been used
is a set of free parameters that specify the level of confi-
to reduce the dimensionality and classify spin configu-
dence (or precision) in the value of dij (X). If Euclidean
rations, generated with the help of Monte Carlo sim-
metric is used, MDS gives the same result as PCA and is
ulations, for the Ising (Carrasquilla and Melko, 2017)
usually referred to as classical scaling (Torgerson, 1958).
and Fermi-Hubbard models at finite temperatures (Ch’ng
Thus MDS is often considered as a generalization of PCA.
et al., 2017). It was also applied to study clustering tran-
In non-metric MDS, dij can be any distance matrix. The
sitions in glass-like problems in the context of quantum
objective function is then to preserve the ordination in
the data, i.e. if d12 (X) < d13 (X) in the original space,
then in the latent space we should have d12 (Y ) < d13 (Y ).
Both MDS and PCA can be implemented using stan- 15 It does not explicitly parametrize feature extraction required to
dard Python packages such as Scikit. MDS algorithms compute the embedding coordinates. Thus it cannot be applied
typically have a scaling of O(N 3 ) where N corresponds to find the coordinate of new data points.
67

control (Day et al., 2019). gradient of (135) with respect to yi explicitly:


The idea of stochastic neighbor embedding is to asso- X X
ciate a probability distribution to the neighborhood of ∂yi C = 4pij qij Zi (yi − yj ) − 2
4qij Zi (yi − yj ),
each data (note x ∈ Rp , p is the number of features): j6=i j6=i

= Fattractive,i − Frepulsive,i , (136)


exp(−||xi − xj ||2 /2σi2 )
pi|j = P 2 2 , (132)
k6=i exp(−||xi − xk || /2σi ) where Zi = 1/( k6=i (1 + ||yk − yi ||2 )−1 ). We have sepa-
P
rated the gradient of point yi into an attractive Fattractive
where pi|j can be interpreted as the likelihood that xj is and repulsive term Frepulsive . Notice that Fattractive,i in-
xi ’s neighbor (thus we take pi|i = 0). σi are free band- duces a significant attractive force only between points
width parameters that are usually determined by fixing that are nearby point i in the original space since it in-
the local entropy H(pi ) of each data point: volves the pij term. Finding the embedding coordinates
x1 equilibrium
yi is thus equivalent to finding ythe x2 yconfigura-
2
X 1
H(pi ) ≡ − pj|i log2 pj|i . (133) tion of particles interacting through the forces in (136).
j

The local entropy is then set to equal a constant across all


data points Σ = 2H(pi ) , where Σ is called the perplexity. short-tail
The perplexity constraint determines σi ∀ i and implies yi = arg min |p(xi )
y
q(y)|
that points in regions of high-density will have smaller long-tail
σi .
Using Gaussian likelihoods in pi|j implies that only
points that are nearby xi contribute to its probability p
distribution. While this ensures that the similarity for
q
nearby points is well represented, this can be a prob- x0,y0
lem for points that are far away from xi (i.e. outliers):
they have exponentially vanishing contributions to the
distribution, which in turn means that their embedding y1 x2 y2
coordinates are ambiguous (Maaten and Hinton, 2008). x1
One way around this is to define a symmetrized distri-
bution pij ≡ (pi|j + pj|i )/(2N ). This guarantees that FIG. 52 Illustration of the t-SNE embedding. xi points cor-
j pij > 1/(2N ) for all data points xi , resulting in each
respond to the original high-dimensional points while the yi
P
data point xi making a significant contribution to the points are the corresponding low-dimensional map points pro-
cost function to be defined below. duced by t-SNE. Here we consider two points, x1 , x2 , that are
respectively “close” and “far” from x0 . The high-dimensional
t-SNE constructs a similar probability distribution qij Gaussian (short-tail) distribution p(x) of x0 ’s neighbors is
in a low dimensional latent space (with coordinates Y = shown in blue. The low-dimensional Cauchy (fat-tail) distri-
0
{yi }, yi ∈ Rp , where p0 < p is the dimension of the latent bution q(y) of x0 ’s neighbors is shown in red. The map point
space): yi , are obtained by minimizing the difference |q(y) − p(xi )|
(similar to minimizing the KL divergence). We see that point
(1 + ||yi − yj ||2 )−1 x1 is mapped to short distances |y1 −y0 |. In contrast, far-away
qij = P 2 −1
. (134) points such as x2 are mapped to relatively large distances
k6=i (1 + ||yi − yk || ) |y2 − y0 |.
The crucial point to note is that qij is chosen to be a long
tail distribution. This preserves short distance informa- Below, we list some important properties that one
tion (relative neighborhoods) while strongly repelling two should bear in mind when analyzing t-SNE plots.
points that are far apart in the original space (see FIG.
• t-SNE can rotate data. The KL divergence is in-
52). In order to find the latent space coordinates yi , t-
variant under rotations in the latent space, since it
SNE minimizes the Kullback-Leibler divergence between
only depends on the distance between points. For
qij and pij :
this reason, t-SNE plots that are rotations of each
  other should be considered equivalent.
X pij
C(Y ) = DKL (p||q) ≡ pij log . (135)
ij
qij • t-SNE results are stochastic. In applying gradient
descent the solution will depend on the initial seed.
This minimization is done via gradient descent (see sec- Thus, the map obtained may vary depending on the
tion IV). We can gain further insights on what the em- seed used and different t-SNE runs will give slightly
bedding cost-function C is capturing by computing the different results.
68

• t-SNE generally preserves short distance informa-


tion. As a rule of thumb, one should expect that
nearby points on the t-SNE map are also closeby in
the original space, i.e. t-SNE tends to preserve or-
dination (but not actual distances). For a pictorial
explanation of this, we refer the reader to Figure
52.
• Scales are deformed in t-SNE. Since a scale-free dis-
tribution is used in the latent space, one should not
put too much emphasis on the meaning of the size
of any clusters observed in the latent space.
• t-SNE is computationally intensive. Finally, a
direct implementation of t-SNE has an algorith-
mic complexity of O(N 2 ) which is only appli-
cable to small to medium data sets. Improved
scaling of the form O(N log N ) can be achieved
at the cost of approximating Eq. (135) by us-
ing the Barnes-Hut method (Van Der Maaten,
2014) for N -body simulations (Barnes and Hut,
1986). More recently extremely efficient t-
SNE implementation making use of fast Fourier FIG. 53 Different visualizations of a Gaussian mixture formed
transforms for kernel summations in (136) have of K = 30 mixtures in a D = 40 dimensional space. The
Gaussians have the same covariance but have means drawn
been made available on https://github.com/
uniformly at random in the space [−10, 10]40 . (a) Plot of the
KlugerLab/FIt-SNE (Linderman et al., 2017). first two coordinates. The labels of the different Gaussian is
As an illustration, in Figure 53 we applied t-SNE to indicated by the different colors. Note that in a realistic set-
a Gaussian mixture model consisting of thirty Gaus- ting, label information is of course not available, thus making
it very hard to distinguish the different clusters. (b) Random
sians, whose means are uniformly distributed in forty-
projection of the data onto a 2 dimensional space. (c) pro-
dimensional space. We compared the results to a random jection onto the first 2 principal components. Only a small
two-dimensional projection and PCA. It is clear that un- fraction of the variance is explained by those components (the
like more naïve dimensional reduction techniques, both ratio is indicated along the axis). (d) t-SNE embedding (per-
PCA and t-SNE can identify the presence of well-formed plexity = 60, # iteration = 1000) in a 2 dimensional latent
clusters. The t-SNE visualization cleanly separates all space. t-SNE captures correctly the local structure of the
the clusters while certain clusters blend together in the data.
PCA plot. This is a direct consequence of the fact that
t-SNE keeps nearby points close together while repelling
points that are far apart.
Figure 54 shows t-SNE and PCA plots for the MNIST
dataset of ten handwritten numerical digits (0-9). It is
clear that the non-linear nature of t-SNE makes it much
better at capturing and visualizing the complicated cor-
relations between digits, compared to PCA.

XIII. CLUSTERING

In this section, we continue our discussion of unsuper- FIG. 54 Visualization of the MNIST handwritten digits train-
vised learning methods. Unsupervised learning is con- ing dataset (here N = 60000). (a) First two principal
cerned with discovering structure in unlabeled data (for components. (b) t-SNE applied with a perplexity of 30,
a Barnes-Hut angle of 0.5 and 1000 gradient descent iter-
instance learning local structures for data visualization, ations. In order to reduce the noise and speed-up compu-
see section XII). The lack of labels make unsupervised tation, PCA was first applied to the dataset to project it
learning much more difficult and subtle than its super- down to 40 dimensions. We used an open-source implemen-
vised counterpart. What is somewhat surprising is that tation to produce the results (Linderman et al., 2017), see
even without labels it is still possible to uncover and ex- https://github.com/KlugerLab/FIt-SNE.
ploit the hidden structure in the data. Perhaps, the sim-
plest example of unsupervised learning is clustering. The
69

aim of clustering is to group unlabelled data into clusters A. Practical clustering methods
according to some similarity or distance measure. Infor-
mally, a cluster is thought of as a set of points sharing Throughout this section we focus on the Euclidean dis-
some pattern or structure. tance as a similarity measure. Other measures may be
better suited for specific problems. We refer the enthusi-
Clustering finds many applications throughout data
ast reader to (Rokach and Maimon, 2005) for a more in-
mining (Larsen and Aone, 1999), data compression and
depth discussion of the different possible similarity mea-
signal processing (Gersho and Gray, 2012; MacKay,
sures.
2003). Clustering can be used to identify coarse features
or high level structures in an unlabelled dataset. The
technique also finds many applications in physical sci-
1. K-means
ences, ranging from detecting celestial emission sources
in astronomical surveys (Sander et al., 1998) to inferring
groups of genes and proteins with similar functions in We begin our discussion with K-means clustering since
biology (Eisen et al., 1998), and building entanglement this method is simple to implement and understand, and
classifiers (Lu et al., 2017). Clustering is perhaps the covers the core concepts of clustering. Consider a set of
N
simplest way to look for hidden structure in a dataset N unlabelled observations {xn }n=1 where xn ∈ Rp and
and for this reason, is among the most widely used and where p is the number of features. Also consider a set
K
employed data analysis and machine learning techniques. of K cluster centers called the cluster means: {µk }k=1 ,
with µk ∈ R , which we’ll compute “emperically" in the
p

The field of clustering is vast and there exists a cluserting procedure. The cluster means can be thought
flurry of clustering methods suited for different purposes. of as the representatives of each cluster, to which data
Some common considerations one has to take into ac- points are assigned (see FIG. 55). K-means clustering
count when choosing a particular method is the distribu- can be formulated as follows: given a fixed integer K, find
tion of the clusters (overlapping/noisy clusters vs. well- the cluster means {µ} and the data point assignments in
separated clusters), the geometry of the data (flat vs. order to minimize the following objective function:
non-flat), the cluster size distribution (multiple sizes vs.
uniform sizes), the dimensionality of the data (low vs. K X
X N

high dimensional) and the computational efficiency of the C({x, µ}) = rnk (xn − µk )2 , (137)
desired method (small vs. large dataset). k=1 n=1

We begin section XIII.A with a focus on popular prac- where rnk ∈ {0, 1} is a binary variable called the assign-
tical clustering methods such as K-means clustering, hi- ment. The assignment rnk is 1 if xnPis assigned to cluster
erarchical clustering and density clustering. Our goal is Pand 0 otherwise. Notice that
k k rnk = 1 ∀ n and
to highlight the strength, weaknesses and differences be- r
n nk ≡ N k , where N k the number of points assigned
tween these techniques, while laying out some of the theo- to cluster k. The minimization of this objective func-
retical framework required for clustering analysis. There tion can be understood as trying to find the best cluster
exist many more clustering methods beyond those dis- means such that the variance within each cluster is min-
cussed in this section16 . The methods we discuss were imized. In physical terms, C is equivalent to the sum of
chosen for their pedagogical value and/or their applica- the moments of inertia of every cluster. Indeed, as we
bility to problems in physics. will see below, the cluster means µk correspond to the
centers of mass of their respective cluster.
In section XIII.B we discuss gaussian mixture models
and the formulation of clustering through latent variable
models. This section introduces many of the methods we
will encounter when discussing other unsupervised learn- K-means algorithm. The K-means algorithm alter-
ing methods later in the review. Finally, in section XIII.C nates between two steps:
we discuss the problem of clustering in high-dimensional
1. Expectation: Given a set of assignments {rnk },
data and possible ways to tackle this difficult problem.
minimize C with respect to µk . Taking a simple
The reader is also urged to experiment with various clus-
derivative and setting it to zero yields the follow-
tering methods using Notebook 15.
ing update rule:

1 X
µk = rnk xn . (138)
Nk n

16 Our complementary Python notebook introduces some of these 2. Maximization: Given a set of cluster means {µk },
other methods. find the assignments {rnk } which minimizes C.
70

Clearly, this is achieved by assigning each data the data set (more specifically the complexity is O(KN )
point to their nearest cluster-mean: per iteration) and is thus scalable to very large datasets.
( As we will see in section XIII.B, K-means is a hard-
1 if k = arg mink0 (xn − µk0 )2 assignment limit of the Gaussian mixture model where
rnk = (139)
0 otherwise all cluster variances are assumed to be the same. This
highlights a common drawback of K-means: if the true
K-means clustering consists in alternating between these clusters have very different variances (spreads), K-means
two steps until some convergence criterion is met. Practi- can lead to spurious results since the underlying assump-
cally, the algorithm should terminate when the change in tion is that the latent model has uniform variances.
the objective function from one iteration to another be-
comes smaller than a pre-specified threshold. A simple
2. Hierarchical clustering: Agglomerative methods
example of K-means is presented in FIG. 55.
Agglomerative clustering is a bottom up approach that
C = 10.5, t = 1 a) C = 8.8, t = 10 b) starts from small initial clusters which are then progres-
sively merged to form larger clusters. The merging pro-
cess generates a hierarchy of clusters that can be visu-
alized in the form of a dendrogram (see FIG. 56). This
hierarchy can be useful to analyze the relation between
clusters and the subcomponents of individual clusters.
Agglomerative methods are usually specified by defin-
ing a distance measure between clusters17 . We denote
the distance between clusters X and Y by d(X, Y ) ∈ R.
Different choices of distance result in different clustering
d)
C = 8.0, t = 20 c) 10.5 algorithms. At each step, the two clusters that are the
10.0 closest with respect to the distance measure are merged
until a single cluster is left.
9.5

9.0
Agglomerative clustering algorithm Agglomerative
8.5 clustering algorithms can thus be summarized as follows:
8.0
C
1. Initialize each point to its own cluster.
0 10 20
t 2. Given a set of K clusters X1 , X2 , · · · , XK , merge
clusters until one cluster is left (K = 1):
FIG. 55 K-means with K = 3 applied to an artificial two-
dimensional dataset. The cluster means at each iteration are (a) Find the closest pair of clusters (Xi , Xj ):
indicated by cyan star markers. t indicates the iteration num- (i, j) = arg min(i0 ,j 0 ) d(Xi0 , Xj 0 )
ber and C the value of the objective function. (a) The algo-
(b) Merge the pair. Update: K ← K − 1
rithm is initialized by randomly partitioning the space into 3
sectors to generate an initial assignment. (b)-(c) For well sep- Here we list a few of the most popular distances used
arated clusters, the algorithm converges rapidly to the true in agglomerative methods, often called linkage methods
clusters. (d) The objective function as a function of the it-
eration. C converges after t = 18 iterations for this choice of
in the clustering literature.
random seed (for center initialization). 1. Single-linkage: the distance between clusters i and
j is defined as the minimum distance between two
A nice property of the K-means algorithm is that it elements of the different clusters
is guaranteed to converge. To see this, one can verify
d(Xi , Xj ) = min ||xi − xj ||2 . (140)
explicitly (by taking second-order derivatives) that the xi ∈Xi ,xj ∈Xj
expectation step always decreases C. This is also true for
the assignment step. Thus, since C is bounded from be- 2. Complete linkage: the distance between clusters i
low, the two-step iteration of K-means always converges and j is defined as the maximum distance between
to a local minimum of C. Since C is generally a non- two elements of the different clusters.
convex function, in practice one usually needs to run the d(Xi , Xj ) = max ||xi − xj ||2 (141)
algorithm with different initial random cluster center ini- xi ∈Xi ,xj ∈Xj

tializations and post-select the best local minimum. A


simple implementation of K-means has an average com-
17
putational complexity which scales linearly in the size of Note that this measure need not be a metric.
71

3. Average linkage: average distance between points 0.9


a)
of different clusters 1
1 X 0.8 0
d(Xi , Xj ) = ||xi − xj ||2 (142)
|Xi | · |Xj | 2
xi ∈Xi ,xj ∈Xj
0.7
4. Ward’s linkage: This distance measure is analogous 3
to the K-means method as it seeks to minimize the 0.6
total inertia. The distance measure is the “error
squared” before and after merging which simplifies 0.5
to:
5
0.4 4
|Xi ||Xj |
d(Xi , Xj ) = (µi − µj )2 , (143)
|Xi ∪ Xj |
0.4 0.6 0.8
where µj is the center of cluster j. 0.30 b)
A common drawback of hierarchical methods is that
they do not scale well: at every step, a distance ma- 0.25
trix between all clusters must be updated/computed.
Efficient implementations achieve a typical computa- 0.20

d(X, Y )
tional complexity of O(N 2 ) (Müllner, 2011), making the
method suitable for small to medium-size datasets. A 0.15
simple but major speed-up for the method is to initial-
0.10
ize the clusters with K-means using a large K (but still
a small fraction of N ) and then proceed with hierarchi-
0.05
cal clustering. This has the advantage of preserving the
large-scale structure of the hierarchy while making use of
0.00
the linear scaling of K-means. In this way, hierarchical 0 1 4 5 2 3
clustering may be applied to very large datasets. Leaf label
FIG. 56 Hierarchical clustering example with single linkage.
(a) The data points are successively grouped as denoted by the
3. Density-based (DB) clustering colored dotted lines. (b) Dendrogram representation of the
hierarchical decomposition. Each node of the tree represents
Density clustering makes the intuitive assumption that a cluster. One has to specify a scale cut-off for the distance
clusters are defined by regions of space with higher den- measure d(X, Y ) (corresponding to a horizontal cut in the
sity of data points. Data points that constitute noise or dendrogram) in order to obtain a set of clusters.
that are outliers are expected to form regions of low den-
sity. Density clustering has the advantage of being able to
DBSCAN algorithm. Here we describe the most
consider clusters of multiple shapes and sizes while identi-
prominent DB clustering algorithm: DBSCAN, or
fying outliers. The method is also suitable for large-scale
density-based spatial clustering of applications with noise
applications.
(Ester et al., 1996). Consider once again a set of N data
The core assumption of DB clustering is that a rel- N
ative local density estimation of the data is possible. points X ≡ {xn }n=1 .
In other words, it is possible to order points according We start by defining the ε-neighborhood of point xn
to their densities. Density estimates are usually accu- as follows:
rate for low-dimensional data but become unreliable for Nε (xn ) = {x ∈ X|d(x, xn ) < ε} . (144)
high-dimensional data due to large sampling noise. Here,
for brevity, we confine our discussion to one of the most Nε (xn ) are the data points that are at a distance smaller
widely used density clustering algorithms, DBSCAN. We than ε from xn . As before, we consider d(·, ·) to be the
have also had great success with another recently in- Euclidean metric (which yields spherical neighborhoods,
troduced variant of DB clustering (Rodriguez and Laio, see Figure 57) but other metrics may be better suited
2014) that is similar in spirit which the reader is urged depending on the specific data. Nε (xn ) can be seen as a
to consult. One of the authors (A. D.) has also created crude estimate of local density. xn is considered to be a
a Python package, https://pypi.org/project/fdc/, core-point if at least minPts are in its ε-neighborhood.
which makes use of accurate density estimates via ker- minPts is a free parameter of the algorithm that sets
nel methods combined with agglomerative clustering to the scale of the size of the smallest cluster one should
produce fast and accurate density clustering (see also expect. Finally, a point xi is said to be density-reachable
GitHub repository). if it is in the ε-neighborhood of a core-point. From these
72

definitions, the algorithm can be simply formulated (see a)


also Figure 57):
→ Until all points in X have been visited; do
− Pick a point xi that has not been visited
− Mark xi as a visited point
− If xi is a core point; then "
· Find the set C of all points that are density
reachable from xi .
· C now forms a cluster. Mark all points
within that cluster as being visited.
→ Return the cluster assignments C1 , · · · , Ck , with k
the number of clusters. Points that have not been
assigned to a cluster are considered noise or out- minPts=4
liers.
Note that DBSCAN does not require the user to specify b) High
the number of clusters but only ε and minPts. While, it
is common to heuristically fix these parameters, methods
such as cross-validation can be used for their determi-
nation. Finally, we note that DBSCAN is very efficient

Relative density
since efficient implementations have a computational cost
of O(N log N ).

B. Clustering and Latent Variables via the Gaussian Mixture


Models

In the previous section, we introduced several practical


methods for clustering. In this section, we will approach
clustering from a more abstract vantage point, and in
the process, introduce many of the core ideas underlying Low
unsupervised learning. A central concept in many un-
supervised learning techniques is the idea of a latent or FIG. 57 (a) Illustration of DBSCAN algorithm with
hidden variable. Even though latent variables are not di- minPts= 4. Two ε-neighborhood are represented as dashed
rectly observable, they still influence the visible structure circles of radius ε. Red points are the core points and
of the data. For example, in the context of clustering we blue points are density-reachable point that are not core
can think of the cluster identity of each datapoint (i.e. points. Outliers are gray colored. (b) Application of DB-
which cluster does a datapoint belong to) as a latent vari- SCAN (minPts=40) to a noisy dataset with two non-convex
clusters. Density profile is shown for clarity. Outliers are
able. And even though we cannot see the cluster label
indicated by black crosses.
explicitly, we know that points in the same cluster tend
to be closer together. The latent variables in our data
(cluster identity) are a way of representing and abstract-
ing the correlations between datapoints. cluster-specific probability distribution (e.g. a Gaussian
In this language, we can think of clustering as an algo- with some mean and variance that characterizes the clus-
rithm to learn the most probable value of a latent variable ter). We then specify a procedure for finding the value
(cluster identity) associated with each datapoint. Calcu- of the latent variable. This is often done by choosing
lating this latent variable requires additional assumptions the values of the latent variable that minimize some cost
about the structure of our dataset. Like all unsuper- function.
vised learning algorithms, in clustering we must make One common choice for a class of cost functions for
an assumption about the underlying probability distri- many unsupervised learning problems is Maximum Like-
bution from which the data was generated. Our model lihood Estimation (MLE), see Secs. V and VI. In MLE,
for how the data is generated is called the generative we choose the values of the latent variables that maximize
model. In clustering, we assume that data points are as- the likelihood of the observed data under our generative
signed a cluster, with each cluster characterized by some model (i.e. maximize the probability of getting the ob-
73

served dataset under our generative model). Such MLE GMM parameters as
equations often give rise to the kind of Expectation Maxi-
mization (EM) equations that we first encountered in the p(x, z; θ) = p(x|z; {µk , Σk })p(z|{πk }). (150)
last section in the context of K-means clustering. We can also use Bayes rule to rearrange this expression
Gaussian Mixtures models (GMM) are a generative to give the conditional probability of the data point x
model often used in the context of clustering. In GMM, being in the k-th cluster, γ(zk ), given model parameters
points are drawn from one of K Gaussians, each with its θ as
own mean µk and covariance matrix Σk ,
πk N (x|µk , Σk )
(151)
 
1 γ(zk ) ≡ p(zk = 1|x; θ) = PK .
N (x|µ, Σ) ∼ exp − (x − µ)Σ (x − µ) . (145)
−1 T
2 j=1 πj N (x|µj , Σj )

Let us denote the probability that a point is drawn from The γ(zk ) are often referred to as the “responsibility”
mixture k by πk . Then, the probability of generating a that mixture k takes for explaining x. Just like in our
point x in a GMM is given by discussion of soft-max classifiers, this can be made into
K
a “hard-assignment” by assigning each point to the clus-
ter with the largest probability: arg maxk γ(zk ) over the
X
p(x|{µk , Σk , πk }) = N (x|µk , Σk )πk . (146)
k=1
responsibilities.
The complication is of course that we do not know
Given a dataset X = {x1 , · · · , xN }, we can write the the parameters θ of the underlying GMM but instead
likelihood of the dataset as must also learn them from the dataset X. As discussed
N above, ideally we could do this by choosing the param-
eters that maximize the likelihood (or equivalently the
Y
p(X|{µk , Σk , πk }) = p(xi |{µk , Σk , πk }) (147)
i=1 log-likelihood) of the data

For future reference, let us denote the set of parameters


(of K Gaussians in the model) {µk , Σk , πk } by θ. θ̂ = arg max log p(X|θ) (152)
θ
To see how we can use GMM and MLE to perform
clustering, we introduce discrete binary K-dimensional
where θ = {µk , Σk , πk }. Once we know the MLEs θ̂, we
latent variables z for each data point x whose k-th com-
could use Eq. (151) to calculate the optimal hard cluster
ponent is 1 if point x was generated from the k-th Gaus-
sian and zero otherwise (these are often called “one-hot assignment arg maxk γ̂(zk ) where γ̂(zk ) = p(zk = 1|x; θ̂).
variables”). For instance if we were considering a Gaus- In practice, due to the complexity of Eq. (147), it is
sian mixture with K = 3, we would have three possible almost impossible to find the global maximum of the like-
values for z ≡ (z1 , z2 , z3 ) : (1, 0, 0), (0, 1, 0) and (0, 0, 1). lihood function. Instead, we must settle for a local max-
We cannot directly observe the variable z. It is a latent imum. One approach to finding a local maximum of the
variable that encodes the cluster identity of point x. Let likelihood is to use a method like stochastic gradient de-
us also denote all the N latent variables corresponding scent on the negative log-likelihood, cf. Sec IV. Here, we
to a dataset X by Z. introduce an alternative, powerful approach for finding
Viewing the GMM as a generative model, we can write local minima in latent variable models using an iterative
the probability p(x|z) of observing a data point x given procedure called Expectation Maximization (EM). Given
z as an initial guess for the parameters θ(0) , the EM algorithm
iteratively generates new estimates for the parameters
K
Y θ(1) , θ(2) , . . .. Importantly, the likelihood is guaranteed to
p(x|z; {µk , Σk }) = N (x|µk , Σk )zk (148) be non-decreasing under these iterations and hence EM
k=1
converges to a local maximum of the likelihood (Neal and
as well as the probability of observing a given value of Hinton, 1998).
latent variable The central observation underlying EM is that it is
K
often much easier to calculate the conditional likelihoods
Y of the latent variables p̃(t) (Z) = p(Z|X; θ(t) ) given some
p(z|{πk }) = πkzk . (149)
choice of parameters, and the maximum of the expected
k=1
log likelihood given an assignment of the latent variables:
Using Bayes’ rule, we can write the joint probability of θ(t+1) = arg maxθ Ep(Z|X;θ(t) ) [log p(X, Z; θ)]. To get an
a clustering assignment z and a data point x given the intuition for this later quantity notice that we can write
74

N X
K
(t)
X
Ep̃(t) [log p(X, Z; θ)] = γik [log N (xi |µk , Σk ) + log πk ] , (153)
i=1 k=1

(t)
where we have used the shorthand γik = p(zik |X; θ(t) )
with zik the k-th component of zi . Taking the derivative
of this equation with
P respect to µk , Σk , and πk (subject
to the constraint k πk = 1) and setting this to zero
yields the intuitive equations
PN (t)
(t+1) i γik xi
µk = P (t)
i γik
PN (t)
(t+1) γik (xi − µk )(xi − µk )T
i
Σk = P (t)
i γik
(t+1) 1 X (t)
πk = γik (154)
N
k

These are just the usual estimates for the mean and vari-
ance, with each data point weighed according to our cur-
rent best guess for the probability that it belongs to clus-
ter k. We can then use our new estimate θ(t+1) to calcu-
(t+1)
late responsibility γik and repeat the process. This is
essentially the K-Means algorithm discussed in the first
section.
This discussion of the Gaussian mixture model intro-
duces several concepts that we will return to repeatedly
in the context of unsupervised learning. First, it is often
useful to think of the visible correlations between features
in the data as resulting from hidden or latent variables.
Second, we will often posit a generative model that en-
codes the structure we think exists in the data and then
find parameters that maximize the likelihood of the ob-
served data. Third, often we will not be able to directly FIG. 58 (a) Application of gaussian mixture modelling to
estimate the MLE, and will have to instead look for a the Ising dataset. The normalized histogram corresponds to
computationally efficient way to find a local minimum of the first principal component distribution of the dataset (or
the likelihood. equivalently the magnetization in this case). The 1D data
is fitted with a K = 3-component gaussian mixture. The
likehood of the fitted gaussian mixture is represented in red
C. Clustering in high dimensions and is obtained via the expectation-maximization algorithm
(b) The gaussian mixture model can be used to compute
Clustering data in high-dimension can be very chal- posterior probability (responsibilities), i.e. the probability
of being in one of the phases. Note that the point where
lenging. One major problem that is aggravated in high- γ(1) = γ(2) = γ(3) can be interpreted as the critical point.
dimensions is the generic accumulation of noise due to Indeed the crossing occurs at T ≈ 2.26.
random measurement error for each feature. This in turn
leads to increased errors for pairwise similarity and dis-
tance measures and thus tends to “blur” distances be-
tween data points (Domingos, 2012; Kriegel et al., 2009; ceeding with using a standard clustering method such as
Zimek et al., 2012). Many clustering algorithms rely on K-means (Kriegel et al., 2009). Figure 54 illustrates an
the explicit use of a similarity measure or distance met- application of denoising to high-dimensional data. PCA
rics that weigh all features equally. For this reason, one (section XII.B) was used to denoise the MNIST dataset
must be careful when using an off-the-shelf method in by projecting the 784 original dimensions onto the 40 di-
high dimensions. mensions with the largest principal components. The re-
In order to perform clustering on high-dimensional sulting features were then used to construct a Euclidean
data, it is often useful to denoise the data before pro- distance matrix which was used by t-SNE to compute
75

the two-dimensional embedding that is presented. Using plicated probability distributions, it is often much easier
t-SNE directly on original data leads to a “blurring” of to learn the relative weights of different states or data
the clusters (the reader is encouraged to test this them- points (ratio of probabilities), than absolute probabili-
selves). ties. In physics, this is the familiar statement that the
However, simple feature selection or feature denoising weights of a Boltzmann distribution are much easier to
(using PCA for instance) can sometimes be insufficient calculate than the partition function. The relative prob-
for learning clusters due to the presence of large vari- ability of two configurations, x1 and x2 , are proportional
ations in the signal and noise of the features that are to the difference between their Boltzmann weights
relevant for identifying the underlying clusters (Kriegel p(x1 )
et al., 2009). Recent promising work suggests that one = e−β(E(x1 )−E(x2 )) , (155)
p(x2 )
way to overcome these limitations is to learn the latent
space and the cluster labels at the same time (Xie et al., where as is usual in statistical mechanics β is the inverse
2016). temperature and E(x; θ) is the energy of state x given
Finally we end the clustering section with a short dis- some parameters (couplings) θ . However, calculating the
cussion on clustering validation, which can be particu- absolute weight of a configuration requires knowledge of
larly difficult for high-dimensional data. Often clustering the partition function
validation, i.e. verifying whether the obtained labels are Zp = Trx e−βE(x) , (156)
“valid” is done by direct visual inspection. That is, the
data is represented in a low-dimensional space and the (where the trace is taken over all possible configurations
cluster labels obtained are visually inspected to make x) since
sure that different labels organize into distinct “blobs”.
e−βE(x)
For high-dimensional data, this is done by performing p(x) = . (157)
dimensional reduction (section XII). However, this can Zp
lead to the appearance of spurious clusters since dimen- In general, calculating the partition function Zp is ana-
sional reduction inevitably loses information about the lytically and computationally intractable.
original data. Thus, these methods should be used with For example, for the Ising model with N binary spins,
care when trying to validate clusters [see (Wattenberg the trace involves calculating a sum over 2N terms, which
et al., 2016) for an interactive discussion on how t-SNE is a difficult task for most energy functions. For this rea-
can sometime be misleading and how to effectively use son, physicists (and machine learning scientists) have de-
it]. veloped various numerical and computational methods
A lot of work has been done to devise ways of validating for evaluating such partition functions. One approach
clusters based on various metrics and measures (Kriegel is to use Monte-Carlo based methods to draw samples
et al., 2009). Perhaps one of the most intuitive way of from the underlying distribution (this can be done know-
defining a good clustering is by measuring how well clus- ing only the relative probabilities) and then use these
ters generalize. Clustering methods based on leveraging samples to numerically estimate the partition function.
powerful classifiers to measure the generalization errors This is the philosophy behind powerful methods such as
of the clusters have been developed by some of the au- Markov Chain Monte Carlo (MCMC) (Andrieu et al.,
thors (Day and Mehta, 2018), see https://pypi.org/ 2003) and annealed importance sampling (Neal and Hin-
project/hal-x/. We believe this represents an espe- ton, 1998) which are widely used in both the statistical
cially promising research direction in high-dimensional physics and machine learning communities. An alterna-
clustering. Finally, we emphasize that this discussion is tive approach – which we focus on here – is to approxi-
far from exhaustive and we refer the reader to (Rokach mate the the probability distribution p(x) and partition
and Maimon, 2005), Chapter 15, for an in-depth survey function using a “variational distribution” q(x; θq ) whose
of the various validation techniques. partition function we can calculate exactly. The varia-
tional parameters θq are chosen to make the variational
distribution as close to the true distribution as possible
XIV. VARIATIONAL METHODS AND MEAN-FIELD (how this is done is the focus of much of this section).
THEORY (MFT) One of the most-widely applied examples of a varia-
tional method in statistical physics is Mean-Field Theory
A common thread in many unsupervised learning tasks (MFT). MFT can be naturally understood as a procedure
is accurately representing the underlying probability dis- for approximating the true distribution of the system by
tribution from which a dataset is drawn. Unsuper- a factorized distribution. The deep connection between
vised learning of high-dimensional, complex distributions MFT and variational methods is discussed below. These
presents a new set of technical and computational chal- variational MFT methods have been extended to under-
lenges that are different from those we encountered in stand more complicated spin models (also called graph-
a supervised learning setting. When dealing with com- ical models in the ML literature) and form the basis of
76

powerful set of techniques that go under the name of Be- with {si =±1} denoting the sum over all possible con-
P
lief Propagation and Survey Propagation (MacKay, 2003; figurations of the spin variables. We write Zp to em-
Wainwright et al., 2008; Yedidia et al., 2003). phasize that this is the partition function corresponding
Variational methods are also widely used in ML to ap- to the probability distribution p(s|β, J ), which will be-
proximate complex probabilistic models. For example, come important later. For a fixed number of lattice sites
below we show how the Expectation Maximization (EM) N , there are 2N possible configurations, a number that
procedure, which we discussed in the context of Gaus- grows exponentially with the system size. Therefore, it
sian Mixture Models for clustering, is actually a general is not in general feasible to evaluate the partition func-
method that can be derived for any latent (hidden) vari- tion Zp (β, J ) in closed form. This represents a major
able model using a variational procedure (Neal and Hin- practical obstacle for extracting predictions from physi-
ton, 1998). This section serves as an introduction to this cal theories since the partition function is directly related
powerful class of variational techniques. For readers in- to the free-energy through the expression
terested in an in-depth discussion on variational infer-
ence for probabilistic graphical models, we recommend βFp (J ) = − log Zp (β, J ) = βhE(s, J )ip − Hp ,(160)
the great treatise written by Michael I. Jordan and oth- with
ers(Jordan et al., 1999), the more physics oriented dis-
cussion in (Yedidia, 2001; Yedidia et al., 2003), as well as
X
Hp = − p(s|β, J ) log p(s|β, J ) (161)
David MacKay’s outstanding book (MacKay, 2003). {si =±1}

the entropy of the probability distribution p(s|β, J ).


A. Variational mean-field theory for the Ising model Even though the true probability distribution p(s|β, J )
may be a very complicated object, we can still make
Ising models are a major paradigm in statistical progress by approximating p(s|β, J ) by a variational dis-
physics. Historically introduced to study magnetism, it tribution q(s, θ) which captures the essential features of
was quickly realized that their predictive power applies interest, with θ some parameters that define our varia-
to a variety of interacting many-particle systems. Ising tional ansatz. The name variational distribution comes
models are now understood to serve as minimal models from the fact that we are going to vary the parame-
for complex phenomena such as certain classes of phase ters θ to make q(s, θ) as close to p(s|β, J ) as possible.
transitions. In the Ising model, degrees of freedom called The functional form of q(s, θ) is based on an “educated
spins assume discrete, binary values, e.g. si = ±1. Each guess”, which oftentimes comes from our intuition about
spin variable si lives on a lattice (or, in general, a graph), the problem. We can also define a variational free-energy
the sites of which are labeled by i = 1, 2 . . . , N . De-
spite the extreme simplicity relative to real-world sys- βFq (θ, J ) = βhE(s, J )iq − Hq , (162)
tems, Ising models exhibit a high level of intrinsic com-
plexity, and the degrees of freedom can become correlated where hE(s, J )iq is the expectation value of the energy
in sophisticated ways. Often, spins interact spatially lo- E(s, J ) with respect to the distribution q(s, θ), and Hq
cally, and respond to externally applied magnetic fields. is the entropy of q(s, θ).
A spin configuration s specifies the values si of the Before proceeding further, it is helpful to introduce
spins at every lattice site. We can assign an “energy” to a new quantity: the Kullback-Leibler divergence (KL-
every such configuration divergence or relative entropy) between two distributions
p(x) and q(x). The KL-divergence measures the dissim-
1X
ilarity between the two distributions and is given by
X
E(s, J ) = − Jij si sj − hi si , (158)
2 i,j i
q(x)
where hi is a local magnetic field applied to the spin si , DKL (qkp) = Trx q(x) log , (163)
p(x)
and Jij is the interaction strength between the spins si
and sj . In textbook examples, the coupling parameters which is the expectation w.r.t. q of the logarithmic dif-
J = (J, h) are typically uniform or, in studies of disor- ference between the two distributions p and q. The trace
dered systems, (Ji , hi ) are drawn from some probability Trx denotes a sum over all possible configurations x.
distribution (i.e. quenched disorder). Two important properties of the KL-divergence are (i)
The probability of finding the system in a given spin positivity: DKL (pkq) ≥ 0 with equality if and only if
configuration at temperature β −1 is given by p = q (in the sense of probability distributions), and (ii)
DKL (pkq) 6= DKL (qkp), that is the KL-divergence is not
1
p(s|β, J ) = e−βE(s,J) , symmetric in its arguments.
Zp (J ) Variational mean-field theory is a systematic way for
constructing such an approximate distribution q(s, θ).
X
Zp (β, J ) = e−βE(s,J) , (159)
{si =±1} The main idea is to choose parameters that minimize the
77

difference between the variational free-energy Fq (J , θ) The total variational free-energy is


and the true free-energy Fp (J |β). We will show in Sec-
tion XIV.B below that the difference between these two βFq (J , θ) = βhE(s, J )iq − Hq ,
free-energies is actually the KL-divergence: and minimizing with respect to the variational parame-
Fq (J , θ) = Fp (J , β) + DKL (qkp). (164) ters θ, we obtain
   
This equality, when combined with the non-negativity of ∂ dqi  X
the KL-divergence has important consequences. First, βFq (J , θ) = 2 −β  Jij mj + hi  + θi  .
∂θi dθi
it shows that the variational free-energy is always larger j

than the true free-energy, Fq (J , θ) ≥ Fp (J ), with equal- (169)


ity if and only if q = p (the latter inequality is found Setting this equation to zero, we arrive at
in many physics textbooks and is known as the Gibbs X
θi = β Jij mj (θj ) + hi . (170)
inequality). Second, finding the best variational free-
j
energy is equivalent to minimizing the KL divergence
DKL (qkp). For the special case of a uniform field hi = h and uni-
Armed with these observations, let us now derive a form nearest neighbor couplings Jij = J, by symmetry
MFT of the Ising model using variational methods. In the variational parameters for all the spins are identical,
the simplest MFT of the Ising model, the variational dis- with θi = θ for all i. Then, the mean-field equations
tribution is chosen so that all spins are independent: reduce to their familiar textbook form (Sethna, 2006),
! m = tanh(θ) and θ = β(zJm(θ) + h), where z is the
1 Y eθi si
coordination number of the lattice (i.e. the number of
X
q(s, θ) = exp θi si = . (165)
Zq i i
2 cosh θi nearest neighbors).
Equations (167) and (170) form a closed system, known
In other words, we have chosen a distribution q which as the mean-field equations for the Ising model. To find
factorizes on every lattice site. An important property a solution to these equations, one method is to iterate
of this functional form is that we can analytically find a through and update each θi , once at a time, in an asyn-
closed-form expression for the variational partition func- chronous fashion. Once can see the emerging relationship
tion Zq . This simplicity also comes at a cost: ignor- of this approach to solving the MFT equations to Expec-
ing correlations between spins. These correlations be- tation Maximization (EM) procedure first introduced in
come less and less important in higher dimensions and the context of the K-means algorithm in Sec. XIII.A. To
the MFT ansatz becomes more accurate. make this explicit, let us spell out the iterative procedure
To evaluate the variational free-energy, we make use to find the solutions to Eq. (170). We start by initializing
of Eq. (162). First, we need the entropy Hq of the dis- our variational parameters to some θ (0) and repeat the
tribution q. Since q factorizes over the lattice sites, the following two steps until convergence:
entropy separates into a sum of one-body terms
X 1. Expectation: Given a set of assignments at iteration
Hq (θ) = − q(s, θ) log q(s, θ) t, θ (t) , calculate the corresponding magnetizations
{si =±1} m(t) using Eq. (167)
X
=− qi log qi + (1 − qi ) log(1 − qi ), (166) 2. Maximization: Given a set of magnetizations mt ,
i
find new assignments θ(t+1) which minimize the
θi
where qi = 2 cosh variational free energy Fq . From, Eq. (170) this
θi is the probability that spin si is in the
e

+1 state. Next, we need to evaluate the average of the is just


Ising energy E(s, J ) with respect to the variational dis- (t+1)
X (t)
tribution q. Although the energy contains bilinear terms, θi =β Jij mj + hi . (171)
j
we can still evaluate this average easily, because the spins
are independent (uncorrelated) in the q distribution. The
From these equations, it is clear that we can think of the
mean value of spin si in the q distribution, also known
MFT of the Ising model as an EM-like procedure similar
as the on-site magnetization, is given by
to the one we used for K-means clustering and Gaussian
X eθi si Mixture Models in Sec. XIII.
mi = hsi iq = si = tanh(θi ). (167) As is well known in statistical physics, even though
2 cosh θi
si =±1
MFT is not exact, it can often yield qualitatively and
Since the spins are independent, we have even quantitatively precise predictions (especially in high
dimensions). The discrepancy between the true physics
1X X
and MFT predictions stems from the fact that the varia-
hE(s, J )iq = − Jij mi mj − hi mi . (168)
2 i,j i tional distribution q we chose cannot capture correlations
78

between the spins. For instance, it predicts the wrong parameter θ (t) to be those with maximum likeli-
value for the critical temperature for the two-dimensional hood, assuming qt−1 (z) found in the previous step
Ising model. It even erroneously predicts the existence of is the true distribution of hidden variable z:
a phase transition in one dimension at a non-zero tem-
θt = arg maxhlog p(z, x|θ)iqt−1 (173)
perature. We refer the interested reader to standard θ
textbooks on statistical physics for a detailed analysis
of applicability of MFT to the Ising model. However, It was shown (Dempster et al., 1977) that each EM iter-
we emphasize that the failure of any particular varia- ation increases the true log-likelihood L(θ), or at worst
tional ansatz does not compromise the usefulness of the leaves it unchanged. In most models, this iteration pro-
approach. In some cases, one can consider changing the cedure converges to a local maximum of L(θ).
variational ansatz to improve the predictive properties
of the corresponding variational MFT (Yedidia, 2001;
Yedidia et al., 2003). The take-home message is that
variational MFT is a powerful tool but one that must be θ ( t +2)
applied and interpreted with care.
M-step

B. Expectation Maximization (EM)


− Fp
θ ( t +1)
Ideas along the lines of variational MFT have been
independently developed in statistics and imported into θ( t )
machine learning to perform maximum likelihood (ML) E-step
estimates. In this section, we explicitly derive the Expec-
tation Maximization (EM) algorithm and demonstrate
further its close relation to variational MFT (Neal and − F q ( θ ( t +1) )
Hinton, 1998). We will focus on latent variable mod-
els where some of the variables are hidden and cannot
be directly observed. This often makes maximum likeli- − F q( θ( t ) )
hood estimation difficult to implement. EM gets around
this difficulty by using an iterative two-step procedure, FIG. 59 Convergence of EM algorithm. Starting from θ (t) ,
closely related to variational free-energy based approxi- E-step (blue) establishes −Fq (θ (t) ) which is always a lower
mation schemes in statistical physics. bound of −Fp := hlog p(x|θ)iPx (green). M-step (red) is then
To set the stage for the following discussion, let x be applied to update the parameter, yielding θ (t+1) . The up-
the set of visible variables we can directly observe and z dated parameter θ (t+1) is then used to construct −Fq (θ (t+1) )
in the subsequent E-step. M-step is performed again to up-
be the set of latent or hidden variables that we cannot di- date the parameter, etc.
rectly observe. Denote the underlying probability distri-
bution from which x and z are drawn by p(z, x|θ), with To see how EM is actually performed and related to
θ representing all relevant parameters. Given a dataset variational MFT, we make use of KL-divergence between
x, we wish to find the maximum likelihood estimate of two distributions introduced in the last section. Recall
the parameters θ that maximizes the probability of the that our goal is to maximize the log-likelihood L(θ).
observed data. With data z missing, we surely cannot just maximize
As in variational MFT, we view θ as variational pa- L(θ) directly since parameter θ might couple both z and
rameters chosen to maximize the log-likelihood L(θ) = x. EM circumvents this by optimizing another objective
hlog p(x|θ)iPx , where the expectation is taken with re- function, Fq (θ), constructed based on estimates of the
spect to the marginal distributions of x. Algorithmically, hidden variable distribution q(z|x). Indeed, the function
this can be done by iterating the variational parameters optimized is none other than the variational free energy
θ (t) in a series of steps (t = 1, 2, . . . ) starting from some we encountered in the previous section:
arbitrary initial value θ (0) :
Fq (θ) := −hlog p(z, x|θ)iq,Px − hHq iPx , (174)
1. Expectation step (E step): Given the known
values of observed variable x and the current esti- where Hq is the Shannon entropy (defined in Eq. (161))
mate of parameter θt−1 , find the probability distri- of q(z|x). One can define the true free-energy Fp (θ) as
bution of the latent variable z: the negative log-likelihood of the observed data:
− Fp (θ) = L(θ) = hlog p(x|θ)iPx . (175)
qt−1 (z) = p(z|θ (t−1) , x) (172)
In the language of statistical physics, Fp (θ) is the true
2. Maximization step (M step): Re-estimate the free-energy while Fq (θ) is the variational free-energy we
79

would like to minimize (see Table I). Note that we have 2. Maximization step: Fix q, update the variational
chosen to employ a physics sign convention here of defin- parameters:
ing the free-energy as minus log of the partition function.
In the ML literature, this minus sign is often omitted θ (t) = arg max −Fqt−1 (θ). (178)
θ
(Neal and Hinton, 1998) and this can lead to some con-
fusion. Our goal is to choose θ so that our variational To recapitulate, EM implements ML estimation even
free-energy Fq (θ) is as close to the true free-energy Fp (θ) with missing or hidden variables through optimizing a
as possible. The difference between these free-energies lower bound of the true log-likelihood. In statistical
can be written as physics, this is reminiscent of optimizing a variational
free-energy which is a lower bound of true free-energy
Fq (θ) − Fp (θ) = hfq (x, θ) − fp (x, θ)iPx , (176)
due to Gibbs inequality. In Fig. 59, we show pictorially
where how EM works. The E-step can be seen as representing
the unobserved variable z by a probability distribution
fq (x, θ) − fp (x, θ)
X q(z). This probability is used to construct an alterna-
= log p(x|θ) − q(z|x) log p(z, x|θ) tive objective function −Fq (θ), which is then maximized
z with respect to θ in the M-step. By construction, maxi-
mizing the negative variational free-energy is equivalent
X
+ q(z|x) log q(z|x)
z to doing ML estimation on the joint data (i.e. both ob-
X X served and unobserved). The name “M-step” is intuitive
= q(z|x) log p(x|θ) − q(z|x) log p(z, x|θ)
since the parameters θ are found by maximizing −Fq (θ).
z z
X The name “E-step” comes from the fact that one usually
+ q(z|x) log q(z|x) doesn’t need to construct the probability of missing datas
z
explicitly, but rather need only compute the “expected"
X p(z, x|θ) X sufficient statistics over these data, cf. Fig. 59.
=− q(z|x) log + q(z|x) log p̃(z)
z
p(x|θ) z On the practical side, EM has been demonstrated to be
X q(z|x) extremely useful in parameter estimation, particularly in
= q(z|x) log hidden Markov models and Bayesian networks (see, for
p(z|x, θ)
z example, (Barber, 2012; Wainwright et al., 2008)). Some
= DKL (q(z|x)kp(z|x, θ)) ≥ 0 of the authors have used EM in biophysics, to design al-
where we have used Bayes’ theorem p(z|x, θ) = gorithms which establish the equivalence of niche theory
p(z, x|θ)/p(x|θ). Since the KL-divergence is always pos- and the Minimum Environmental Perturbation Princi-
itive, this shows that the variational free-energy Fq is ple (Marsland III et al., 2019). One of the striking ad-
always an upper bound of the true free-energy Fp . In vantages of EM is that it is conceptually simple and easy
physics, this result is known as Gibbs’ inequality. to implement (see Notebook 16). In many cases, imple-
From Eq. (174) and the fact that the the entropy term mentation of EM is guaranteed to increase the likelihood
in Eq. (174) does not depend on θ, we can immediately monotonically, which could be a perk during debugging.
see that the maximization step (M-step) in Eq. (173) For readers interested in an overview on applications of
is equivalent to minimizing the variational free-energy EM, we recommend (Do and Batzoglou, 2008).
Fq (θ). Surprisingly, the expectation step (E-step) can Finally for advanced readers familiar with the physics
also viewed as the optimization of this variational free- of disordered systems, we note that it is possible to
energy. Concretely, one can show that the distribution construct a one-to-one dictionary between EM for la-
of hidden variables z given the observed variable x and tent variable models and the MFT of spin systems with
the current estimate of parameter θ, Eq. (172), is the quenched disorder. In a disordered spin systems, the
unique probability q(z) that minimizes Fq (θ) (now seen Ising couplings J are commonly taken to be quenched
as a functional of q). This can be proved by taking the random variables drawn from some underlying probabil-
functional derivative P of Eq. (174), plus a Lagrange mul- ity distribution. In the EM procedure, the quenched dis-
tiplier that encodes z q(z) = 1, with respect to q(z). order is provided by the observed data points x which
Summing things up, we can re-write EM in the following are drawn from some underlying probability distribution
form (Neal and Hinton, 1998): that characterizes the data. The spins s are like the hid-
den or latent variables z. Similar analogues can be found
1. Expectation step: Construct the approximating for all the variational MFT quantities (see Table I). This
probability distribution of unobserved z given the striking correspondence offers a glimpse into the deep
values of observed variable x and parameter esti- connection between statistical mechanics and unsuper-
mate θ (t−1) : vised latent variable models – a connection that we will
repeatedly exploit to gain more intuition for the energy-
qt−1 (z) = arg min Fq (θ (t−1) ) (177)
q based unsupervised models considered in the next few
80

statistical physics Variational EM section starts with a brief overview of generative mod-
spins/d.o.f.: s hidden/latent variables z els, highlighting the similarities and differences with the
couplings /quenched disorder: data observations: x supervised learning methods encountered in earlier sec-
J tions. Next, we introduce perhaps the simplest kind of
Boltzmann factor e−βE(s,J) Complete probability: generative models – Maximum Entropy (MaxEnt) mod-
p(x, z|θ) els. MaxEnt models have no latent (or hidden) vari-
partition function: Z(J ) marginal likelihood p(x|θ) ables, making them ideal for introducing the key concepts
energy: βE(s, J ) negative log-complete data and tools that underlie energy-based generative models.
likelihood: − log p(x, z|θ, m) We then present an extended discussion of how to train
free energy: βFp (J |β) negative log-marginal likeli- energy-based models. Much of this discussion will also
hood: − log p(x|m) be applicable to more complicated energy-based models
variational distribution: q(s) variational distribution: such as Restricted Boltzmann Machines (RBMs) and the
q(z|x) deep models discussed in the next section.
variational free-energy: variational free-energy: Fq (θ)
Fq (J , θ)
A. An overview of energy-based generative models
TABLE I Analogy between quantities in statistical physics
and variational EM. Generative models are a machine learning technique
that allows to learn how to generate new examples sim-
ilar to those found in a training dataset. The core idea
chapters. of most generative models is to learn a parametric model
for the probability distribution from which the data was
drawn. Once we have learned a model, we can gener-
XV. ENERGY BASED MODELS: MAXIMUM ENTROPY ate new examples by sampling from the learned gen-
(MAXENT) PRINCIPLE, GENERATIVE MODELS, AND
BOLTZMANN LEARNING
erative model (see Fig. 60). As in statistical physics,
this sampling is often done using Markov Chain Monte
Most of the models discussed in the previous sections Carlo (MCMC) methods. A review of MCMC methods
(e.g. linear and logistic regression, ensemble models, and is beyond the scope of this discussion: for a concise and
supervised neural networks) are discriminative – they beautiful introduction to MCMC-inspired methods that
are designed to perceive differences between groups or bridges both statistical physics and ML the reader is en-
categories of data. For example, recognizing differences couraged to consult Chapters 29-32 of David MacKay’s
between images of cats and images of dogs allows a dis- book (MacKay, 2003) as well as the review by Michael
criminative model to label an image as “cat” or “dog”. I. Jordan and collaborators (Andrieu et al., 2003).
Discriminative models form the core techniques of most The added complexity of learning models directly
supervised learning methods. However, discriminative from samples introduces many of the same fundamental
methods have several limitations. First, like all super- tensions we encountered when discussing discriminative
vised learning methods, they require labeled data. Sec- models. The ability to generate new examples requires
ond, there are tasks that discriminative approaches sim- models to be able to “generalize” beyond the examples
ply cannot accomplish, such as drawing new examples they have been trained on, that is to generate new sam-
from an unknown probability distribution. A model that ples that are not samples of the training set. The models
can learn to represent and sample from a probability dis- must be expressive enough to capture the complex cor-
tribution is called generative. For example, a genera- relations present in the underlying data distribution, but
tive model for images would learn to draw new examples the amount of data we have is finite which can give rise
of cats and dogs given a dataset of images of cats and to overfitting.
dogs. Similarly, given samples generated from one phase In practice, most generative models that are used in
of an Ising model we may want to generate new sam- machine learning are flexible enough that, with a suffi-
ples from that phase. Such tasks are clearly beyond the cient number of parameters, they can approximate any
scope of discriminative models like the ensemble models probability distribution. For this reason, there are three
and DNNs discussed so far in the review. Instead, we axes on which we can differentiate classes of generative
must turn to a new class of machine learning methods. models:
The goal of this section is to introduce the reader to • The first axis is how easy the model is to train –
energy-based generative models. As we will see, energy- both in terms of computational time and the com-
based models are closely related to the kinds of models plexity of writing code for the algorithm.
commonly encountered in statistical physics. We will
draw upon many techniques that have their origin in • The second axis is how well the model generalizes
statistical mechanics (e.g. Monte-Carlo methods). The from the training set to the test set.
81

• The third axis is which characteristics of the data


distribution the model is capable of and focuses on
capturing.

All generative models must balance these competing re-


quirements and generative models differ in the tradeoffs
they choose. Simpler models capture less structure about
the underlying distributions but are often easier to train.
More complicated models can capture this structure but
may overfit to the training data.
One of the fundamental reasons that energy-based FIG. 60 Examples of handwritten digits (“reconstructions”)
models have been less widely-employed than their dis- generated using various energy-based models using the pow-
criminative counterparts is that the training procedure erful Paysage package for unsupervised learning. Examples
for these models differs significantly from those for su- from top to bottom are: the original MNIST database, an
pervised neural networks models. Though both employ RBM with Gaussian units which is equivalent to a Hopfield
Model, a Restricted Boltzmann Machine (RBM), a RBM with
gradient-descent based procedures for minimizing a cost an L1 penalty for regularization, and a Deep Boltzmann Ma-
function (one common choice for generative models is chine (DBM) with 3 layers. All models have 200 hidden units.
the negative log-likelihood function), energy-based mod- See Sec. XVI and corresponding notebook for details
els do not use backpropagation (see Sec. IX.C) and au-
tomatic differentiation for computing gradients. Rather,
one must turn to ideas inspired by MCMC based meth- B. Maximum entropy models: the simplest energy-based
ods in physics and statistics that sometimes go under generative models
the name “Boltzmann Learning” (discussed below). As a
result, training energy-based models requires additional Maximum Entropy (MaxEnt) models are one of the
tools that are not immediately available in packages such simplest classes of energy-based generative models. Max-
as PyTorch and TensorFlow. Ent models have their origin in a series of beautiful pa-
pers by Jaynes that reformulated statistical mechanics in
The open-source package – Paysage – that is built on information theoretic terms (Jaynes, 1957a,b). Recently,
top of PyTorch bridges this gap by providing the toolset the flood of new, large scale datasets has resulted in a
for training energy-based models (Paysage is maintained resurgence of interest in MaxEnt models in many fields
by Unlearn.AI – a company affiliated with two of the au- including physics (especially biological physics), compu-
thors (CKF and PM)). Paysage makes it easy to quickly tational neuroscience, and ecology (Elith et al., 2011;
code and deploy energy-based models such as Restricted Schneidman et al., 2006; Weigt et al., 2009). MaxEnt
Boltzmann Machines (RBMs) and Stacked RBMs – a models are often presented as the class of generative mod-
“deep” unsupervised model. The package includes un- els that make the least assumptions about the underlying
published training methods that significantly improve data. However, as we have tried to emphasize throughout
the training performance, can be applied with various the review, all ML and statistical models require assump-
datatypes, and can be employed on GPUs. We make tions, and MaxEnt models are no different. Overlooking
use of this package extensively in the next two sections this can sometimes lead to misleading conclusions, and
and the accompanying Python notebooks. For example, it is important to be cognizant of these implicit assump-
Fig. 60 (and the accompanying Notebook 17) show how tions (Aitchison et al., 2016; Schwab et al., 2014).
the Paysage package can be used to quickly code and
train a variety of energy-based models on the MNIST
handwritten digit dataset.
1. MaxEnt models in statistical mechanics
Finally, we note that generative models at their most
basic level are complex parametrizations of the probabil- MaxEnt models were introduced by E. T. Jaynes in a
ity distribution the data is drawn from. For this reason, two-part paper in 1957 entitled “Information theory and
generative models can do much more than just generate statistical mechanics” (Jaynes, 1957a,b). In these incred-
new examples. They can be used to perform a multi- ible papers, Jaynes showed that it was possible to re-
tude of other tasks that require sampling from a complex derive the Boltzmann distribution (and the idea of gen-
probability distribution including “de-noising”, filling in eralized ensembles) entirely from information theoretic
missing data, and even discrimination (Hinton, 2012). arguments. Quoting from the abstract, Jaynes consid-
The versatility of generative models is one of the major ered “statistical mechanics as a form of statistical infer-
appeals of these unsupervised learning methods. ence rather than as a physical theory” (portending the
82

close connection between statistical physics and machine The general form of the maximum entropy distribution
learning). Jaynes showed that the Boltzmann distribu- is then given by
tion could be viewed as resulting from a statistical in-
1 Pi λi fi (x)
ference procedure for learning probability distributions p(x) = e (181)
describing physical systems where one only has partial Z
information about the system (usually the average en- where Z(λi ) = dx e i λi fi (x) is the partition function.
R P

ergy). The maximum entropy distribution is clearly just


The key quantity in MaxEnt models is the informa- thePusual Boltzmann distribution with energy E(x) =
tion theoretic, or Shannon, entropy, a concept introduced − i λi fi (x). The values of the Lagrange multipliers are
by Shannon in his landmark treatise on information the- chosen to match the observed averages for the set of func-
ory (Shannon, 1949). The Shannon entropy quantifies tions {fi (x)} whose average value is being fixed:
the statistical uncertainty one has about the value of a
random variable x drawn from a probability distribution ∂ log Z
Z
hfi imodel = dxp(x)fi (x) = = hfi iobs . (182)
p(x). The Shannon entropy of the distribution is defined ∂λi
as
In other words, the parameters of the distribution can be
Sp = −Trx p(x) log p(x) (179) chosen such that
where the trace is a sum/integral over all possible val-
∂λi log Z = hfi idata . (183)
ues a variable can take. Jaynes showed that the Boltz-
mann distribution follows from the Principle of Maxi- To gain more intuition for the MaxEnt distribution, it
mum Entropy. A physical system should be described is helpful to relate the Lagrange multipliers to the famil-
by the probability distribution with the largest entropy iar thermodynamic quantities we use to describe physical
subject to certain constraints (often provided by measur- systems (Jaynes, 1957a). Our x denotes the microscopic
ing the average value of conserved, extensive quantities state of the system, i.e. the MaxEnt distribution is a
such as the energy, particle number, etc.) The princi- probability distribution over microscopic states. How-
ple uniquely specifies a procedure for parametrizing the ever, in thermodynamics we only have access to average
functional form of the probability distribution. Once we quantities. If we know only the average energy hE(x)iobs ,
have specified and learned this form we can, of course, the MaxEnt procedure tells us to maximize the entropy
generate new examples by sampling this distribution. subject to the average energy constraint. This yields
Let us illustrate how this works in more detail. Sup-
pose that we have chosen a set of functions {fi (x)} whose 1 −βE(x)
p(x) = e , (184)
average value we want to fix to some observed values Z
hfi iobs . The Principle of Maximum Entropy states that
where we have identified the Lagrange multiplier conju-
we should choose the distribution p(x) with the largest
gate to the energy λ1 = −β = 1/kB T with the (negative)
uncertainty (i.e. largest Shannon entropy Sp ), subject to
inverse temperature. Now, suppose we also constrain the
the constraints that the model averages match the ob-
particle number hN (x)iobs . Then, an almost identical
served averages:
calculation yields a MaxEnt distribution of the functional
form
Z
hfi imodel = dxfi (x)p(x) = hfi iobs . (180)
1 −β(E(x)−µN (x))
We can formulate the Principle of Maximum Entropy p(x) = e , (185)
Z
as an optimization problem using the method of Lagrange
multipliers by minimizing: where we have rewritten our Lagrange multipliers in
the familiar thermodynamic notation λ1 = −β and
X  Z 
L[p] = −Sp + λi hfi iobs − dxfi (x)p(x) λ2 = µ/β. Since this is just the Boltzmann distribu-
i tion, we can also relate the partition function in our
 Z  MaxEnt model to the thermodynamic free-energy via
+γ 1− dxp(x) , F = −β −1 log Z. The choice of which quantities to
constrain is equivalent to working in different thermo-
where the first set of constraints enforce the requirement dynamic ensembles.
for the averages and the last constraint enforces the nor-
malization that the trace over the probability distribu-
tion equals one. We can solve for p(x) by taking the 2. From statistical mechanics to machine learning
functional derivative and setting it to zero
δL X The MaxEnt idea also provides a general procedure
0= = (log p(x) + 1) − λi fi (x) − γ. for learning a generative model from data. The key dif-
δp i ference between MaxEnt models in (theoretical) physics
83

and ML is that in ML we have no direct access to ob- consider two special cases where x has different support
served values hfi iobs . Instead, these averages must be (different kinds of data). First, consider the case that the
directly estimated from data (samples). To denote this random variables x ∈ Rn are real numbers. In this case
difference, we will call empirical averages calculated from we can compute the partition function directly:
data as hfi idata . We can think of MaxEnt as a statisti- Z
cal inference procedure simply by replacing hfi iobs by T 1 T 1 T −1
Z = dx ea x+ 2 x Jx = (2π)n detJ −1 e− 2 a J a .
p
hfi idata above.
This subtle change has important implications for (187)
training MaxEnt models. First, since we do not know
these averages exactly, but must estimate them from the The resulting probability density function is,
data, our training procedures must be careful not to over-
p(x) = Z −1 e−E(x)
fit to the observations (our samples might not be reflec-
tive of the true values of these statistics). Second, the av- 1 1 T −1 T 1 T
=p e 2 a J a+a x+ 2 x Jx
erages of certain functions fi are easier to estimate from (2π) detJ
n −1

limited data than others. This is often an important con- 1 1 T −1

sideration when formulating which MaxEnt model to fit =p e− 2 (x−µ) Σ (x−µ) , (188)
(2π) detΣ
n
to the data. Finally, we note that unlike in physics where
conservation laws often suggest the functions fi whose where µ = −J −1 a and Σ = −J −1 . This, of course, is the
averages we hold fix, ML offers no comparable guide for normalized, multi-dimensional Gaussian distribution.
how to choose the fi we care about. For these reasons, Second, consider the case that the random variable x
choosing the {fi } is often far from straightforward. As a is binary with xi ∈ {−1, +1}. The energy function takes
final point, we note that here we have presented a physics- the same form as Eq. (186), but the partition function
based perspective for justifying the MaxEnt procedure. can no longer be computed in a closed form. This model
We mention in passing that the MaxEnt in ML is also is known as the Ising model in the physics literature, and
closely related to ideas from Bayesian inference (Jaynes, is often called a Markov Random Field in the machine
1968, 2003) and this latter point of view is more com- learning literature. It is well known to physicists that
mon in discussions of MaxEnt in the statistics and ML calculating the partition function for the Ising Model is
literature. intractable. For this reason, the best we can do is esti-
mate it using numerical techniques such MCMC methods
or approximate methods like variational MFT methods,
3. Generalized Ising Models from MaxEnt
see Sec. XIV. Finally, we note that in ML it is common to
use binary variables which take on values in xi ∈ {0, 1}
The form of a MaxEnt model is completely specified
rather than {±1}. This can sometimes be a source of con-
once we choose the averages {fi } we wish to constrain.
fusion when translating between ML and physics litera-
One common choice often used in MaxEnt modeling is to
tures and can lead to confusion when using ML packages
constrain the first two moments of a distribution. When
for physics problems.
our random variables x are continuous, the corresponding
MaxEnt distribution is a multi-dimensional Gaussian. If
the x are binary (discrete), then the corresponding Max-
C. Cost functions for training energy-based models
Ent distribution is a generalized Ising (Potts) model with
all-to-all couplings.
The MaxEnt procedure gives us a way of parametrizing
To see this, consider a random variable x with first
an energy-based generative model. For any energy-based
and second moments hxi idata and hxi xj idata , respectively.
generative model, the energy function E(x, {θi }) depends
According to the Principle of Maximum Entropy, we
on some parameters θi – couplings in the language of
should choose to model this variable using a Boltzmann
statistical physics – that must be inferred directly from
distribution with constraints on the first and second mo-
the data. For example, for the MaxEnt models the {θi }
ments. Let ai be the Lagrange multiplier associated with
are just the Lagrange multipliers {λi } introduced in the
hxi idata and Jij /2 be the Lagrange multiplier associated
last section. The goal of the training procedure is to use
with hxi xj idata . Using Eq. (182), it is easy to verify that
the available training data to fit these parameters.
the energy function
Like in many other ML techniques, we will fit these
X 1X couplings by minimizing a cost function using stochastic
E(x) = − a i xi − Jij xi xj (186)
2 ij gradient descent (cf. Sec. IV). Such a procedure naturally
i
separates into two parts: choosing an appropriate cost
satisfies the above constraints. function, and calculating the gradient of the cost func-
Partition functions for maximum entropy models are tion with respect to the model parameters. Formulating
often intractable to compute. Therefore, it is helpful to a cost function for generative models is a little bit trickier
84

than for supervised, discriminative models. The objec- ing the log-likelihood:
tive of discriminative models is straightforward – predict
the label from the features. However, what we mean by L({θi }) = hlog (pθ (x))idata
a “good” generative model is much harder to define using = −hE(x; {θi })idata − log Z({θi }), (189)
a cost function. We would like the model to generate
where we have set β = 1. In writing this expression we
examples similar to those we find in the training dataset.
made use of two facts: (i) our generative distribution is
However, we would also like the model to be able to gen-
of the Boltzmann form, and (ii) the partition function
eralize – we do not want the model to reproduce “spurious
does not depend on the data:
details” that are particular to the training dataset. Un-
like for discriminative models, there is no straightforward hlog Z({θi })idata = log Z({θi }). (190)
idea like cross-validation on the data labels that neatly
addresses this issue. For this reason, formulating cost
functions for generative models is subtle and represents 2. Regularization
an important and interesting open area of research.
Calculating the gradients of energy-based models also Just as for discriminative models like linear and logistic
turns out to be different than for discriminative mod- regression, it is common to supplement the log-likelihood
els, such as deep neural networks. Rather than relying with additional regularization terms (see Secs. VI and
on automatic differentiation techniques and backpropa- VII). Instead of minimizing the negative log-likelihood,
gation (see Sec. IX.C), calculating the gradient requires one minimizes a cost function of the form
drawing on intuitions from MCMC-based methods. Be-
low, we provide an in-depth discussion of Boltzmann − L({θi }) + Ereg ({θi }), (191)
learning for energy-based generative models, focusing on where Ereg ({θi }) is an additional regularization term that
MaxEnt models. We put the emphasis on training pro- prevents overfitting. From a Bayesian perspective, this
cedures that generalize to more complicated generative new term can be viewed as encoding a (negative) log-
models with latent variables such as RBMs discussed in prior on model parameters and performing a maximum-
the next section. Therefore, we largely ignore the in- a-posteriori (MAP) estimate instead of a MLE (see cor-
credibly rich physics-based literature on fitting Ising-like responding discussion in Sec. VI).
MaxEnt models (see the recent reviews (Baldassi et al., As we saw by studying linear regression, different forms
2018; Nguyen et al., 2017) and references therein). of regularization give rise to different kinds of properties.
A common choice for the regularization function are the
sums of the L1 or L2 norms of the parameters
X
1. Maximum likelihood Ereg ({θi }) = Λ |θi |α , α = 1, 2 (192)
i

By far the most common approach used for training a with Λ controlling the regularization strength. For Λ = 0,
generative model is to maximize the log-likelihood of the there is no regularization and we are simply performing
training data set. Recall, that the log-likelihood char- MLE. In contrast, a choice of large Λ will force many
acterizes the log-probability of generating the observed parameters to be close to or exactly zero. Just as in
data using our generative model. By choosing the nega- regression, an L1 penalty enforces sparsity, with many of
tive log-likelihood as the cost function, the learning pro- the θi set to zero, and L2 regularization shrinks the size
cedure tries to find parameters that maximize the proba- of the parameters towards zero.
bility of the data. This cost function is intuitive and has One challenge of generative models is that it is often
been the work-horse of most generative modeling. How- difficult to choose the regularization strength Λ. Recall
ever, we note that the Maximum Likelihood estimation that, for linear and logistic regression, Λ is chosen to
(MLE) procedure has some important limitations that maximize the out-of-sample performance on a validation
we will return to in Sec. XVII. dataset (i.e. cross-validation). However, for generative
In what follows, we employ a general notation that is models our data are usually unlabeled. Therefore, choos-
applicable to all energy-based models, not just the Max- ing a regularization strength is more subtle and there ex-
Ent models introduced above. The reason for this is that ists no universal procedure for choosing Λ. One common
much of this discussion does not rely on the specific form strategy is to divide the data into a training set and a val-
of the energy function but only on the fact that our gen- idation set and monitor a summary statistic such as the
erative model takes a Boltzmann form. We denote the log-likelihood, energy distance (Székely, 2003), or varia-
generative model by the probability distribution pθ (x) tional free-energy of the generative model on the training
and its corresponding partition function by log Z({θi }). and validation sets (the variational free-energy was dis-
In MLE, the parameters of the model are fit by maximiz- cussed extensively in Sec. XIV ) (Hinton, 2012). If the
85

gap between the training and validation datasets starts To use SGD, we must still calculate the expectation
growing, one is probably overfitting the model even if values that appear in Eq. (195). The positive phase of the
the log-likelihood of the training dataset is still increas- gradient – the expectation values with respect to the data
ing. This also gives a procedure for “early stopping” – – can be easily calculated using samples from the training
a regularization procedure we introduced in the context dataset. However, the negative phase – the expectation
of discriminative models. In practice, when using such values with respect to the model – is generally much more
regularizers it is important to try many different values difficult to compute. We will see that in almost all cases,
of Λ and then try to use a proxy statistic for overfitting we will have to resort to either numerical or approximate
to evaluate the optimal choice of Λ. methods. The fundamental reason for this is that it is
impossible to calculate the partition function exactly for
most interesting models in both physics and ML.
D. Computing gradients
There are exceptional cases in which we can calcu-
We still need to specify a procedure for minimizing the late expectation values analytically. When this hap-
cost function. One powerful and common choice that pens, the generative model is said to have a Tractable
is widely employed when training energy-based models Likelihood. One example of a generative model with a
is stochastic gradient descent (SGD) (see Sec. IV). Per- Tractable Likelihood is the Gaussian MaxEnt model for
forming MLE using SGD requires calculating the gradi- real valued data discussed in Eq. (188). The param-
ent of the log-likelihood Eq. (189) with respect to the eters/Lagrange multipliers for this model are the local
parameters θi . To simplify notation and gain intuition, fields a and the pairwise coupling matrix J. In this case,
it is helpful to define “operators” Oi (x), conjugate to the the usual manipulations involving Gaussian integrals al-
parameters θi low us to exactly find the parameters µ = −J −1 a and
Σ = −J −1 , yielding the familiar expressions µ = hxidata
∂E(x; θi ) and Σ = h(x − hxidata )(x − hxidata )T idata . These are
Oi (x) = . (193)
∂θi the standard estimates for the sample mean and covari-
ance matrix. Converting back to the Lagrange multipli-
Since the partition function is just the cumulant gener-
ers yields
ating function for the Boltzmann distribution, we know
that the usual statistical mechanics relationships between
expectation values and derivatives of the log-partition J = −h(x − hxidata )(x − hxidata )T i−1 (196)
data .
function hold:
∂ log Z({θi })
hOi (x)imodel = Trx pθ (x)Oi (x) = − . (194) Returning to the generic case where most energy-based
∂θi
models have intractable likelihoods, we must estimate ex-
In terms of the operators {Oi (x)}, the gradient of pectation values numerically. One way to do this is draw
Eq. (189) takes the form (Ackley et al., 1987) samples Smodel = {x0i } from the model pθ (x) and evalu-
∂L({θi }) D ∂E(x; θi ) E ∂ log Z({θi }) ate arbitrary expectation values using these samples:
− = +
∂θi ∂θi data ∂θi
(195)
Z
= hOi (x)idata − hOi (x)imodel . X
hf (x)imodel = dxpθ (x)f (x) ≈ f (x0i ). (197)
These equations have a simple and beautiful interpre- x0i ∈Smodel
tation. The gradient of the log-likelihood with respect to
a model parameter is a difference of moments – one calcu-
lated directly from the data and one calculated from our The samples from the model x0i ∈ Smodel are often re-
model using the current model parameters. The data- ferred to as fantasy particles in the ML literature and
dependent term is known as the positive phase of the can be generated using simple MCMC algorithms such
gradient and the model-dependent term is known as the as Metropolis-Hasting which are covered in most modern
negative phase of the gradient. This derivation also gives statistical physics classes. However, if the reader is unfa-
an intuitive explanation for likelihood-based training pro- miliar with MCMC methods or wants a quick refresher,
cedures. The gradient acts on the model to lower the en- we recommend the concise and beautiful discussion of
ergy of configurations that are near observed data points MCMC methods from both the physics and ML point-
while raising the energy of configurations that are far of-view in Chapters 29-32 of David MacKay’s masterful
from observed data points. Finally, we note that all infor- book (MacKay, 2003).
mation about the data only enters the training procedure Finally, we note that once we have the fantasy particles
through the expectations hOi (x)idata and our generative from the model, we can also easily calculate the gradient
model is blind to information beyond what is contained of any expectation value hf (x)imodel using what is com-
in these expectations. monly called the “log-derivative trick” in ML (Fu, 2006;
86

Kleijnen and Rubinstein, 1996): XVI. DEEP GENERATIVE MODELS: HIDDEN VARIABLES
AND RESTRICTED BOLTZMANN MACHINES (RBMS)
∂ ∂pθ (x)
Z
hf (x)imodel = dx f (x)
∂θi ∂θi The last section introduced many of the core ideas be-
hind energy-based generative models. Here, we extend
D ∂ log p (x) E
θ
= f (x)
∂θi model this discussion to energy-based models that include la-
= hOi (x)f (x)imodel tent or hidden variables.
X Including latent variables in generative models greatly
≈ Oi (xj )f (x0j ). (198)
enhances their expressive power – allowing the model to
x0j ∈Smodel
represent sophisticated correlations between visible fea-
This expression allows us to take gradients of more com- tures without sacrificing trainability. By having multiple
plex cost functions beyond the MLE procedure discussed layers of latent variables, we can even construct powerful
here. deep generative models that possess many of the same
desirable properties as deep, discriminative neural net-
works.
E. Summary of the training procedure We begin with a discussion that tries to provide a sim-
ple intuition for why latent variables are such a pow-
We now summarize the discussion above and present a erful tool for generative models. Next, we introduce a
general procedure for training an energy based model us- powerful class of latent variable models called Restricted
ing SGD on the cost function (see Sec. IV). Our goal is to Boltzmann Machines (RBMs) and discuss techniques for
fit the parameters of a model pλ ({θi }) = Z −1 e−E(x,{θi }) . training these models. After that, we introduce Deep
Training the model involves the following steps: Boltzmann Machines (DBMs), which have multiple layers
of latent variables. We then introduce the new Paysage
1. Read a minibatch of data, {x}.
package for training energy-based models and demon-
2. Generate fantasy particles {x0 } ∼ pλ using an strate how to use it on the MNIST dataset and sam-
MCMC algorithm (e.g., Metropolis-Hastings). ples from the Ising model. We conclude by discussing
recent physics literature related to energy-based genera-
3. Compute the gradient of log-likelihood using these tive models.
samples and Eq. (195), where the averages are
taken over the minibatch of data and the fantasy
particles from the model, respectively. A. Why hidden (latent) variables?
4. Use the gradient as input to one of the gradient
based optimizers discussed in section Sec. IV. Latent or hidden variables are a powerful yet elegant
way to encode sophisticated correlations between observ-
In practice, it is helpful to supplement this basic proce- able features. The underlying reason for this is that
dure with some tricks that help training. As with dis- marginalizing over a subset of variables – “integrating
criminative neural networks, it is important to initial- out” degrees of freedom in the language of physics – in-
ize the parameters properly and print summary statistics duces complex interactions between the remaining vari-
during the training procedure on the training and vali- ables. The idea that integrating out variables can lead
dation sets to prevent overfitting. These and many other to complex correlations is a familiar component of many
“cheap tricks” have been nicely summarized in a short physical theories. For example, when considering free
note from the Hinton group (Hinton, 2012). electrons living on a lattice, integrating out phonons gives
A major computational and practical limitation of rise to higher-order electron-electron interactions (e.g. su-
these methods is that it is often hard to draw samples perconducting or magnetic correlations). More generally,
from generative models. MCMC methods often have long in the Wilsonian renormalization group paradigm, all ef-
mixing-times (the time one has to run the Markov chain fective field theories can be thought of as arising from
to get uncorrelated samples) and this can result in bi- integrating out high-energy degrees of freedom (Wilson
ased sampling. Luckily, we often do not need to know and Kogut, 1974).
the gradients exactly for training ML models (recall that Generative models with latent variables run this logic
noisy gradient estimates often help the convergence of in reverse – encode complex interactions between visible
gradient descent algorithms), and we can significantly re- variables by introducing additional, hidden variables that
duce the computational expense by running MCMC for interact with visible degrees of freedom in a simple man-
a reasonable time window. We will exploit this observa- ner, yet still reproduce the complex correlations between
tion extensively in the next section when we discuss how visible degrees in the data once marginalized over (in-
to train more complex energy-based models with hidden tegrated out). This allows us to encode complex higher-
variables. order interactions between the visible variables using sim-
87

pler interactions at the cost of introducing new latent


variables/degrees of freedom. This trick is also widely Hidden Layer bμ(hμ)
exploited in physics (e.g. in the Hubbard-Stratonovich
transformation (Hubbard, 1959; Stratonovich, 1957) or Interactions Wiμvihμ
the introduction of ghost fields in gauge theory (Faddeev
and Popov, 1967)).
To make these ideas more concrete, let us revisit the
Visible Layer ai(vi)
pairwise Ising model introduced in the discussion of Max-
Ent models, see Eq. (186). The model is described by a
FIG. 61 A Restricted Boltzmann Machine (RBM) consists of
Boltzmann distribution with energy
visible units vi and hidden units hµ that interact with each
other through interactions of the form Wiµ vi hµ . Importantly,
X 1X
E(v) = − ai vi − vi Jij vj , (199) there are no interactions between visible units themselves or
i
2 ij hidden units themselves.

where Jij is a symmetric coupling matrix that encodes


where E(v, h) is a joint energy functional of both the
the pairwise constraints and ai enforce the single-variable
latent and visible variables of the form
constraint.
Our goal is to replace the complicated interactions be-
X 1X 2 X
E(v, h) = − ai vi + h − vi Wiµ hµ . (202)
tween the visible variables vi encoded by Jij , by interac- i
2 µ µ iµ
tions with a new set of latent variables hµ . In order to
do this, it is helpful to rewrite the coupling matrix in a We can also use the energy function E(v, h) to define a
slightly different form. Using SVD, we canP always express new energy-based model p(v, h) on both the latent and
the coupling matrix in the form Jij =
N visible variables
µ=1 Wiµ Wjµ ,
where {Wiµ }i are appropriately normalized singular vec- e−E(v,h)
tors. In terms of Wiµ , the energy takes the form p(v, h) = . (203)
Z0
X 1X Marginalizing over latent variables of course gives us back
EHop (v) = − ai vi − vi Wiµ Wjµ vj . (200) the generalized Hopfield model (Barra et al., 2012)
i
2 ijµ
e−EHop (v)
Z
p(v) = dhp(v, h) = . (204)
We note that in the special case when both vi ∈ Z
{−1, +1} and Wiµ ∈ {−1, +1} are binary variables, a
Notice that E(v, h) contains no direct interactions be-
model with this form of the energy function is known as
tween visible degrees of freedom (or between hidden de-
the Hopfield model (Amit et al., 1985; Hopfield, 1982).
gree of freedom). Instead, the complex correlations be-
The Hopfield model has played an extremely important
tween the vi are encoded in the interaction between the
role in statistical physics, computational neuroscience,
visible vi and latent variables hµ . It turns out that the
and machine learning, and a full discussion of its prop-
model presented here is a special case of a more general
erties is well beyond the scope of this review [see (Amit,
class of powerful energy-based models called Restricted
1992) for a beautiful discussion that combines all these
Boltzmann Machines (RBMs).
perspectives]. Therefore, here we refer to all energy func-
tions of the form Eq. (200) as (generalized) Hopfield mod-
els, even for the case when the Wiµ are continuous vari- B. Restricted Boltzmann Machines (RBMs)
ables.
We now “decouple” the visible variables vi by intro- A Restricted Boltzmann Machine (RBM) is an energy-
ducing a set of normally, distributed continuous latent based model with both visible and hidden units where the
variables hµ (in condensed matter language we perform a visible and hidden units interact with each other but do
Hubbard-Stratonovich transformation). Using the usual not interact among themselves. The energy function of
identity for Gaussian integrals, we can rewrite the Boltz- an RBM takes the general functional form
mann distribution for the generalized Hopfield model as X X X
E(v, h) = − ai (vi )− bµ (hµ )− Wiµ vi hµ , (205)
ai vi + 12
P P
vi Wiµ Wjµ vj
e i ijµ i µ iµ
p(v) =
Z where ai (·) and bµ (·) are functions that we are free to
1
h2µ − i vi Wiµ hµ
P P
dhµ e− 2
P
ai vi
Q R
e i
µ
µ
choose. The most common choice is:
=
Z
ai vi , if vi ∈ {0, 1} is binary
(
dh e−E(v,h)
R
ai (vi ) = vi2
= (201) 2σ 2
, if vi ∈ R is continuous,
Z i
88

and Combining these equations,


Z
bµ hµ , if hµ ∈ {0, 1} is binary
(
bµ (hµ ) = E(v) = − log dhe−E(v,h)
h2µ
2σµ2 , if hµ ∈ R is continuous. X X Z P
=− ai (vi ) − log dhµ ebµ (hµ )+ i vi Wiµ hµ
For this choice of ai (·) and bµ (·), layers consisting of dis- i µ
crete binary units are often called Bernoulli layers, and
layers consisting of continuous variables are often called To understand what correlations are captured by p(v) it
Gaussian layers. The basic bipartite structure of an RBM is helpful to introduce the distribution
– i.e., a visible and hidden layer that interact with each ebµ (hµ )
other but not among themselves – is often depicted using qµ (hµ ) = (208)
Z
a graph of the form shown in Fig. 61.
of hidden units hµ , ignoring the interactions between v
An RBM can have different properties depending on
and h, and the cumulant generating function
whether the hidden and visible layers are taken to be
Bernoulli or Gaussian. The most common choice is to tn
Z X
Kµ (t) = log dhµ qµ (hµ )ethµ = κ(n) . (209)
have both the visible and hidden units be Bernoulli. This µ
n!
n
is what is typically meant by an RBM. However, other
(n)
combinations are also possible and used in the ML lit- Kµ (t) is defined such that the nth cumulant is κµ =
erature. When all the units are continuous, the RBM ∂tn Kµ |t=0 .
reduces to a multi-dimensional Gaussian with a very par- The cumulant generating function appears in the
ticular correlation structure. When the hidden units are marginal free-energy of the visible units, which can be
continuous and the visible units are discrete, the RBM is rewritten (up to a constant term) as:
equivalent to a generalized Hopfield model (see discussion !
above). When the the visible units are continuous and
X X X
E(v) = − ai (vi ) − Kµ Wiµ vi
the hidden units are discrete, the RBM is often called a i µ i
Gaussian Bernoulli Restricted Boltzmann Machine (Dahl X XX (
P
Wiµ vi )n
et al., 2010; Hinton and Salakhutdinov, 2006). It is even =− ai (vi ) − κ(n)
µ
i
n!
possible to perform multi-modal learning with a mixture i µ n

of continuous and discrete variables. For all these archi-


!
X X X
tectures, the important point is that all interactions oc- =− ai (vi ) − κ(1)
µ Wiµ vi
cur only between the visible and hidden units and there i i µ

are no interactions between units within the hidden or


!
1 X X (2)
visible layers, see Fig. 61. This is analogous to Quantum − κµ Wiµ Wjµ vi vj + . . . (210)
2 ij
Electrodynamics, where a free fermion and a free photon µ

interact with one another but not among themselves. We see that the marginal energy includes all orders of in-
Specifying a generative model with this bipartite inter- teractions between the visible units, with the n-th order
action structure has two major advantages: (i) it enables cumulants of qµ (hµ ) weighting the n-th order interac-
capturing both pairwise and higher-order correlations be- tions between the visible units. In the case of the Hop-
tween the visible units and (ii) it makes it easier to sample field model we discussed previously, qµ (hµ ) is a standard
from the model using an MCMC method known as block (1)
Gaussian distribution where the mean is κµ = 0, the
Gibbs sampling, which in turn makes the model easier to (2)
variance is κµ = 1, and all higher-order cumulants are
train. zero. Plugging these cumulants into Eq. (210) recovers
Before discussing training, it is worth better under- Eq. (202).
standing the kind of correlations that can be captured These calculations make clear the underlying reason
using an RBM. To do so, we can marginalize over the hid- for the incredible representational power of RBMs with
den units and ask about the resulting distribution over a Bernoulli hidden layer. Each hidden unit can encode in-
just the visible units teractions of arbitrarily high order. By combining many
Z Z
e−E(v,h) different hidden units, we can encode very complex in-
p(v) = dhp(v, h) = dh (206) teractions at all orders. Moreover, we can learn which
Z
order of correlations/interactions are important directly
where the integral should be replaced by a trace in all from the data instead of having to specify them ahead of
expressions for discrete units. time as we did in the MaxEnt models. This highlights
We can also define a marginal energy using the expres- the power of generative models with even the simplest in-
sion teractions between visible and latent variables to encode,
e−E(v) learn, and represent complex correlations present in the
p(v) = . (207) data.
Z
89

C. Training RBMs A Alternating Gibbs Sampling


t=0 t=1 t=2 t = οο
RBMs are a special class of energy-based generative
models, which can be trained using the Maximum Like-
lihood Estimation (MLE) procedure described in detail
data
in Sec. XV. To briefly recap, first, we must choose a cost
function – for MLE this is just the negative log-likelihood B Contrastive Divergence (CD-n)
with or without an additional regularization term to pre- t=0 t=1 t=2 t=n
vent overfitting. We then minimize this cost function us-
ing one of the Stochastic Gradient Descent (SGD) meth-
ods described in Sec. IV.
The gradient itself can be calculated using Eq. (195). data

For example, for the Bernoulli-Bernoulli RBM in


Eq. (205) we have C Persistent Contrastive Divergence (PCD-n)
t=0 t=1 t=2 t=n
∂L({Wiµ , ai , bµ })
= hvi hµ idata − hvi hµ imodel
∂Wiµ
∂L({Wiµ , ai , bµ }) fantasy particles
= hvi idata − hvi imodel from last SGD step
∂ai
∂L({Wiµ , ai , bµ })
= hhµ idata − hhµ imodel , (211) FIG. 62 (Top) To draw fantasy particles (samples from the
∂bµ model) we can perform alternating (block) Gibbs sampling
where the positive expectation with respect to the data between the visible and hidden layers starting with a sam-
ple from the data using the marginal distributions p(h|v)
is understood to mean sampling from the model while
and p(v|h). The “time” t corresponds to the time in the
clamping the visible units to their observed values in the Markov chain for the Monte Carlo and measures the num-
data. As before, calculating the negative phase of the ber of passes between the visible and hidden states. (Middle)
gradient (i.e. the expectation value with respect to the In Contrastive Divergence (CD), we approximately sample
model) requires that we draw samples from the model. the model by terminating the Gibbs sampling after n steps
Luckily, the bipartite form of the interactions in RBMs (CD-n) starting from the data. (C) In Persistent Contrastive
were specifically chosen with this in mind. Divergence (PCD), instead of restarting the Gibbs sampler
from the data, we initialize the sampler with the fantasy par-
ticles calculated from the model at the last SGD step.
1. Gibbs sampling and contrastive divergence (CD)
gradient descent is a minibatch of observed data. For
The bipartite interaction structure of an RBM makes it
each sample in the minibatch, we simply clamp the visi-
possible to calculate expectation values using a Markov
ble units to the observed values and apply Eq. (213) using
Chain Monte Carlo (MCMC) method known as Gibbs
the probability for the hidden variables. We then average
sampling. The key reason for this is that since there are
over all samples in the minibatch to calculate expectation
no interactions of visible units with themselves or hidden
values with respect to the data. To calculate expectation
units with themselves, the visible and hidden units of an
values with respect to the model, we use (block) Gibbs
RBM are conditionally independent:
sampling. The idea behind (block) Gibbs sampling is
Y to iteratively sample from the conditional distributions
p(v|h) = p(vi |h)
ht+1 ∼ p(h|vt ) and vt+1 ∼ p(v|ht+1 ) (see Figure 62,
i
Y top). Since the units are conditionally independent, each
p(h|v) = p(hµ |v), (212) step of this iteration can be performed by simply draw-
µ ing random numbers. The samples are guaranteed to
converge to the equilibrium distribution of the model in
with
the limit that t → ∞. At the end of the Gibbs sampling
procedure, one ends up with a minibatch of samples (fan-
X
p(vi = 1|h) = σ(ai + Wiµ hµ ) (213)
µ tasy particles).
X One drawback of Gibbs sampling is that it may take
p(hµ = 1|v) = σ(bµ + Wiµ vi )
many back and forth iterations to draw an independent
i
sample. For this reason, the Hinton group introduced
and where σ(z) = 1/(1 + e−z ) is the sigmoid function. an approximate Gibbs sampling technique called Con-
Using these expressions it is easy to compute expec- trastive Divergence (CD) (Hinton, 2002; Hinton et al.,
tation values with respect to the data. The input to 2006). In CD-n, we just perform n iterations of (block)
90

Gibbs sampling, with n often taken to be as small as 1 Deep Boltzmann Layerwise Fine-tuning with
(see Figure 62)! The price for this truncation is, of course, Machine (DBM) Pretraining PCD on full DBM
that we are not drawing samples from the true model dis-
tribution. But for our purpose – using the expectations
to estimate the gradient for SGD – CD-n has proven to
work reasonably well. As long as the approximate gra-
dients are reasonably correlated with the true gradient,
SGD will move in a reasonable direction. CD-n of course
does come at a price. Truncating the Gibbs sampler pre-
vents sampling far away from the starting point, which
for CD-n are the data points in the minibatch. Therefore,
our generative model will be much more accurate around
regions of feature space close to our training data. Thus, FIG. 63 Deep Boltzmann Machine contain multiple hidden
as is often the case in ML, CD-n sacrifices the ability layers. To train deep networks, first we perform layerwise
to generalize to some extent in order to make the model training where each two layers are treated as a RBM. This
easier to train. can be followed by fine-tuning using gradient descent and per-
Some of these undesirable features can be tempered sistent contrastive divergence (PCD).
by using a slightly different variant of CD called Persis-
tent Contrastive Divergence (PCD) (Tieleman and Hin-
ton, 2009). In PCD, rather than restarting the Gibbs σ = 0.01 (Hinton, 2012). An alternative initial-
sampler from the data at each gradient descent step, we ization scheme proposed by Glorot and Bengio in-
start the Gibbs sampling at the fantasy particles in the stead chooses the standard deviation
√ to scale with
last gradient descent step (see Fig. 62). Since parameters the size of the layers: σ = 2/ Nv + Nh where Nv
change slowly compared to the Gibbs sampling, samples and Nh are number of visible and hidden units re-
that are high probability at one step of the SGD are also spectively (Glorot and Bengio, 2010). The bias of
likely to be high probability at the next step. This en- the hidden units is initialized to zero while the bias
sures that PCD does not introduce large errors in the of the visible units is typically taken to be inversely
estimation of the gradients. The advantage of using fan- proportional to the mean activation, ai = hvi i−1 data .
tasy particles to initialize the Gibbs sampler is to allow
• Regularization.—One can of course use an L1 or
PCD to explore parts of the feature space that are much
L2 penalty, typically only on the weight parame-
further from the training dataset than one could reach
ters, not the biases. Alternatively, Dropout has
with ordinary CD.
been shown to decrease overfitting when training
We note that, in applications using RBMs as a vari- with CD and PCD, which results in more inter-
ational ansatz for quantum states, Gibbs sampling is pretable learned features.
not necessarily the best option for training, and in prac-
tice parallel tempering or other Metropolis schemes can • Learning Rates.—Typically, it is helpful to re-
outperform Gibbs sampling. In fact, Gibbs sampling is duce the learning rate in later stages of training.
not even feasible with complex-valued weights required
for quantum wavefucntions, whereas Metropolis schemes • Updates for CD and PCD.—There are several
might be feasible (Carleo, 2018). computational tricks one can use for speeding up
the alternating updates in CD and PCD, see Sec-
tion 3 in (Hinton, 2012).
2. Practical Considerations

The previous section gave an overview of how to train D. Deep Boltzmann Machine
RBMs. However, there are many “tricks of the trade”
that are missing from this discussion. Luckily, a succinct In this section, we introduce Deep Boltzmann Ma-
summary of these has been compiled by Geoff Hinton and chines (DBMs). Unlike RBMs, DBMs possess multi-
published as a note that readers interested in training ple hidden layers and were the first models rebranded
RBMs are urged to consult (Hinton, 2012). as “deep learning” (Hinton et al., 2006; Hinton and
For completeness, we briefly list some of the important Salakhutdinov, 2006) 18 . Many of the advantages that
points here:

• Initialization.—The model must be initialized.


Hinton suggests taking the weights Wiµ from a 18 Technically, these were Deep Belief Networks where only the top
Gaussian with mean zero and standard deviation layer was undirected
91

are thought to stem from having deep layers were al-


ready discussed in Sec. XI in the context of discrimina-
tive DNNs. Here, we revisit many of the same themes
with emphasis on energy-based models.
An RBM is composed of two layers of neurons that
are connected via an undirected graph, see Fig. 61. As
a result, it is possible to perform sampling v ∼ p(v|h)
and inference h ∼ p(h|v) with the same model. As with
the Hopfield model, we can view each of the hidden units
as representative of a pattern, or feature, that could be
present in the data. 19 The inference step involves assign-
ing a probability to each of these features that expresses FIG. 64 Fantasy particles (samples) generated using the in-
the degree to which each feature is present in a given dicated model trained on the MNIST dataset. Samples were
generated by running (alternating) layerwise Gibbs sampling
data sample. In an RBM, hidden units do not influence for 100 steps. This allows the final sample to be very far away
each other during the inference step, i.e. hidden units are from the starting point in our feature space. Notice that the
conditionally independent given the visible units. There generated samples look much less like hand-written recon-
are a number of reasons why this is unsatisfactory. One structions than in Fig. 60 which uses a single max-probability
reason is the desire for sparse distributed representations, iteration of the Gibbs sampler, indicating that training is
where each observed visible vector will strongly activate much less effective when exploring regions of probability space
a few (i.e. more than one but only a very small frac- faraway from the training data. In the Sec. XVII, we will ar-
gue that this is likely a generic feature of Likelihood-based
tion) of the hidden units. In the brain, this is thought training.
to be achieved by inhibitory lateral connections between
neurons. However, adding lateral intra-layer connections
between the hidden units makes the distribution difficult samples as an input to the next RBM (consisting of the
to sample from, so we need to come up with another way first and second hidden layer – purple hexagons and green
of creating connections between the hidden units. squares in Fig. 63). This procedure can then be repeated
With the Hopfield model, we saw that pairwise linear to pretrain all layers of the DBM.
connections between neurons can be mediated through This pretraining initializes the weights so that SGD
another layer. Therefore, a simple way to allow for ef- can be used effectively when the network is trained in a
fective connections between the hidden units is to add supervised fashion. In particular, the pretraining helps
another layer of hidden units. Rather than just having the gradients to stay well behaved rather than vanish
two layers, one visible and one hidden, we can add addi- or blow up – a problem that we discussed extensively
tional layers of latent variables to account for the corre- in the earlier sections on DNNs. It is worth noting that
lations between hidden units. Ideally, as one adds more once pretrained, we can use the usual Boltzmann learning
and more layers, one might hope that the correlations rules in Eq. (195) to fine-tune the weights and improve
between hidden variables become smaller and smaller the performance of the DBM (Hinton et al., 2006; Hinton
deeper into the network. This basic logic is reminiscent of and Salakhutdinov, 2006). As we demonstrate in the
renormalization procedures that seek to decorrelate lay- next section, the Paysage package presented here can be
ers at each step (Li and Wang, 2018; Mehta and Schwab, used to both construct and train DBMs using such a
2014; Vidal, 2007). The price of adding additional layers pretraining procedure.
is that the models become harder to train.
Training DBMs is more subtle than RBMs due to the
difficulty of propagating information from visible to hid- E. Generative models in practice: examples
den units. However, Hinton and collaborators realized
that some of these problems could be alleviated via a lay- 1. MNIST
erwise procedure. Rather than attempting to the train
the whole DBM at once, we can think of the DBM as a First, we apply the open source package Paysage
stack of RBMs (see Fig. 63). One first trains the bottom (French for landscape) for training unsupervised energy-
two layers of the DBM – treating it as if it is a stand- based models on the MNIST dataset.
alone RBM. Once this bottom RBM is trained, we can In Notebook 17, we explicitly demonstrate how to
generate “samples” from the hidden layer and use these build and train four different kinds of models: (i) a
“Hopfield” type RBM with Gaussian hidden units and
Bernoulli (binary) visible units, (ii) a conventional RBM
where both the visible and hidden units are Bernoulli,
19 In general, one should instead think of activity patterns of hidden (iii) a conventional RBM with an additional L1-penalty
units representing features in the data. that enforces sparsity, and (iv) a Deep Boltzmann Ma-
92

chine (DBM) with three Bernoulli layers with L1 penalty


each. We refer the reader to the Notebook for the details
of the code. In the following, we show and briefly discuss
the results.
After training the model, we compute reconstructions
and fantasy particles from the validation data set. Recall
that a reconstruction v0 of a given data point x is com-
puted in two steps: (i) we fix the visible layer v = x to
be the data, and use MCMC sampling to find the state
of the hidden layer h which maximizes the probability
distribution p(h|v). (ii) fixing the same obtained state
h, we find the reconstruction v0 of the original data point
which maximizes the probability p(v0 |h). In the case of
a DBM, the forward pass continues until we reach the
last of the hidden layers, and the backward pass goes in
reverse. Figure 60 shows the result.
We also used MCMC to draw samples from the learned FIG. 65 Images from MNIST were randomly corrupted by
probability distributions, the so-called fantasy particles. adding noise. These noisy images were used as inputs to the
visible layer of the generative model. The denoised images
To this end, we did layer-wise Gibbs sampling for a total
are obtained by a single “deterministic” (max probability) it-
of a fixed number of equilibration steps. The result is eration v → h → v0 .
shown in Figure 64.
Finally, one can use generative models to reduce the
noise in images (de-noising). We randomly flipped a frac- We define a Deep Boltzmann machine with two hidden
tion of the black&white bits in the validation data, and layers of Nhidden and Nhidden /10 units, respectively, and
use the models defined above to reconstruct (de-noise) apply L1 regularization to all weights. As in the MNIST
the digit images. Figure 65 shows the result. problem above, we use layer-wise pre-training, and de-
The full Paysage code used to generate Figs. 60, 64 ploy Persistent Contrastive Divergence to train the DBM
and 65 is available in Notebook 17. The pack- using ADAM.
age was developed by one of the authors (CKF) One of the lessons from this problem is that this task is
along with his colleagues at Unlearn.AI and makes computationally intensive, see Notebook 17. The train-
it easy to build, train, and deploy energy-based ing time on present-day laptops easily exceeds that of pre-
generative models with different architectures. vious studies from this review. Thus, we encourage the
Paysage’s documentation is available on GitHub under interested reader to try GPU-based training and study
https://github.com/drckf/paysage/tree/master/docs. the resulting speed-up.
Figures 66, 67 and 68 show the results of the numerical
experiment at T /J = 1.75, 2.25, 2.75 respectively, for a
2. Example: 2D Ising Model DBM with Nhidden = 800. Looking at the reconstructions
and the fantasy particles, we see that our DBM works
We can also analyze the 2D Ising data set. In previous well in the disordered and critical regions. However, the
sections, we used our knowledge of the critical point at chosen layer architecture is not optimal for T = 1.75 in
Tc /J ≈ 2.26 (see Onsager’s solution) to label the spin the ordered phase, presumably due to effects related to
configurations and study the problem of classifying the symmetry breaking.
states according to their phase of matter. However, in
more complicated models, where the precise position of
Tc is not known, one cannot label the states with such F. Generative models in physics
an accuracy, if at all.
As we explained, generative models can be used to Generative models have been studied and used ex-
learn a variational approximation for the probability dis- tensively in the context of physics. For instance, in
tribution that generated the data points. By using only Biophysics, dynamic Boltzmann distributions have been
the 2D spin configurations, we now attempt to train a used as effective models in chemical kinetics (Ernst et al.,
Bernoulli RBM, the fantasy particles of which are ther- 2018). In Statistical Physics, they were used to identify
mal Ising configurations. Unlike in previous studies of criticality in the Ising model (Morningstar and Melko,
the Ising dataset, here we perform the analysis at a fixed 2017). In parallel, tools from Statistical Physics have
temperature T . We can then apply our model at three been applied to analyze the learning ability of RBMs (De-
different values T = 1.75, 2.25, 2.75 in the ordered, near- celle et al., 2018; Huang, 2017b), characterizing the spar-
critical and disordered regions, respectively. sity of the weights, the effective temperature, the non-
93

FIG. 66 MC samples, their reconstructions and fantasy particles generated by a Deep Boltzmann Machine in the ordered
phase of the the 2D Ising data set at T /J = 1.75. We used two hidden layers of 1000 and 100 layers, respectively.

FIG. 67 MC samples, their reconstructions and fantasy particles generated by a Deep Boltzmann Machine in the critical
regime of the the 2D Ising data set at T /J = 2.25. We used two hidden layers of 1000 and 100 layers, respectively.

linearities in the activation functions of hidden units, tions in the study of quantum systems too. Most no-
and the adaptation of fields maintaining the activity in tably, RBM-inspired variational ansatzes were used to
the visible layer (Tubiana and Monasson, 2017). Spin learn both complex-valued wavefunctions and the real-
glass theory motivated a deterministic framework for valued probability distribution associated with the abso-
the training, evaluation, and use of RBMs (Tramel lute square of a quantum state (Carleo et al., 2018; Car-
et al., 2017); it was demonstrated that the training pro- leo and Troyer, 2017; Freitas et al., 2018; Nomura et al.,
cess in RBMs itself exhibits phase transitions (Barra 2017; Torlai et al., 2018) and, in this context, RBMs are
et al., 2016, 2017); learning in RBMs was studied in the sometimes called Born machines (Cheng et al., 2017), in-
context of equilibrium (Cossu et al., 2018; Funai and cluding quantum state tomorgraphy (Carrasquilla et al.,
Giataganas, 2018) and nonequilibrium (Salazar, 2017) 2018; Torlai et al., 2018; Torlai and Melko, 2017). Fur-
thermodynamics, and spectral dynamics (Decelle et al., ther applications include the detection of order in low-
2017); mean-field theory found application in analyzing energy product states (Rao et al., 2017), and learning
DBMs (Huang, 2017a). Another interesting direction of Einstein-Podolsky-Rosen correlations on an RBM (Wein-
research is the use of generative models to improve Monte stein, 2017). Inspired by the success of tensor networks in
Carlo algorithms (Cristoforetti et al., 2017; Nagai et al., physics, the latter have been used as a basis for both gen-
2017; Tanaka and Tomiya, 2017b; Wang, 2017). Ideas erative and discriminative learning (Huggins et al., 2019):
from quantum mechanics have been put forward to in- RBMs (Chen et al., 2018) were used to extract the spa-
troduce improved speed-up in certain parts of the learn- tial geometry from entanglement (You et al., 2017), and
ing algorithms for Helmholtz machines (Benedetti et al., generative models based on matrix product states have
2016, 2017). been developed (Han et al., 2017). Last but not least,
Quantum entanglement was studied using RBM-encoded
At the same time, generative models have applica-
94

FIG. 68 MC samples, their reconstructions and fantasy particles generated by a Deep Boltzmann Machine in the disordered
phase of the the 2D Ising data set at T /J = 2.75. We used two hidden layers of 1000 and 100 layers, respectively.

states (Deng et al., 2017) and tensor product based gen- come some of these limitations, simultaneously highlight-
erative models have been used to understand MNIST and ing both the power of GANs and some of the difficulties.
other ML datasets (Stoudenmire and Schwab, 2016). We then show how VAEs integrate the variational meth-
ods introduced in Sec. XIV with deep, differentiable neu-
ral networks to build more powerful generative models
XVII. VARIATIONAL AUTOENCODERS (VAES) AND that move beyond the Expectation Maximization (EM).
GENERATIVE ADVERSARIAL NETWORKS (GANS)
We then briefly discuss VAEs from an information theo-
retic perspective, before discussing practical tips for im-
In the previous two sections, we considered energy-
plementing and training VAEs. We conclude by using
based generative models. Here, we extend our discus-
VAEs on examples using the Ising and MNIST datasets
sion to two new generative model frameworks that have
(see also Notebooks 19 and 20).
gained wide appeal in the the last few years: generative
adversarial networks (GANs) (Goodfellow, 2016; Good-
fellow et al., 2014; Radford et al., 2015) and variational A. The limitations of maximizing Likelihood
autoencoders (VAEs) (Kingma and Welling, 2013). Un-
like energy-based models, both these generative modeling The Kullback-Leibler (KL)-divergence plays a central
frameworks are based on differentiable neural networks role in many generative models. Developing an intuition
and consequently can be trained using backpropagation- about KL-divergences is one of the keys to understanding
based methods. VAEs, in particular, can be easily im- why adversarial learning has proved to be such a powerful
plemented and trained using high-level packages such as method for generative modeling. Here, we revisit the KL-
Keras making them an easy-to-deploy generative frame- divergence with an eye towards understanding GANs and
work. These models also differ from the energy-based motivate adversarial learning. The KL-divergence mea-
models in that they do not directly seek to maximize like- sures the similarity between two probability distributions
lihood. GANs, for example, employ a novel cost function p(x) and q(x). Strictly speaking, the KL divergence is
based on adversarial learning (a concept we motivate and not a metric because it is not symmetric and does not
explain below). Finally we note that VAEs and GANs are satisfy the triangle inequality.
already starting to make their way into physics (Heimel Given two distributions, there are two distinct KL-
et al., 2018; Liu et al., 2017; Rocchetto et al., 2018; Wet- divergences we can construct:
zel, 2017) and astronomy (Ravanbakhsh et al., 2017), and Z
p(x)
methods from physics may prove useful for furthering DKL (p||q) = dxp(x) log (214)
q(x)
our understanding of these methods (Alemi and Abbara,
q(x)
Z
2017). More generally, GANs have found important ap- DKL (q||p) = dxq(x) log . (215)
plications in many artistic and image manipulation tasks p(x)
(see references in (Goodfellow, 2016)). A related quantity called the Jensen-Shannon divergence,
The section is organized as follows. We start by moti-     
1 p + q p + q
vating adversarial learning by discussing the limitations DJS (p, q) = DKL p + DKL q
of maximum likelihood based approaches. We then give 2 2 2
a high-level introduction to the main idea behind gen- does satisfy all of the properties of a squared metric (i.e.,
erative adversarial networks and discuss how they over- the square root of the Jensen-Shannon divergence is a
95

∆ = 2.0 ∆ = 5.0
Model Model
Data Data

−15 −10 −5 0 5 10 15 −15 −10 −5 0 5 10 15


x x
∆ = 1.0
Data-Model Model
20 Model-Data Data

15

10

0
0.0 0.5 1.0 1.5 2.0 2.5 3.0 −4 −2 0 2 4
∆ x
FIG. 69 KL-divergences between the data distribution pdata
and the model pθ . Data is drawn from a bimodal Gaus- Data-Model
sian distribution with unit variances peaked at ±∆ with 5
Model-Data
∆ = 2.0 and the model pθ (x) is a Gaussian with mean zero 4
and same variance as pθ (x). (Top) pdata and pθ for ∆ = 2.
(Bottom) DKL (pdata ||pθ ) (Data-Model) and DKL (pθ ||pdata ) 3
(Model-Data) as a function of ∆. Notice that DKL (pdata ||pθ )
is insensitive to placing weight in the model distribution in 2
regions where pdata ≈ 0 whereas DKL (pθ ||pdata ) punishes this
harshly. 1
0
0 2 4 6 8 10

FIG. 70 KL-divergences between the data distribution pdata
and the model pθ . Data is drawn from a Gaussian mixture
metric). An important property of the KL-divergence of the form pdata = 0.25N (−∆) + 0.25 ∗ N (∆) + 0.5N (0)
that we will make use of repeatedly is its positivity: where N (a) is a normal distribution with unit variance cen-
DKL (p||q) ≥ 0 with equality if and only if p(x) = q(x) tered at x = a. pθ (x) is a Gaussian with σ 2 = 2. (Top)
pdata and pθ for ∆ = 5. (Middle) pdata and pθ for ∆ = 1.
almost everywhere.
(Bottom) DKL (pdata ||pθ ) [Data-Model] and DKL (pθ ||pdata )
[Model-Data] as a function of ∆. Notice that DKL (pθ ||pdata )
is insensitive to placing weight in the model distribution in
In generative models in ML, the two distributions regions where pθ ≈ 0 whereas DKL (pdata ||pθ ) punishes this
we are usually concerned with are the model distribu- harshly .
tion pθ (x) and the data distribution pdata (x). We of
course would like these models to be as similar as possi-
ble. However, as we discuss below, there are many sub-
tleties about how we measure similarities that can have
large consequences for the behavior of training proce-
dures. Maximizing the log-likelihood of the data under
the model is the same as minimizing the KL divergence
between the data distribution and the model distribu-
tion DKL (pdata ||pθ ). To see this, we can rewrite the KL
96

divergence as:
D(x) tries to make
D(G(z))be near 0
Z
DKL (pdata ||pθ ) = dxpdata (x) log pdata (x)
Z G tries to make
− dxpdata (x) log pθ (x) D(G(z))be near 1

= −S[pdata ] − hlog pθ (x)idata (216)


D(x) tries to
Rearranging this equation, we have be near 1
D
hlog pθ (v)idata = −S[pdata ] − DKL (pdata ||pθ ) (217)

The equivalence follows from the positivity of KL-


divergence and the fact that the entropy of the data “Discriminator” x sampled from
distribution is constant. In contrast, the original for- network D data
mulation of GANs minimizes an upper bound on the
Jensen-Shannon divergence between the model distribu-
tion pθ (x) and the data distribution pdata (x) (Goodfellow
et al., 2014). “Generator”
This difference in objectives underlies the difference in x sampled from network G
behavior between GANs and likelihood based generative data
models. To see this, we can compare the behavior of the
two KL-divergences DKL (pdata ||pθ ) and DKL (pθ ||pdata ). latent space
As is evident from Fig. 69 and Fig. 70, though both of input z
these KL-divergences measure similarities between the
two distributions, they are sensitive to very different
things. DKL (pθ ||pdata ) is insensitive to setting pθ ≈ 0 FIG. 71 A GAN consists of two differentiable functions (usu-
even when pdata 6= 0 whereas DKL (pdata ||pθ ) punishes ally represented as deep neural networks): a generator func-
this harshly. In contrast, DKL (pdata ||pθ ) is insensitive tion G(z; θG ) that takes as an input a z sampled from some
to placing weight in the model distribution in regions prior on the latent space and outputs a point x. The generator
function (neural network) has parameters θG . The discrim-
where pdata ≈ 0 whereas DKL (pθ ||pdata ) punishes this
inator function D(x; θD ) discriminates between x from the
harshly. In other words, DKL (pdata ||pθ ) prefers models data and samples from the model: x = G(z; θG ). The two net-
that have a high probability in regions with lots of train- works are trained by “playing a game” where the discriminator
ing data points whereas DKL (pθ ||pdata ) punishes models is trained to distinguish between synthetic and real examples
for putting high probability where there is no data. while the generator is trained to try to fool the discriminator.
In the context of the above discussion, this suggests Importantly, the cost function for the discriminator depends
that the way likelihood-based methods are most likely to on the generator parameters and vice versa.
fail, is by improperly “filling in” any low-probability den-
sity regions between peaks in the data distribution. In
contrast, at least in principle, the Jensen-Shannon distri- between real data points and samples generated from the
bution which underlies GANs is sensitive both to placing model. By punishing the model for generating points
weight where there is data since it has information about that can be easily discriminated from the data, adversar-
DKL (pdata ||pθ ) and to not placing weight where no data ial learning decreases the weight of regions in the model
has been observed (i.e. in low-probability density regions) space that are far away from data points – regions that
since it has information about DKL (pθ ||pdata ). inevitably arise when maximizing likelihood. This core
In practice, DKL (pdata ||pθ ) can be calculated easily intuition implicitly underlies many adversarial training
directly from the data using sampling. On the other algorithms (though it has been recently suggested that
hand, DKL (pθ ||pdata ) is impossible to compute since we this may not be the entire story (Goodfellow, 2016)).
do not know pdata (x). In particular, this integral cannot
be calculated using sampling since we cannot evaluate
pdata (x) at the locations of the fantasy particles. The B. Generative models and adversarial learning
idea of adversarial learning is to circumnavigate this dif-
ficulty by using an adversarial learning procedure. Re- Here, we give a brief high-level overview of the ba-
call, that DKL (pθ ||pdata ) is large when the model artifi- sic idea behind GANs. The mathematics and theory
cially over-weighs low-density regions near real peaks (see of GANs draws deeply from concepts in Game Theory
Fig. 69). Adversarial learning accomplishes this same such as Nash Equilibrium that are foreign to most physi-
task by teaching a discriminator network to distinguish cists. For this reason, a comprehensive discussion of
97

GANs is beyond the scope of the review. Readers inter-


ested in learning more are directed to the comprehensive Prior distribution: p (z)
tutorial by Goodfellow (Goodfellow, 2016). GANs are
θ
also notorious for being hard to train. For this reason,
readers wishing to play with GANs should also consider z-space
the very nice practical discussion entitled “How to train
a GAN” (affectionately labeled “ganhacks”) available at
https://github.com/soumith/ganhacks.
The central idea of GANs is to construct two differ-
entiable neural networks (see Fig. 71). The first neural
network, usually a (de)convolutional network based on
the DCGAN architecture (Radford et al., 2015), approx-
imates a generator function G(z; θG ) that takes as input Encoder: q (z|x) Decoder: p (x|z)
a z sampled from some prior on the latent space, and out- φ θ
puts a x from the model. The second network approxi-
mates a discriminator function D(x; θD ) that is designed
to distinguish between x from the data and samples gen-
erated by the model: x = G(z; θG ). The scalar D(x) rep-
resents the probability that x came from the data rather x-space
than the model pθG . We train D to distinguish actual
data points from synthetic examples and the generative
network to fool the discriminative network.
To define the cost function for training, it is useful to Dataset: D
define the functional

V (D, G) = Ex∼pdata (log D(x)) FIG. 72 VAEs learn a joint distribution pθ (x, z) between
latent variables z with prior distribution p(z) and data x.
+ Ez∼pprior (log [1 − D(G(z))]) . (218) The conditional distribution pθ (x|z) can be thought of as a
stochastic “decoder” that maps latent variables to new ex-
In the version of GANs most amenable to theoretical amples. The stochastic “encoder” qφ (z|x) approximates the
analysis – though not the version usually implemented true but intractable pθ (z|x) – much like mean-field theories
in practice – we take the cost function for the discrimi- in statistical physics approximate true distributions with ana-
nator and generators to be C (G) = −C (D) = 12 V (D, G). lytically tractable approximations. Figure based on Kingma’s
This choice of cost functions corresponds to what is called Ph.D. dissertation Chapter 2. (Kingma et al., 2017).
a zero-sum game. Since the discriminator is maximized,
we can write a cost function for the generator as
DNN. The use of latent variables is a common theme
C(G) = max V (G, D). (219) in many of the generative models we have encountered in
D unsupervised learning tasks from Gaussian Mixture Mod-
It turns out that this cost function is related to the els (see Sec. XIII) to Restricted Boltzmann Machines.
Jensen-Shannon Divergence in a simple manner (Good- However, in VAEs this mapping, p(x|z, θ) is much less
fellow, 2016; Goodfellow et al., 2014): restrictive and much more complicated since it takes the
form of a DNN. This added complexity means we can-
C(G) = − log 4 + 2DJS (pdata , pθG ). (220) not use techniques such as Expectation Maximization to
train the model and instead must rely of methods based
This brings us back full circle to the discussion in the last on backpropagation.
section on KL-divergences.

1. VAEs as variational models


C. Variational Autoencoders (VAEs)
We start by discussing VAEs from a variational per-
We now turn our attention to another class of powerful spective. We will make extensive use of the concepts
latent-variable, generative models called Variational Au- introduced in Sec. XIV and the reader is strongly-
toencoders (VAEs). VAEs exploit the variational/mean- encouraged to refresh their memory of this section before
field theory ideas presented in Sec. XIV to build complex proceeding. A VAE is a latent-variable model pθ (x, z)
generative models using deep neural networks (DNNs). with a latent variables z and observed variables x. The
The central idea behind VAEs is to represent the map latent variables are drawn from some pre-specified prior
from latent variables to observable variables using a distribution p(z). In practice, p(z) is almost always taken
98

to be a multivariate Gaussian. The conditional distribu- The second term acts as a regularizer and encourages the
tion pθ (x|z) maps points in the latent space to new ex- posterior distributions to be close to p(z). By maximizing
amples (see Fig. 72). This is often called a “stochastic the ELBO, we minimize the KL-divergence between the
decoder” and defines the generative model for the data. approximate and true posterior. By choosing a tractable
The reverse mapping that gives the posterior over the qφ (z|x), we make this feasible (see Fig. 72).
latent variables pθ (z|x) is often called the “stochastic en-
coder”.
A central challenge in latent variable modeling is to in- 2. Training via the reparametrization trick
fer the posterior distribution of the latent variables given
a sample from the data. This can in principle be done VAEs train models by minimizing the variational free
energy (maximizing the ELBO). Training a VAE is some-
via Bayes’ rule: pθ (z|x) = p(z)p θ (x|z)
. For some models,
pθ (x)
what complicated because we must simultaneously learn
we can calculate this analytically. In this case, we can
two sets of parameters: the parameters θ that define our
use techniques like Expectation Maximization (EM) (see
generative model pθ (x, z) as well as the variational pa-
Sec. XIV). However, in general this is intractable since
rameters φ in qφ (z|x). The basic approach will be the
the denominator requires computing a sum R over all con- same as for all DNN models: we will use gradient de-
figurations of the latent variables, p θ (x) = pθ (x, z)dz =
scent with the variational free energy as the objective
pθ (x|z)p(z)dz (i.e. a partition function in the language
R
(cost) function. For a dataset L, we can write our cost
of physics), which is often intractable for large models.
function as
In VAEs, where the pθ (x|z) is modeled using a DNN, this X
is impossible. Cθ,φ (L) = −Fqφ (x). (224)
A first attempt to address the issue of computing x∈L
p(x) could be through importance sampling (Neal, 2001). Taking the gradient with respect to θ is easy since only
That is, we choose a proposal distribution q(z|x) which the first term in Eq. (223) depends on θ,
is easy to sample from, and rewrite the sum as an expec-
tation with respect to this distribution: Cθ,φ (x) = Eqφ (z|x) [∇θ log pθ (x|z)]
∼ ∇θ log pθ (x|z) (225)
p(z)
Z
pθ (x) = pθ (x|z) qφ (z|x)dz. (221) where in the second line we have replaced the expec-
qφ (z|x)
tation value with a single Monte-Carlo sample z drawn
Thus, by sampling from qφ (z|x) we can get a Monte Carlo from qφ (z|x) (see Fig. XVII.C.2). When pθ (x|z) is ap-
estimate of p(x). However, this requires generating sam- proximated by a neural network, this can be calculated
ples and thus our estimates will be noisy. If our proposal using backpropagation with the reconstruction error as
distribution is poor, the variance in the estimate can be the objective function.
very high. On the other hand, calculating the gradient with re-
An alternative approach that avoids these sampling spect to the parameters φ is more complicated since φ
issues is to use the variational approach discussed in also appears in the expectation value Eqφ (z|x) . Ideally, we
Sec. XIV. We know from Eq. (162) that we can write would like to also use backpropagation to calculate this
the log-likelihood as as well. It turns out that this can be done by a simple
log p(x) = DKL (qφ (z|x)kpθ (z|x, θ)) − Fqφ (x), (222) change of variables that often goes under the name the
“reparameterization trick” (Kingma and Welling, 2013;
where the variational free energy is defined as Rezende et al., 2014). The basic idea is to change vari-
ables so that φ no longer appears in the distribution we
− Fqφ (x) ≡ Eqφ (z|x) [log pθ (x|z)] − DKL (qφ (z|x)|p(z)). are taking an expectation value with respect to. To do
(223) this, we express the random variable z ∼ qφ (z|x) as some
In writing this term, we have used Bayes rule and differentiable and invertible transformation of another
Eq. (174). Since the KL-divergence is strictly positive, random variable :
the (negative) variational free energy is a lower-bound on
the log-likelihood. For this reason, in the VAE literature, z = g(, φ, x), (226)
it is often called the Evidence Lower BOund or ELBO.
where the distribution of  is independent of x and φ.
Equation (223) has a beautiful interpretation. The
Then, we can replace expectation values over qφ (z|x) by
first term in this equation can be viewed as a “recon-
expectation values over p
struction error”, where we start with data x, encode it
into the latent representation using our approximate pos- Eqφ (z|x) [f (z)] = Ep [f (z)]. (227)
terior qφ (z|x), and then evaluate the log probability of
Evaluating the derivative then becomes quite straight for-
the original data given the inferred latents. For binary
ward since
variables, this is just the cross-entropy which we first en-
countered when studying logistic regression, cf. Sec. VII. ∇φ Eqφ (z|x) [f (z)] ∼ Ep [∇φ f (z)]. (228)
99

Datapoint

Inference Model Generative Model


Sample z
q (z|x) p (x|z)
φ θ

Negative
Variational Free Energy:
(ELBO)
E [log pθ(x|z) - KL(qφ(z|x)||p(z))]
q (z|x)
φ

FIG. 73 Schematic explaining the computational flow of VAEs. Figure based on Kingma’s Ph.D. dissertation Chapter 2.
(Kingma et al., 2017).

Of course, when we do this we still need to be able to These observations hints at the more general connec-
calculate the Jacobian of this change of variables tion between VAEs and information theory that we turn
to in the next section.
∂z
dφ (x, φ) = Det (229)
∂
since 3. Connection to the information bottleneck

log qφ (z|x) = log p() − log dφ (x, φ). (230) There is a fundamental connection between the vari-
ational autoencoder objective and the information bot-
Since we can calculate gradients, we can now use back- tleneck (IB) for lossy compression (Tishby et al., 2000).
propagation on the full the ELBO objective function (we The information bottleneck imagines we have input data
return to this below when we discuss concrete architec- x that is correlated with another variable of interest, y,
tures and implementations of VAE). and we are given access to the joint distribution, p(x, y).
One of the problems that commonly occurs when train- Our task is to take x as input and compress it in such a
ing VAEs by performing a stochastic optimization of the way as to retain as much information as possible about
ELBO (variational free energy) is that it often gets stuck the relevance variable, y. To do this, Tishby et al. pro-
in undesirable local minima, especially at the beginning pose to maximize the objective function
of the training procedure (Bowman et al., 2015; Kingma
et al., 2017; Sønderby et al., 2016). The underlying rea-
son for this is that the ELBO objective function can be
LIB = I(y; z) − βI(x; z) (232)
improved in two qualitatively different ways correspond-
ing to each of the two terms in Eq. (223): by minimizing
over a stochastic encoding distribution q(z|x), where z is
the reconstruction error or by making the posterior dis-
our compression of the input, and β is a tradeoff param-
tribution qφ (z|x) to be close to p(z) (Of course, the goal
eter that sets the relative preference of compression and
is to do both!). For complex datasets, at the beginning of
accuracy, and I(y; z) is the mutual information between y
training when the reconstruction error is extremely poor,
and z. Note that we choose a slightly different but equiv-
the model often quickly learns to make q(z|x) ≈ p(z) and
alent form of the objective relative to Tishby et al.. This
gets stuck in this local minimum. For this reason, in prac-
objective is only known to have a closed-form solution
tice it is found that it makes sense to modify the ELBO
when x and y are jointly Gaussian (Chechik et al., 2005).
objective to use an optimization schedule of the form
Otherwise, the optimization can be performed through a
Eqφ (z|x) [log pθ (x|z)] − βDKL (qφ (z|x)|p(z)) (231) Blahut-Arimoto type iterative update scheme (Arimoto,
1972; Blahut, 1972). However, this is only guaranteed to
where β is slowly annealed from 0 to 1 (Bowman et al., converge to a local optimum. A significant difficulty in
2015; Sønderby et al., 2016). An alternative regulariza- implementing IB is that it requires knowledge of the joint
tion is the “method of free bits”: modifying the objective distribution p(x, y) and that we must be able to compute
function of ELBO to ensure that on average qφ (z|x) has the mutual information, a notoriously difficult quantity
at least λ natural units of information about p(z) (see to estimate from samples. Hence, IB has in recent years
Kingma Ph.D thesis (Kingma et al., 2017) for details) . been utilized less than it might otherwise.
100

To address these problems, variational approximations x Data


to the IB objective function have been developed (Alemi
et al., 2016; Chalk et al., 2016). These approximations, Hidden layers Neural network with
when applied to a particular choice of p(x, y) give the weights φ
same objective as the variational autoencoder. Here
Z log σ Latent layer parameters
we follow the exposition from Alemi et al.(Alemi et al., mean z
2016). To see this, consider a dataset of N points, xi .
We set x = i and y = xi in the IB objective, similar Use analytic expression
KL(qφ(z|x)||p(z))
to (Slonim et al., 2005; Strouse and Schwab, 2017). We for Gaussians
choose p(i) = 1/N and p(x|i) = δ(x − xi ). That is, we
would like to find a compression of the data that preserves ε Standard normal variable
information about data point location while reducing in-
formation about data point identity. z Latent variable
Imagine that we are unable to directly work with the
decoder p(x|z). The first approximation replaces the ex- Neural network with
Hidden layers
act decoder inside the logarithm with an approximation, weights
q(x|z). Due to the positivity of KL-divergence, namely,
p Reconstruction
θ
DKL (p(x|z)||q(x|z)) ≥ 0
Reconstruction Error
Z Z
⇒ dx p(x|z) log p(x|z) ≥ dx p(x|z) log q(x|z), E [log pθ(x|z)]
q (z|x) (i.e. cross-entropy)
φ

(233)
FIG. 74 Computational graph for a VAE with Gaussian hid-
we have den units (i.e. p(z) are standard normal variables N (0, 1) and
Z 
p(x|z)
 Gaussian variational encoder whose posterior takes the form
I(x; z) = dxdz p(x)p(z|x) log qφ (z|x) = N (µ(x), σ 2 (x)).
p(x)
Z
≥ dxdz p(x)p(z|x) log q(x|z) + Hp (x)
x, which is irrelevant in the optimization procedure. In
fact, this objective has been explored and is called a β-
Z
≥ dxdz p(x)p(z|x) log q(x|z), (234)
VAE (Higgins et al., 2016). It’s interesting to note that in
the case of IB, the variational approximations are with
where Hp (x) ≥ 0 is the Shannon entropy of x. This respect to the decoder and prior, whereas in the VAE,
quantity can be estimated from data samples (i, xi ) af- the variational approximations are with respect to the
ter drawing from p(z|i) = p(z|xi ). Similarly, we can encoder.
replace the prior distribution of the encoding, p(z) =
dx p(x)q(z|x) which is typically intractable, with a
R

tractable q(z) to get D. VAE with Gaussian latent variables and Gaussian encoder

1 X p(z|xi )
Z
I(i; z) ≤ dz p(z|xi ) log (235) Our discussion of VAEs thus far has been quite ab-
N i q(z) stract. In this section, we discuss one of the most widely
employed VAE architectures: a VAE with factorized
Putting these two bounds Eqs. (234)and (235) together Gaussian posteriors, qφ (z|x) = N (z, µ(x), diag(σ 2 (x)))
and note that x = i and y = xi , we get an upper bound and standard normal latent variables p(z) = N (0, I).
for the IB objective that takes the same form as the VAE The training and implementation simplifies greatly
objective Eq. (231) we saw earlier: here because we can analytically workout the term
DKL (qφ (z|x)|p(z)).
LIB = I(x; z) − βI(y; z)
Z
≤ dx p(x)Ep(z|x) [log q(x|z)] (236)
1. Implementing the Gaussian VAE
1 X
−β DKL (p(z|xi )|q(z)). (237)
N i We now show how we can combine analytic expressions
for the KL-divergence with backpropagation to efficiently
Note that in Eq. (236) we have a conditional distribution implement a Gaussian VAE. We start by first deriving an-
of x given z but not their joint distribution inside the alytic expressions for DKL (qφ (z|x)|p(z)) in terms of the
expectation, which was the case in Eq. (231). This is means µ(x) and variances σ 2 (x). This is just a simple ex-
due to that we dropped the entropy term pertaining to ercise in Gaussian integrals. For notational convenience,
101

decoder is a Multi-layer Perceptron (MLPs) – neural net-


works with a single hidden layer. For this example, we
take the dimension of the hidden layer for both neural
networks to be 256. We trained the VAE using the RMS-
prop optimizer for 50 epochs.
We can visualize the embedding in the latent space
by plotting z of the test set and coloring the points by
digit identity [0-9] (see Figure XVII.D.2). Notice that
in general, digits that are similar end up being closer to
each other in the latent space. However, this is not always
the case (see bright green points for example). This is a
general feature of these low-dimensional embeddings and
we saw a similar phenomenon when we examined t-SNE
in Section XII.
The real advantage that VAEs offer over embeddings
such as t-SNE is that they are generative models. Given
FIG. 75 Embedding of MNIST dataset into a two-
dimensional latent space using a VAE with two latent dimen- a set of examples, we can generate new examples – or fan-
sions (see Notebook 19 and main text for details.) Data points tasy particles as they are commonly called in ML – by
are colored by their identity [0-9]. sampling the latent space z and then using the decoder to
map these latent variables to new examples. The results
of this procedure are shown in Figure XVII.D.2. In the
we drop the x-dependence of the means µ(x), variances top figure, we sample the latent space uniformly in a 5×5
σ 2 (x), and qφ (x). A straight-forward calculation gives grid. Notice that this results in extremely similar exam-
Z Z ples through much of the latent space. The underlying
dzqφ (z) log p(z) = N (z, µ(x), diag(σ 2 (x))) log N (0, I) reason for this is that uniform sampling does not respect
the underlying Gausssian structure of the latent space z.
J
J 1X 2 In the bottom figure, we perform a uniform sampling on
= − log 2π − (µ + log σj2 ), (238)
2 2 j=1 j the probability p(z) and mapped this back to the latent
space using the inverse Cumulative Distribution Func-
where J is the dimension of the latent space. An almost tion (CDF) of the Gaussian. We see that the diversity of
identical calculation yields the generated examples is much higher for this sampling
procedure.
J
J 1X This example is indicative of a more general problem:
Z
dzqφ (z) log qφ (z) = − log 2π − (1 + σj ). (239)
2
2 2 j=1 once we have learned a generative model how should we
sample latent spaces (White, 2016). This is especially
Combining these equations gives important in high-dimensional spaces where direct visu-
alization is not possible. Often certain directions in the
J
1X latent space can have different meanings. A particularly
1 + log σj2 (x) − µ2j (x) − σj2 (x) striking

−DKL (qφ (z|x)|p(z)) = . visual illustration is the “smile vector” that in-
2 j=1
terpolates between smiling and frowning faces (White,
(240) 2016).
This analytic expression allows us to implement the
Gaussian VAE in a straight forward way using neural net-
works. The computational graph for this implementation 3. VAEs for the 2D Ising model
is shown in Fig. 74. Notice that since the parameters are
all compositions of differentiable functions, we can use In Notebook 20, we used an almost identical architec-
standard backpropagation algorithms to train VAEs. ture (though coded in a slightly different way) to train
a VAE on the Ising dataset discussed through out the
review. The only differences between the two VAEs are
2. VAEs for the MNIST dataset that the visible layer of the Ising VAE now has 1600 units
(our samples are 40 × 40 instead of the 28 × 28 MNIST
In Notebook 19, we have implemented a VAE using images) and we have changed the standard deviation of
Keras and trained it using the MNIST dataset. The ba- the Gaussian of the latent variables p(z) from σ = 1 to
sic architecture is the one describe above. All figures σ = 0.2.
were generated with a VAE that has a latent space of We once again visualize the embedding learned by
dimension 2. The architecture of both the encoder and the VAE by plotting z and coloring the points by the
102

FIG. 77 (Top) Embedding of the Ising dataset into a two-


dimensional latent space using a VAE with two latent dimen-
sions (see Notebook 20 and main text for details.) Data points
are colored by the temperature each sample was drawn at.
(Bottom) Correlation between the latent dimensions and the
magnetization for each sample. Notice that the first principle
component corresponds to the magnetization.

saw in Section XII that the first principal component of


a PCA also corresponded to the magnetization.
We now ask how well the VAE can generate new exam-
ples (see Fig. 78). We see that the examples look quite
different from real Ising configurations – they lack the
large scale patchiness seen in the critical region. They
mostly turn out to be unstructured speckles that reflect
only the average probability that a pixel is on in a region.
This is not surprising since our VAE has no spatial struc-
ture, has only two latent dimensions, and the cost func-
FIG. 76 (Top) Fantasy particle generated by uniform sam- tion does not know about “correlations between spins”
pling of the latent space z. (Bottom) Fantasy particles gen- : there is very little information about correlations in
erated by uniform sampling of probability p(z) mapped to the binary cross-entropy which we use to measure recon-
latent space using the inverse Cumulative Distribution Func-
struction errors. The reader is encouraged to play with
tion (CDF) of the Gaussian.
the corresponding notebook and generate examples as we
change the latent dimension and/or choose modified ar-
chitectures such as decoders based on CNNs instead of
temperature at which the sample was drawn (see Fig- MLPs.
ure XVII.D.3 top). Notice that the latent space has This example also shows how much easier it is to dis-
learned a lot of the physics of the Ising model. For ex- criminate between labeled data than it is to learn how to
ample, the first VAE dimension is just the magnetization generate new examples from an unlabeled dataset. This
(Fig. XVII.D.3 bottom). This is not surprising since we is true in all spheres of machine learning. This is also
103

differential equations. We hope that this review will play


some small part toward this aspirational goal.
We wrote this review to provide a relatively concise
introduction to ML using ideas and language familiar
to physicists (though the review ended up being almost
twice the planned length). In writing the review, we have
tried to accomplish two somewhat disparate tasks. First,
we have tried to highlight more abstract and theoretical
considerations to show the unity of ML and statistical
learning. Many ML techniques can be understood by
starting with some key concepts from statistical learning
(MLE, bias-variance tradeoff, regularization) and com-
bining them with core concepts familiar from statisti-
cal physics (Monte-Carlo, gradient descent, variational
methods and MFT). Despite the high-level similarities
between all the methods presented here, the way that
these concepts manifest in any given technique is often
quite clever and understanding these “hacks” is the key to
understanding why some ML techniques turn out to be
so powerful and others not so much. ML, in this sense, is
as much an art as a science. Second, we have tried to give
the reader the practical know-how to start using the tools
and concepts from ML for immediately solving problems.
We believe the accompanying python notebooks and the
emphasis on coding in python have accomplished this
FIG. 78 Fantasy particles for the Ising model generated by
uniform sampling of probability p(z) mapped to latent space task.
using the inverse Cumulative Distribution Function (CDF) of
the Gaussian.
A. Research at the intersection of physics and ML

one of the reasons that generative models are one of the We hope the review catalyzes more research at the
cutting edge areas of modern Machine Learning research intersection of physics and machine learning. Here we
and there are likely to be a barrage of new techniques for briefly highlight a few promising research directions. We
generative modeling in the next few years. note that this list is far from comprehensive.
• Applying ML to solve physics problems. One
theme that has reoccurred through out the review
XVIII. OUTLOOK is that ML is most effective in settings with well de-
fined objectives and lots of data. For this reason,
In this review, we have attempted to give the reader the we expect ML to become a core competency of data
intellectual and practical tools to engage with Machine rich fields such as high-energy experiments and as-
Learning (ML), data science, and parts of modern statis- tronomy. However, ML may also prove to be use-
tics. We have tried to emphasize that ML differs from ful for helping further our physical understanding
ordinary statistics in that the goal is to predict rather through data-driven approach to other branches of
than to fit. For this reason, all the techniques discussed physics that may not be immediately obvious, such
here have to navigate important tensions that lie at the as quantum physics (Dunjko and Briegel, 2017).
heart of ML. The most prominent instantiation of these For example, recent works have used ideas from
inherent tradeoffs is the bias-variance tradeoff, which is ML to investigate disparate topics such as non-local
perhaps the only universal principle in ML. Identifying correlations (Canabarro et al., 2018), disordered
how these tradeoffs manifest in a particular algorithm is materials and glasses (Schoenholz, 2017), electronic
the key to constructing and training powerful ML meth- structure calculations (Grisafi et al., 2017) and
ods. numerical analysis of ferromagnetic resonances in
The immense progress in computing power and the thin films (Tomczak and Puszkarski, 2018), de-
corresponding availability of large datasets ensure that signing and analyzing quantum materials by inte-
ML will be an important part of the physics toolkit. In grating ML with existing techniques such as Dy-
the future, we expect ML to be a core competency of namical Mean Field Theory (DMFT) (Arsenault
physicists much like linear algebra, group theory, and et al., 2014), in the study of inflation (Rudelius,
104

2018), and even for experimental learning of quan- biophysics toolkit in the future. Many of the au-
tum states by using ML to aid in quantum tomog- thors of this review were inspired to engage with
raphy (Rocchetto et al., 2017). For a comprehen- ML for this reason.
sive review of ML methods in seismology, see (Kong
et al., 2018). • Using ideas from physics to develop new
ML algorithms. Many of the core ideas of ML
• Machine Learning on quantum computers. from Monte-Carlo techniques to variational meth-
Another interesting area of research that is likely ods have their origin in physics. There has been a
to grow is asking if and how quantum comput- tremendous amount of recent work developing tools
ers can help improve state-of-the art ML algo- to understand physical systems that may be of po-
rithms (Arunachalam and de Wolf, 2017; Benedetti tential use to ML. For example, in quantum con-
et al., 2016, 2017; Bromley and Rebentrost, 2018; densed matter techniques such as DMRG, MERA,
Ciliberto et al., 2017; Daskin, 2018; Innocenti et al., etc. have enriched both our practical and con-
2018; Mitarai et al., 2018; Perdomo-Ortiz et al., ceptual understandings (Stoudenmire and White,
2017; Rebentrost et al., 2017; Schuld et al., 2017; 2012; Vidal, 2007; White, 1992). It will be inter-
Schuld and Killoran, 2018; Schuld et al., 2015). esting to figure how and if these numerical methods
Concrete examples that seek to extend some of can be translated from a physics to a ML setting.
the basic ideas and methods we introduced in There are tantalizing hints that this is likely to be
this review to the quantum computing realm in- a fruitful direction (Han et al., 2017; Stoudenmire,
clude: algorithms for quantum-assisted gradient 2018; Stoudenmire and Schwab, 2016).
descent (Kerenidis and Prakash, 2017; Rebentrost
et al., 2016), classification (Schuld and Petruccione,
2017), and Ridge regression (Yu et al., 2017). Inter- B. Topics not covered in review
est in this field will undoubtedly grow once reliable
quantum computers become available (see also this Despite the considerable length of the review, we have
recent review (Dunjko and Briegel, 2017) ). had to make many omissions for the sake of brevity. It
is our hope and belief that after reading this review the
• Monte-Carlo Methods. An interesting area that reader will have the conceptual and practical knowledge
has seen a renewed interest with Bayesian modeling to quickly learn about these other topics. Among the
is the development of new Monte-Carlo methods for most prominent topics missing from this review are:
sampling complex probability distributions. Some
of the workhorses of modern Machine Learning – • Temporal/Sequential Data. We have not cov-
Annealed Importance Sampling (AIS) (Neal, 2001) ered techniques for dealing with temporal or se-
and Hamiltonian or Hybrid Monte-Carlo (HMC) quential data. Here, too there are many connec-
(Neal et al., 2011) – are intimately related to tions with statistical physics. A powerful class of
physics. As pointed out by Radford Neal, AIS is models for sequential data called Hidden Markov
just the Jarzynski inequality (Jarzynski, 1997) as Models (Rabiner, 1989) that utilize dynamical
a Monte-Carlo method and HMC was developed programming techniques have natural statistical
by physicists and exploits Hamiltonian dynamics physics interpretations in terms of transfer matri-
to improve proposal distributions. ces (see (Mehta et al., 2011) for explicit exam-
ple of this). Recently, Recurrent Neural Networks
• Statistical physics style theory of Deep (RNNs) have become an important and powerful
Learning. Many techniques in ML have origins tool for dealing with sequence data (Goodfellow
in statistical physics. Yet, a physics-style theory et al., 2016). RNNs generalize many of the ideas
of Deep Learning remains elusive. A key question discussed in the DNN section to deal with temporal
is to ask when and why these models manage to data.
generalize well. Physicists are only beginning to
ask these questions (Advani and Saxe, 2017; Mehta • Reinforcement Learning. Many of the most ex-
and Schwab, 2014; Saxe et al., 2013; Shwartz-Ziv citing developments in the last five years have come
and Tishby, 2017). But right now, it is fair to say from combining ideas from reinforcement learning
that the insights remain scattered and a cohesive with deep neural networks (Mnih et al., 2015; Sut-
theoretical understanding is lacking. ton and Barto, 1998). RL traces its origins to be-
haviourist psychology, when it was conceived as
• Biological physics and ML. Biological physics a way to explain and study reward-based deci-
is generating ever more datasets in fields ranging sion making. RL was put on solid mathematical
from neuroscience to evolution and immunology. It grounds in the 50’s by Richard Bellman and col-
is likely that ML will be an important part of the laborators, and has by now become an inseparable
105

part of robotics and artificial intelligence. RL is a that form the basis of modern ML with the more com-
field of Machine Learning, in which an agent learns monplace notions about what humans and behavioral sci-
how to master performing a specific task through entists mean by intelligence (see (Lake et al., 2017) for
an interaction with its environment. Depending on an enlightening and important modern discussion of this
the reward it receives, the agent chooses to take an distinction from a quantitative cognitive science point of
action affecting the environment, which in turn de- view as well as (Dreyfus, 1965) for a surprisingly relevant
termines the value of the next received reward, and philosophy-based critique from 1965).
so on. The long-term goal of the agent is to max- Almost all the techniques discussed here rely on op-
imise the cumulative expected return, thus improv- timizing a pre-specified objective function on a given
ing its performance in the longer run. Shadowed by dataset. Yet, we know that for large, complex models
more traditional optimal control algorithms, Re- changing the data distribution or the goal can lead to an
inforcement Learning has only recently taken off immediate degradation of performance. Deep networks
in physics (Albarran-Arriagada et al., 2018; Au- have poor generalizations to even a slightly different con-
gust and Hernández-Lobato, 2018; Bukov, 2018; text (the infamous Validation-Test set mismatch). This
Bukov et al., 2018; Cárdenas-López et al., 2017; inability to abstract and generalize is a common criticism
Chen et al., 2014; Chen and Xue, 2019; Dunjko lobbied against branding modern ML techniques as AI
et al., 2017; Fösel et al., 2018; Lamata, 2017; Mel- (Lake et al., 2017). For all these reasons, we have chosen
nikov et al., 2017; Neukart et al., 2017; Niu et al., to use the term Machine Learning rather than artificial
2018; Ramezanpour, 2017; Reddy et al., 2016b; Sri- intelligence through out the review.
arunothai et al., 2017; Sweke et al., 2018; Zhang This is far from the first time we have seen the use of
et al., 2018). Of particular interest are biophysics the term artificial intelligence and the grandiose promises
inspired works that seek to use RL to understand that it implies. In fact, the early 1950’s and 1960’s as
navigation and sensing in turbulent environments well as the early 1980’s saw similar AI bubbles (see this
(Colabrese et al., 2017; Masson et al., 2009; Reddy interesting summary by Luke Muehlhauser for Open Phi-
et al., 2016a; Vergassola et al., 2007). lanthropy (Muehlhauser, 2016)). These AI bubbles have
been followed by what have been dubbed “AI Winters”
• Support Vector Machines (SVMs) and Ker-
(McDermott et al., 1985).
nel Methods. SVMs and kernel methods are a
powerful set of techniques that work well when the The “Singularity” may not be coming but the advances
amount of training data is limited (Burges, 1998). in computing and the availability of large data sets likely
The mathematics and theory of SVM are very dif- ensure that the kind of statistical learning frameworks
ferent from statistical physics and for this reason discussed are here to stay. Rather than a general arti-
we chose not to include them here. However, SVMs ficial intelligence, the kind of techniques presented here
and kernel methods have played an extremely im- seem to be best suited for three important tasks: (a)
portant role in ML and are worth understanding. automating prediction from lots of labeled examples in
a narrowly-defined setting (b) learning how to parame-
terize and capture the correlations of complex probabil-
C. Rebranding Machine Learning as “Artificial Intelligence” ity distributions, and (c) finding policies for tasks with
well-defined goals and clear rules. We hope that this
The immense scientific progress in ML has also been review has given the reader enough conceptual tools to
accompanied by a massive public relations effort cen- start forming their own opinions about reality and hype
tered around Silicon Valley. Starting with the success when it comes to modern ML research. As Michael I.
of ImageNet (the most prominent early use of GPUs Joran puts it, “...if the acronym “AI” continues to be
for training large models) and the widespread adoption used as placeholder nomenclature going forward, letâĂŹs
of Deep Learning based techniques by the Silicon Val- be aware of the very real limitations of this placeholder.
ley companies, there has been a deliberate move to re- LetâĂŹs broaden our scope, tone down the hype and rec-
brand modern ML as “artificial intelligence” or AI (see ognize the serious challenges ahead "(Jordan, 2018).
graphs in (Katz, 2017)). Recently, computer scientist
Michael I. Jordan (who is famously known for his formal-
ization of variational inference, Bayesian network, and D. Social Implications of Machine Learning
expectation-maximization algorithm in machine learn-
ing research) cautioned that “This confluence of ideas The last decade has also seen a systematic increase in
and technology trends has been rebranded as “AI” over the use and deployment of Machine Learning techniques
the past few years. This rebranding is worthy of some into new areas of life and society. Some of the readers of
scrutiny”(Jordan, 2018). this review may currently be (or eventually be) employed
AI, by design, is an ambiguous term that mixes aspi- in industrial settings that seek to harness ML for practi-
rations with reality. It also conflates the statistical ideas cal purposes. However, caution is in order when applying
106

ML. Without foresight and accountability, the scale and was supported as a Simons Investigator in the MMLS and
scope of modern ML algorithms can lead to large scale by NIH K25 grant GM098875-02. PM and DJS would
unaccountable and undemocratic outcomes that can re- like to thank the NSF grant: PHYD1066293 for support-
inforce or even worsen existing inequality and inequities. ing the Aspen Center for Physics (ACP) for facilitating
Mathematician and data scientist turned social commen- discussions leading to this work. This research was sup-
tator Cathy O’Neil has dubbed the indiscriminate use of ported in part by the National Science Foundation under
these Big Data techniques “Weapons of Math Destruc- Grant No. NSF PHY-1748958. The authors are pleased
tion” (O’Neil, 2017). to acknowledge that the computational work reported on
When ML is used in a social context, abstract statis- in this paper was performed on the Shared Computing
tical relationships have real social consequences. False Cluster which is administered by Boston University’s Re-
positives can mean the difference between life and death search Computing Services.
(for example in the context of “signature drone strikes”)
(Mehta, 2015). ML algorithms, like all techniques, have
important limitations and should be employed with great Appendix A: Overview of the Datasets used in the Review
caution. It is our hope that ML practitioners keep this
in mind when working in social settings. 1. Ising dataset
All algorithms involve inherent tradeoffs in fairness, a
point formalized by computer scientist Jon Kleinberg and The Ising dataset we use throughout the review was
collaborators in a very interesting recent paper (Klein- generated using the standard Metropolis algorithm to
berg et al., 2016). It is far from clear how to make al- generate a Markov Chain. The full dataset consist of
gorithms fair for all people involved. This is even more 16 × 10000 samples of 40 × 40 spin configurations (i.e.
true with methods like Deep Learning that are hard to the design matrix has 160000 samples and 1600 features)
interpret. All ML algorithms have implicit assumptions drawn at temperatures 0.25, 0.5, · · · 4.0. The samples
and choices reflected in the datasets we use to the kind are drawn for the Boltzmann distribution of the two-
of functions we choose to optimize. It is important to dimensional ferromagnetic Ising model on a 40×40 square
remember that there is no “ view from nowhere” (Adam, lattice with periodic boundary conditions.
2006; Katz, 2017) – all ML algorithms reflect a point of
view and a set of assumptions about the world we live
in. For this reason, we hope that ML practitioners and 2. SUSY dataset
data scientists will take the time to consider the social
consequences of their actions. For example, developing a The SUSY dataset was generated by Baldi et al (Baldi
Hippocratic Oath for data scientists is now being consid- et al., 2014) to explore the efficacy of using Deep Learning
ered (Simonite, 2018). Doing no harm seems like a good for classifying collision events. The dataset is download-
start for making sure that we harness ML for the benefit able from the UCI Machine Learning Repository, a won-
of all members of society. derful resource for interesting datasets. Here we quote
directly from the paper:

XIX. ACKNOWLEDGMENTS The data has been produced using Monte


Carlo simulations and contains events with
PM and DJS would like to thank Anirvan Sengupta, two leptons (electrons or muons). In high
Justin Kinney, and Ilya Nemenman for useful conver- energy physics experiments, such as the AT-
sations during the ACP working group. The authors LAS and CMS detectors at the CERN LHC,
are also grateful to all readers who provided valuable one major hope is the discovery of new par-
feedback on this manuscript while it was under peer re- ticles. To accomplish this task, physicists at-
view. We encourage readers to help keep the Notebooks tempt to sift through data events and classify
which accompany the review up-to-date, by contribut- them as either a signal of some new physics
ing to them on Github at https://github.com/drckf/ process or particle, or instead a background
mlreview_notebooks. PM, CHW, and AD were sup- event from understood Standard Model pro-
ported by Simon’s Foundation in the form of a Simons In- cesses. Unfortunately we will never know for
vestigator in the MMLS and NIH MIRA program grant: sure what underlying physical process hap-
1R35GM119461. MB acknowledges support from the pened (the only information to which we have
Emergent Phenomena in Quantum Systems initiative of access are the final state particles). How-
the Gordon and Betty Moore Foundation, the ERC syn- ever, we can attempt to define parts of phase
ergy grant UQUAM, and the U.S. Department of Energy, space that will have a high percentage of sig-
Office of Science, Office of Advanced Scientific Comput- nal events. Typically this is done by using a
ing Research, Quantum Algorithm Teams Program. DJS series of simple requirements on the kinematic
107

quantities of the final state particles, for ex- 20x20 pixel box while preserving their aspect
ample having one or more leptons with large ratio. The resulting images contain grey lev-
amounts of momentum that is transverse to els as a result of the anti-aliasing technique
the beam line ( pT ). Here instead we will used by the normalization algorithm. the im-
use logistic regression in order to attempt to ages were centered in a 28x28 image by com-
find out the relative probability that an event puting the center of mass of the pixels, and
is from a signal or a background event and translating the image so as to position this
rather than using the kinematic quantities of point at the center of the 28x28 field.
final state particles directly we will use the
output of our logistic regression to define a The MNIST is often included by default in many modern
part of phase space that is enriched in sig- ML packages.
nal events. The dataset we are using has the
value of 18 kinematic variables ("features") of
the event. The first 8 features are direct mea- REFERENCES
surements of final state particles, in this case
the pT , pseudo-rapidity, and azimuthal angle Abu-Mostafa, Yaser S, Malik Magdon-Ismail, and Hsuan-
of two leptons in the event and the amount Tien Lin (2012), Learning from data, Vol. 4 (AMLBook
of missing transverse momentum (MET) to- New York, NY, USA:).
Ackley, David H, Geoffrey E Hinton, and Terrence J Se-
gether with its azimuthal angle. The last ten
jnowski (1987), “A learning algorithm for boltzmann ma-
features are functions of the first 8 features; chines,” in Readings in Computer Vision (Elsevier) pp.
these are high-level features derived by physi- 522–533.
cists to help discriminate between the two Adam, Alison (2006), Artificial knowing: Gender and the
classes. You can think of them as physicists thinking machine (Routledge).
attempt to use non-linear functions to classify Advani, Madhu, and Surya Ganguli (2016), “Statistical me-
signal and background events and they have chanics of optimal convex inference in high dimensions,”
Physical Review X 6 (3), 031034.
been developed with a lot of deep thinking Advani, Madhu, Subhaneil Lahiri, and Surya Ganguli (2013),
on the part of physicist. There is however, “Statistical mechanics of complex neural systems and high
an interest in using deep learning methods to dimensional data,” Journal of Statistical Mechanics: The-
obviate the need for physicists to manually ory and Experiment 2013 (03), P03014.
develop such features. Benchmark results us- Advani, Madhu S, and Andrew M Saxe (2017), “High-
ing Bayesian Decision Trees from a standard dimensional dynamics of generalization error in neural net-
physics package and 5-layer neural networks works,” arXiv preprint arXiv:1710.03667.
Aitchison, Laurence, Nicola Corradi, and Peter E Latham
and the dropout algorithm are presented in
(2016), “Zipfs law arises naturally when there are under-
the original paper to compare the ability of lying, unobserved variables,” PLoS computational biology
deep-learning to bypass the need of using such 12 (12), e1005110.
high level features. We will also explore this Albarran-Arriagada, F, J. C. Retamal, E. Solano, and
topic in later notebooks. The dataset con- L. Lamata (2018), “Measurement-based adapta-
sists of 5 million events, the first 4,500,000 of tion protocol with quantum reinforcement learning,”
which we will use for training the model and arXiv:1803.05340 .
Alemi, Alexander A, Ian Fischer, Joshua V Dillon, and Kevin
the last 500,000 examples will be used as a
Murphy (2016), “Deep variational information bottleneck,”
test set. arXiv preprint arXiv:1612.00410.
Alemi, Alireza, and Alia Abbara (2017), “Exponential capac-
ity in an autoencoder neural network with a hidden layer,”
3. MNIST Dataset arXiv preprint arXiv:1705.07441 .
Amit, Daniel J (1992), Modeling brain function: The world of
The MNIST dataset is one of the simplest and most attractor neural networks (Cambridge university press).
widely used Machine Learning Datasets. The MNIST Amit, Daniel J, Hanoch Gutfreund, and Haim Sompolinsky
dataset consists of hand-written images of numerical (1985), “Spin-glass models of neural networks,” Physical
Review A 32 (2), 1007.
characters 0−9 and consists of a training set of 60,000 ex-
Andrieu, Christophe, Nando De Freitas, Arnaud Doucet, and
amples, and a test set of 10,000 examples (LeCun et al., Michael I Jordan (2003), “An introduction to mcmc for
1998a). Information about the MNIST database and its machine learning,” Machine learning 50 (1-2), 5–43.
historical importance can be found at Yann Lecun’s wed- Arai, Shunta, Masayuki Ohzeki, and Kazuyuki Tanaka
site: http://yann.lecun.com/exdb/mnist/. A brief (2017), “Deep neural network detects quantum phase tran-
description from the website: sition,” arXiv preprint arXiv:1712.00371 .
Arimoto, Suguru (1972), “An algorithm for computing the
The original black and white (bilevel) images capacity of arbitrary discrete memoryless channels,” IEEE
from NIST were size normalized to fit in a Transactions on Information Theory 18 (1), 14–20.
108

Arsenault, Louis-François, Alejandro Lopez-Bezanilla, Bengio, Yoshua (2012), “Practical recommendations for
O Anatole von Lilienfeld, and Andrew J Millis (2014), gradient-based training of deep architectures,” in Neural
“Machine learning for many-body physics: the case of the networks: Tricks of the trade (Springer) pp. 437–478.
anderson impurity model,” Physical Review B 90 (15), Bennett, Robert (1969), “The intrinsic dimensionality of sig-
155136. nal collections,” IEEE Transactions on Information Theory
Arunachalam, Srinivasan, and Ronald de Wolf (2017), 15 (5), 517–525.
“A survey of quantum learning theory,” arXiv preprint Bény, Cédric (2018), “Inferring relevant features: from qft to
arXiv:1701.06806 . pca,” arXiv preprint arXiv:1802.05756 .
August, Moritz, and José Miguel Hernández-Lobato (2018), Berger, James O, and José M Bernardo (1992), “On the devel-
“Taking gradients through experiments: Lstms and mem- opment of the reference prior method,” Bayesian statistics
ory proximal policy optimization for black-box quantum 4, 35–60.
control,” arXiv:1802.04063. Bickel, Peter J, and David A Freedman (1981), “Some asymp-
Aurisano, A, A Radovic, D Rocco, A Himmel, MD Messier, totic theory for the bootstrap,” The Annals of Statistics ,
E Niner, G Pawloski, F Psihas, A Sousa, and P Vahle 1196–1217.
(2016), “A convolutional neural network neutrino event Bickel, Peter J, Bo Li, Alexandre B Tsybakov, Sara A van de
classifier,” Journal of Instrumentation 11 (09), P09001. Geer, Bin Yu, Teófilo Valdés, Carlos Rivero, Jianqing Fan,
Baireuther, P, TE O’Brien, B Tarasinski, and CWJ and Aad van der Vaart (2006), “Regularization in statis-
Beenakker (2017), “Machine-learning-assisted correction tics,” Test 15 (2), 271–344.
of correlated qubit errors in a topological code,” arXiv Bishop, C M (2006), Pattern recognition and machine learning
preprint arXiv:1705.07855 . (springer).
Baity-Jesi, M, L. Sagun, M. Geiger, S. Spigler, G. Ben Arous, Bishop, Chris M (1995a), “Training with noise is equivalent to
C. Cammarota, Y. LeCun, M. Wyart, and G. Biroli (2018), tikhonov regularization,” Neural computation 7 (1), 108–
“Comparing dynamics: Deep neural networks versus glassy 116.
systems,” . Bishop, Christopher M (1995b), Neural networks for pattern
Baldassi, Carlo, Federica Gerace, Hilbert J Kappen, Carlo recognition (Oxford university press).
Lucibello, Luca Saglietti, Enzo Tartaglione, and Riccardo Blahut, Richard (1972), “Computation of channel capacity
Zecchina (2017), “On the role of synaptic stochasticity and rate-distortion functions,” IEEE transactions on Infor-
in training low-precision neural networks,” arXiv preprint mation Theory 18 (4), 460–473.
arXiv:1710.09825 . Bottou, Léon (2012), “Stochastic gradient descent tricks,” in
Baldassi, Carlo, Federica Gerace, Luca Saglietti, and Ric- Neural networks: Tricks of the trade (Springer) pp. 421–
cardo Zecchina (2018), “From inverse problems to learning: 436.
a statistical mechanics approach,” in Journal of Physics: Bowman, Samuel R, Luke Vilnis, Oriol Vinyals, Andrew M
Conference Series, Vol. 955 (IOP Publishing) p. 012001. Dai, Rafal Jozefowicz, and Samy Bengio (2015), “Gener-
Baldi, Pierre, Peter Sadowski, and Daniel Whiteson (2014), ating sentences from a continuous space,” arXiv preprint
“Searching for exotic particles in high-energy physics with arXiv:1511.06349.
deep learning,” Nature communications 5, 4308. Boyd, Stephen, and Lieven Vandenberghe (2004), Convex
Barber, David (2012), Bayesian reasoning and machine learn- optimization (Cambridge university press).
ing (Cambridge University Press). Bradde, Serena, and William Bialek (2017), “Pca meets rg,”
Barnes, Josh, and Piet Hut (1986), “A hierarchical o (n log Journal of Statistical Physics 167 (3-4), 462–475.
n) force-calculation algorithm,” nature 324 (6096), 446. Breiman, Leo (1996), “Bagging predictors,” Machine learning
Barra, Adriano, Alberto Bernacchia, Enrica Santucci, and 24 (2), 123–140.
Pierluigi Contucci (2012), “On the equivalence of hopfield Breiman, Leo (2001), “Random forests,” Machine learning
networks and boltzmann machines,” Neural Networks 34, 45 (1), 5–32.
1–9. Breuckmann, Nikolas P, and Xiaotong Ni (2017), “Scalable
Barra, Adriano, Giuseppe Genovese, Peter Sollich, and neural network decoders for higher dimensional quantum
Daniele Tantari (2016), “Phase transitions in restricted codes,” arXiv preprint arXiv:1710.09489 .
boltzmann machines with generic priors,” arXiv preprint Broecker, Peter, Fakher F Assaad, and Simon Trebst (2017),
arXiv:1612.03132 . “Quantum phase recognition via unsupervised machine
Barra, Adriano, Giuseppe Genovese, Daniele Tantari, and Pe- learning,” arXiv preprint arXiv:1707.00663 .
ter Sollich (2017), “Phase diagram of restricted boltzmann Bromley, Thomas R, and Patrick Rebentrost (2018),
machines and generalised hopfield networks with arbitrary “Batched quantum state exponentiation and quantum heb-
priors,” arXiv preprint arXiv:1702.05882 . bian learning,” arXiv:1803.07039 .
Battiti, Roberto (1992), “First-and second-order methods for Bukov, Marin (2018), “Reinforcement learning for au-
learning: between steepest descent and newton’s method,” tonomous preparation of floquet-engineered states: Invert-
Neural computation 4 (2), 141–166. ing the quantum kapitza oscillator,” Phys. Rev. B 98,
Benedetti, Marcello, John Realpe-Gómez, Rupak Biswas, 224305.
and Alejandro Perdomo-Ortiz (2016), “Quantum-assisted Bukov, Marin, Alexandre G. R. Day, Dries Sels, Phillip Wein-
learning of graphical models with arbitrary pairwise con- berg, Anatoli Polkovnikov, and Pankaj Mehta (2018), “Re-
nectivity,” arXiv preprint arXiv:1609.02542 . inforcement learning in different phases of quantum con-
Benedetti, Marcello, John Realpe-Gómez, and Alejandro trol,” Phys. Rev. X 8, 031086.
Perdomo-Ortiz (2017), “Quantum-assisted helmholtz ma- Burges, Christopher JC (1998), “A tutorial on support vector
chines: A quantum-classical deep learning framework for machines for pattern recognition,” Data mining and knowl-
industrial datasets in near-term devices,” arXiv preprint edge discovery 2 (2), 121–167.
arXiv:1708.09784 . Caio, Marcello D, Marco Caccin, Paul Baireuther, Timo
109

Hyart, and Michel Fruchart (2019), “Machine learning as- the expressive power of deep learning: A tensor analysis,”
sisted measurement of local topological invariants,” arXiv in Conference on Learning Theory, pp. 698–728.
preprint arXiv:1901.03346 . Colabrese, Simona, Kristian Gustavsson, Antonio Celani,
Caldeira, J, WLK Wu, B Nord, C Avestruz, S Trivedi, and and Luca Biferale (2017), “Flow navigation by smart mi-
KT Story (2018), “Deepcmb: Lensing reconstruction of the croswimmers via reinforcement learning,” Physical review
cosmic microwave background with deep neural networks,” letters 118 (15), 158004.
arXiv preprint arXiv:1810.01483 . Cossu, Guido, Luigi Del Debbio, Tommaso Giani, Ava Kham-
Canabarro, Askery, Samuraí Brito, and Rafael Chaves (2018), seh, and Michael Wilson (2018), “Machine learning deter-
“Machine learning non-local correlations,” arXiv preprint mination of dynamical parameters: The ising model case,”
arXiv:1808.07069 . arXiv preprint arXiv:1810.11503 .
Cárdenas-López, FA, L Lamata, JC Retamal, and E Solano Cox, Trevor F, and Michael AA Cox (2000), Multidimen-
(2017), “Generalized quantum reinforcement learning with sional scaling (CRC press).
quantum technologies,” arXiv preprint arXiv:1709.07848 . Cristoforetti, Marco, Giuseppe Jurman, Andrea I Nardelli,
Carleo, Giuseppe (2018), , Private Communication. and Cesare Furlanello (2017), “Towards meaningful physics
Carleo, Giuseppe, Yusuke Nomura, and Masatoshi Imada from generative models,” arXiv preprint arXiv:1705.09524
(2018), “Constructing exact representations of quantum .
many-body systems with deep neural networks,” arXiv Dahl, George, Abdel-rahman Mohamed, Geoffrey E Hinton,
preprint arXiv:1802.09558 . et al. (2010), “Phone recognition with the mean-covariance
Carleo, Giuseppe, and Matthias Troyer (2017), “Solving the restricted boltzmann machine,” in Advances in neural in-
quantum many-body problem with artificial neural net- formation processing systems, pp. 469–477.
works,” Science 355 (6325), 602–606. Daskin, Ammar (2018), “A quantum implementation model
Carrasquilla, Juan, and Roger G Melko (2017), “Machine for artificial neural networks,” Quanta , 7–18.
learning phases of matter,” Nature Physics 13 (5), 431. Davaasuren, Amarsanaa, Yasunari Suzuki, Keisuke Fujii,
Carrasquilla, Juan, Giacomo Torlai, Roger G Melko, and Le- and Masato Koashi (2018), “General framework for con-
andro Aolita (2018), “Reconstructing quantum states with structing fast and near-optimal machine-learning-based de-
generative models,” arXiv preprint arXiv:1810.10584 . coder of the topological stabilizer codes,” arXiv preprint
Chalk, Matthew, Olivier Marre, and Gasper Tkacik (2016), arXiv:1801.04377 .
“Relevant sparse codes with variational information bottle- Day, Alexandre GR, Marin Bukov, Phillip Weinberg, Pankaj
neck,” in Advances in Neural Information Processing Sys- Mehta, and Dries Sels (2019), “Glassy phase of opti-
tems, pp. 1957–1965. mal quantum control,” Physical Review Letters 122 (2),
Chamberland, Christopher, and Pooya Ronagh (2018), “Deep 020601.
neural decoders for near term fault-tolerant experiments,” Day, Alexandre GR, and Pankaj Mehta (2018), “Validated
arXiv preprint arXiv:1802.06441 . agglomerative clustering,” in preparation.
Chechik, Gal, Amir Globerson, Naftali Tishby, and Yair Decelle, Aurélien, Giancarlo Fissore, and Cyril Furtlehner
Weiss (2005), “Information bottleneck for gaussian vari- (2017), “Spectral learning of restricted boltzmann ma-
ables,” Journal of machine learning research 6 (Jan), 165– chines,” arXiv preprint arXiv:1708.02917 .
188. Decelle, Aurélien, Giancarlo Fissore, and Cyril Furtlehner
Chen, Chunlin, Daoyi Dong, Han-Xiong Li, Jian Chu, and (2018), “Thermodynamics of restricted boltzmann ma-
Tzyh-Jong Tarn (2014), “Fidelity-based probabilistic q- chines and related learning dynamics,” arXiv preprint
learning for control of quantum systems,” IEEE transac- arXiv:1803.01960 .
tions on neural networks and learning systems 25 (5), 920– Dempster, Arthur P, Nan M Laird, and Donald B Rubin
933. (1977), “Maximum likelihood from incomplete data via the
Chen, Jing, Song Cheng, Haidong Xie, Lei Wang, and Tao Xi- em algorithm,” Journal of the royal statistical society. Series
ang (2018), “Equivalence of restricted boltzmann machines B (methodological) , 1–38.
and tensor network states,” Phys. Rev. B 97, 085104. Deng, Dong-Ling, Xiaopeng Li, and S Das Sarma (2017),
Chen, Jun-Jie, and Ming Xue (2019), “Manipulation of spin “Quantum entanglement in neural network states,” Physi-
dynamics by deep reinforcement learning agent,” arXiv cal Review X 7 (2), 021021.
preprint arXiv:1901.08748 . Dietterich, Thomas G, et al. (2000), “Ensemble methods in
Chen, Tianqi, and Carlos Guestrin (2016), “Xgboost: A scal- machine learning,” Multiple classifier systems 1857, 1–15.
able tree boosting system,” in Proceedings of the 22nd acm Do, Chuong B, and Serafim Batzoglou (2008), “What is the
sigkdd international conference on knowledge discovery and expectation maximization algorithm?” Nature biotechnol-
data mining (ACM) pp. 785–794. ogy 26 (8), 897–899.
Cheng, Song, Jing Chen, and Lei Wang (2017), “Information Domingos, Pedro (2012), “A few useful things to know about
perspective to probabilistic modeling: Boltzmann machines machine learning,” Communications of the ACM 55 (10),
versus born machines,” arXiv preprint arXiv:1712.04144 . 78–87.
Ch’ng, Kelvin, Nick Vazquez, and Ehsan Khatami Donoho, David L (2006), “Compressed sensing,” IEEE Trans-
(2017), “Unsupervised machine learning account of mag- actions on information theory 52 (4), 1289–1306.
netic transitions in the hubbard model,” arXiv preprint Dreyfus, Hubert L (1965), “Alchemy and artificial intelli-
arXiv:1708.03350 . gence,”.
Ciliberto, Carlo, Mark Herbster, Alessandro Davide Ialongo, Du, Simon S, Chi Jin, Jason D Lee, Michael I Jordan, Aarti
Massimiliano Pontil, Andrea Rocchetto, Simone Severini, Singh, and Barnabas Poczos (2017), “Gradient descent can
and Leonard Wossnig (2017), “Quantum machine learning: take exponential time to escape saddle points,” in Advances
a classical perspective,” . in Neural Information Processing Systems, pp. 1067–1077.
Cohen, Nadav, Or Sharir, and Amnon Shashua (2016), “On Duchi, John, Elad Hazan, and Yoram Singer (2011), “Adap-
110

tive subgradient methods for online learning and stochas- (2001), The elements of statistical learning, Vol. 1 (Springer
tic optimization,” Journal of Machine Learning Research series in statistics New York).
12 (Jul), 2121–2159. Friedman, Jerome H (2001), “Greedy function approximation:
Dunjko, Vedran, and Hans J Briegel (2017), “Machine learn- a gradient boosting machine,” Annals of statistics , 1189–
ing and artificial intelligence in the quantum domain,” 1232.
arXiv preprint arXiv:1709.02779 . Friedman, Jerome H (2002), “Stochastic gradient boosting,”
Dunjko, Vedran, Yi-Kai Liu, Xingyao Wu, and Jacob M Computational Statistics & Data Analysis 38 (4), 367–378.
Taylor (2017), “Super-polynomial and exponential im- Friedman, Jerome H, Bogdan E Popescu, et al. (2003), “Im-
provements for quantum-enhanced reinforcement learning,” portance sampled learning ensembles,” Journal of Machine
arXiv preprint arXiv:1710.11160 . Learning Research 94305.
Efron, B (1979), “Bootstrap methods: another look at the Fu, Michael C (2006), “Gradient estimation,” Handbooks in
jackknife annals of statistics 7: 1–26,” View Article Pub- operations research and management science 13, 575–616.
Med/NCBI Google Scholar. Funai, Shotaro Shiba, and Dimitrios Giataganas (2018),
Efron, Bradley, Trevor Hastie, Iain Johnstone, Robert Tib- “Thermodynamics and feature extraction by machine learn-
shirani, et al. (2004), “Least angle regression,” The Annals ing,” arXiv preprint arXiv:1810.08179 .
of statistics 32 (2), 407–499. Gao, Jun, Lu-Feng Qiao, Zhi-Qiang Jiao, Yue-Chi Ma, Cheng-
Eisen, Michael B, Paul T Spellman, Patrick O Brown, and Qiu Hu, Ruo-Jing Ren, Ai-Lin Yang, Hao Tang, Man-Hong
David Botstein (1998), “Cluster analysis and display of Yung, and Xian-Min Jin (2017), “Experimental machine
genome-wide expression patterns,” Proceedings of the Na- learning of quantum states with partial information,” arXiv
tional Academy of Sciences 95 (25), 14863–14868. preprint arXiv:1712.00456 .
Elith, Jane, Steven J Phillips, Trevor Hastie, Miroslav Dudík, Gao, Xun, and Lu-Ming Duan (2017), “Efficient representa-
Yung En Chee, and Colin J Yates (2011), “A statistical tion of quantum many-body states with deep neural net-
explanation of maxent for ecologists,” Diversity and distri- works,” arXiv preprint arXiv:1701.05039 .
butions 17 (1), 43–57. Gelman, Andrew, John B Carlin, Hal S Stern, David B Dun-
Ernst, Oliver K, Thomas Bartol, Terrence Sejnowski, and son, Aki Vehtari, and Donald B Rubin (2014), Bayesian
Eric Mjolsness (2018), “Learning dynamic boltzmann dis- data analysis, Vol. 2 (CRC press Boca Raton, FL).
tributions as reduced models of spatial chemical kinetics,” Gersho, Allen, and Robert M Gray (2012), Vector quantiza-
arXiv preprint arXiv:1803.01063 . tion and signal compression, Vol. 159 (Springer Science &
Ester, Martin, Hans-Peter Kriegel, Jörg Sander, Xiaowei Xu, Business Media).
et al. (1996), “A density-based algorithm for discovering Geurts, Pierre, Damien Ernst, and Louis Wehenkel (2006),
clusters in large spatial databases with noise.” in Kdd, “Extremely randomized trees,” Machine learning 63 (1),
Vol. 96, pp. 226–231. 3–42.
Faddeev, Ludvig D, and Victor N Popov (1967), “Feynman Glorot, Xavier, and Yoshua Bengio (2010), “Understanding
diagrams for the yang-mills field,” Physics Letters B 25 (1), the difficulty of training deep feedforward neural networks,”
29–30. in Proceedings of the Thirteenth International Conference
Finol, David, Yan Lu, Vijay Mahadevan, and Ankit on Artificial Intelligence and Statistics, pp. 249–256.
Srivastava (2018), “Deep convolutional neural networks Goldt, Sebastian, and Udo Seifert (2017), “Thermodynamic
for eigenvalue problems in mechanics,” arXiv preprint efficiency of learning a rule in neural networks,” arXiv
arXiv:1801.05733 . preprint arXiv:1706.09713 .
Fisher, Charles K, and Pankaj Mehta (2015a), “Bayesian fea- Goodfellow, Ian (2016), “Nips 2016 tutorial: Generative ad-
ture selection for high-dimensional linear regression via the versarial networks,” arXiv preprint arXiv:1701.00160.
ising approximation with applications to genomics,” Bioin- Goodfellow, Ian, Yoshua Bengio, and Aaron
formatics 31 (11), 1754–1761. Courville (2016), Deep Learning (MIT Press)
Fisher, Charles K, and Pankaj Mehta (2015b), “Bayesian http://www.deeplearningbook.org.
feature selection with strongly regularizing priors maps to Goodfellow, Ian, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu,
the ising model,” Neural computation 27 (11), 2411–2422. David Warde-Farley, Sherjil Ozair, Aaron Courville, and
Foreman, Sam, Joel Giedt, Yannick Meurice, and Judah Yoshua Bengio (2014), “Generative adversarial nets,” in Ad-
Unmuth-Yockey (2017), “Rg inspired machine learning for vances in neural information processing systems, pp. 2672–
lattice field theory,” arXiv preprint arXiv:1710.02079 . 2680.
Fösel, Thomas, Petru Tighineanu, Talitha Weiss, and Flo- Greplova, Eliska, Christian Kraglund Andersen, and Klaus
rian Marquardt (2018), “Reinforcement learning with neu- Mølmer (2017), “Quantum parameter estimation with a
ral networks for quantum feedback,” arXiv:1802.05267 . neural network,” arXiv preprint arXiv:1711.05238 .
Freitas, Nahuel, Giovanna Morigi, and Vedran Dun- Grisafi, Andrea, David M Wilkins, Gábor Csányi, and
jko (2018), “Neural network operations and susuki- Michele Ceriotti (2017), “Symmetry-adapted machine-
trotter evolution of neural network states,” arXiv preprint learning for tensorial properties of atomistic systems,”
arXiv:1803.02118 . arXiv preprint arXiv:1709.06757 .
Freund, Yoav, Robert Schapire, and Naoki Abe (1999), “A Han, Zhao-Yu, Jun Wang, Heng Fan, Lei Wang, and Pan
short introduction to boosting,” Journal-Japanese Society Zhang (2017), “Unsupervised generative modeling using
For Artificial Intelligence 14 (771-780), 1612. matrix product states,” arXiv preprint arXiv:1709.01662 .
Freund, Yoav, and Robert E Schapire (1995), “A desicion- He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun
theoretic generalization of on-line learning and an applica- (2015), “Delving deep into rectifiers: Surpassing human-
tion to boosting,” in European conference on computational level performance on imagenet classification,” in Proceed-
learning theory (Springer) pp. 23–37. ings of the IEEE international conference on computer vi-
Friedman, Jerome, Trevor Hastie, and Robert Tibshirani sion, pp. 1026–1034.
111

He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun free energy differences,” Physical Review Letters 78 (14),
(2016), “Deep residual learning for image recognition,” in 2690.
Proceedings of the IEEE conference on computer vision and Jaynes, Edwin T (1957a), “Information theory and statistical
pattern recognition, pp. 770–778. mechanics,” Physical review 106 (4), 620.
Heimel, Theo, Gregor Kasieczka, Tilman Plehn, and Jen- Jaynes, Edwin T (1957b), “Information theory and statistical
nifer M Thompson (2018), “Qcd or what?” arXiv preprint mechanics. ii,” Physical review 108 (2), 171.
arXiv:1808.08979 . Jaynes, Edwin T (1968), “Prior probabilities,” IEEE Trans-
Higgins, Irina, Loic Matthey, Arka Pal, Christopher Burgess, actions on systems science and cybernetics 4 (3), 227–241.
Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Jaynes, Edwin T (1996), Probability theory: the logic of sci-
Alexander Lerchner (2016), “beta-vae: Learning basic vi- ence (Washington University St. Louis, MO).
sual concepts with a constrained variational framework,” Jaynes, Edwin T (2003), Probability theory: the logic of sci-
. ence (Cambridge university press).
Hinton, Geoffrey E (2002), “Training products of experts by Jeffreys, Harold (1946), “An invariant form for the prior prob-
minimizing contrastive divergence,” Neural computation ability in estimation problems,” Proceedings of the Royal
14 (8), 1771–1800. Society of London. Series A, Mathematical and Physical
Hinton, Geoffrey E (2012), “A practical guide to training re- Sciences , 453–461.
stricted boltzmann machines,” in Neural networks: Tricks Jin, Chi, Praneeth Netrapalli, and Michael I Jordan (2017),
of the trade (Springer) pp. 599–619. “Accelerated gradient descent escapes saddle points faster
Hinton, Geoffrey E, Simon Osindero, and Yee-Whye Teh than gradient descent,” arXiv preprint arXiv:1711.10456.
(2006), “A fast learning algorithm for deep belief nets,” Jordan, Michael (2018), “Artificial intelligence: The revolu-
Neural computation 18 (7), 1527–1554. tion hasnâĂŹt happened yet. medium,”.
Hinton, Geoffrey E, and Ruslan R Salakhutdinov (2006), “Re- Jordan, Michael I, Zoubin Ghahramani, Tommi S Jaakkola,
ducing the dimensionality of data with neural networks,” and Lawrence K Saul (1999), “An introduction to vari-
science 313 (5786), 504–507. ational methods for graphical models,” Machine learning
Ho, Tin Kam (1998), “The random subspace method for con- 37 (2), 183–233.
structing decision forests,” IEEE transactions on pattern Kalantre, Sandesh S, Justyna P Zwolak, Stephen Ragole,
analysis and machine intelligence 20 (8), 832–844. Xingyao Wu, Neil M Zimmerman, MD Stewart, and Ja-
Hopfield, John J (1982), “Neural networks and physical sys- cob M Taylor (2017), “Machine learning techniques for
tems with emergent collective computational abilities,” state recognition and auto-tuning in quantum dots,” arXiv
Proceedings of the national academy of sciences 79 (8), preprint arXiv:1712.04914 .
2554–2558. Katz, Yarden (2017), “Manufacturing an artificial intelligence
Huang, Haiping (2017a), “Mean-field theory of input dimen- revolution,” SSRN Preprint .
sionality reduction in unsupervised deep neural networks,” Kerenidis, Iordanis, and Anupam Prakash (2017), “Quan-
arXiv preprint arXiv:1710.01467 . tum gradient descent for linear systems and least squares,”
Huang, Haiping (2017b), “Statistical mechanics of unsuper- arXiv preprint arXiv:1704.04992 .
vised feature learning in a restricted boltzmann machine Keskar, Nitish Shirish, Dheevatsa Mudigere, Jorge Nocedal,
with binary synapses,” Journal of Statistical Mechanics: Mikhail Smelyanskiy, and Ping Tak Peter Tang (2016),
Theory and Experiment 2017 (5), 053302. “On large-batch training for deep learning: Generalization
Huang, Hengfeng, Bowen Xiao, Huixin Xiong, Zeming Wu, gap and sharp minima,” arXiv preprint arXiv:1609.04836.
Yadong Mu, and Huichao Song (2018), “Applications Kingma, Diederik P, and Jimmy Ba (2014), “Adam:
of deep learning to relativistic hydrodynamics,” arXiv A method for stochastic optimization,” arXiv preprint
preprint arXiv:1801.03334 . arXiv:1412.6980.
Hubbard, J (1959), “Calculation of partition functions,” Phys- Kingma, Diederik P, and Max Welling (2013),
ical Review Letters 3 (2), 77. “Auto-encoding variational bayes,” arXiv preprint
Huggins, William, Piyush Patil, Bradley Mitchell, K Birgitta arXiv:1312.6114.
Whaley, and E Miles Stoudenmire (2019), “Towards quan- Kingma, DP, et al. (2017), “Variational inference & deep
tum machine learning with tensor networks,” Quantum Sci- learning,” PhD thesis 978-94-6299-745-5.
ence and Technology 4 (2), 024001. Kleijnen, Jack PC, and Reuven Y Rubinstein (1996), “Op-
Iakovlev, I A, O. M. Sotnikov, and V. V. Mazurenko timization and sensitivity analysis of computer simulation
(2018), “Supervised learning magnetic skyrmion phases,” models by the score function method,” European Journal
arXiv:1803.06682 . of Operational Research 88 (3), 413–427.
Innocenti, Luca, Leonardo Banchi, Alessandro Ferraro, Kleinberg, Jon, Sendhil Mullainathan, and Manish Raghavan
Sougato Bose, and Mauro Paternostro (2018), “Supervised (2016), “Inherent trade-offs in the fair determination of risk
learning of time-independent hamiltonians for gate design,” scores,” arXiv preprint arXiv:1609.05807.
arXiv:1803.07119 . Koch-Janusz, Maciej, and Zohar Ringel (2017), “Mutual in-
Ioffe, Sergey, and Christian Szegedy (2015), “Batch normal- formation, neural networks and the renormalization group,”
ization: Accelerating deep network training by reducing in- arXiv preprint arXiv:1704.06279 .
ternal covariate shift,” in International Conference on Ma- Kohonen, Teuvo (1998), “The self-organizing map,” Neuro-
chine Learning, pp. 448–456. computing 21 (1-3), 1–6.
Iso, Satoshi, Shotaro Shiba, and Sumito Yokoo (2018), Kong, Qingkai, Daniel T. Trugman, Zachary E. Ross,
“Scale-invariant feature extraction of neural net- Michael J. Bianco, Brendan J. Meade, and Peter Ger-
work and renormalization group flow,” arXiv preprint stoft (2018), “Machine learning in seismology: Turn-
arXiv:1801.07172 . ing data into insights,” Seismological Research Letters
Jarzynski, Christopher (1997), “Nonequilibrium equality for 10.1785/0220180259.
112

Krastanov, Stefan, and Liang Jiang (2017), “Deep neural tion space of deep-learning machines,” arXiv preprint
network probabilistic decoder for stabilizer codes,” arXiv arXiv:1708.01422 .
preprint arXiv:1705.09334 . Li, Chian-De, Deng-Ruei Tan, and Fu-Jiun Jiang (2017),
Kriegel, Hans-Peter, Peer Kröger, and Arthur Zimek (2009), “Applications of neural networks to the studies of
“Clustering high-dimensional data: A survey on subspace phase transitions of two-dimensional potts models,” arXiv
clustering, pattern-based clustering, and correlation clus- preprint arXiv:1703.02369 .
tering,” ACM Transactions on Knowledge Discovery from Li, Richard Y, Rosa Di Felice, Remo Rohs, and Daniel A
Data (TKDD) 3 (1), 1. Lidar (2018), “Quantum annealing versus classical ma-
Krizhevsky, Alex, Ilya Sutskever, and Geoffrey E Hinton chine learning applied to a simplified computational biology
(2012), “Imagenet classification with deep convolutional problem,” npj Quantum Information 4 (1), 14.
neural networks,” in Advances in neural information pro- Li, Shuo-Hui, and Lei Wang (2018), “Neural network renor-
cessing systems, pp. 1097–1105. malization group,” arXiv preprint arXiv:1802.02840 .
Krzakala, Florent, Andre Manoel, Eric W Tramel, and Lenka Lim, Tjen-Sien, Wei-Yin Loh, and Yu-Shan Shih (2000), “A
Zdeborová (2014), “Variational free energies for compressed comparison of prediction accuracy, complexity, and train-
sensing,” in Information Theory (ISIT), 2014 IEEE Inter- ing time of thirty-three old and new classification algo-
national Symposium on (IEEE) pp. 1499–1503. rithms,” Machine learning 40 (3), 203–228.
Krzakala, Florent, Marc Mézard, François Sausset, YF Sun, Lin, Henry W, Max Tegmark, and David Rolnick (2017),
and Lenka Zdeborová (2012a), “Statistical-physics-based “Why does deep and cheap learning work so well?” Journal
reconstruction in compressed sensing,” Physical Review X of Statistical Physics 168 (6), 1223–1247.
2 (2), 021005. Linderman, G C, M. Rachh, J. G. Hoskins, S. Steiner-
Krzakala, Florent, Marc Mézard, Francois Sausset, Yifan Sun, berger, and Y. Kluger (2017), “Efficient Algorithms for
and Lenka Zdeborová (2012b), “Probabilistic reconstruc- t-distributed Stochastic Neighborhood Embedding,” ArXiv
tion in compressed sensing: algorithms, phase diagrams, e-prints arXiv:1712.09005 [cs.LG].
and threshold achieving matrices,” Journal of Statistical Liu, Zhaocheng, Sean P Rodrigues, and Wenshan Cai
Mechanics: Theory and Experiment 2012 (08), P08009. (2017), “Simulating the ising model with a deep convo-
Lake, Brenden M, Tomer D Ullman, Joshua B Tenenbaum, lutional generative adversarial network,” arXiv preprint
and Samuel J Gershman (2017), “Building machines that arXiv:1710.04987 .
learn and think like people,” Behavioral and Brain Sciences Loh, Wei-Yin (2011), “Classification and regression trees,”
40. Wiley Interdisciplinary Reviews: Data Mining and Knowl-
Lamata, Lucas (2017), “Basic protocols in quantum reinforce- edge Discovery 1 (1), 14–23.
ment learning with superconducting circuits,” Scientific Re- Louppe, Gilles (2014), “Understanding random forests: From
ports 7. theory to practice,” arXiv preprint arXiv:1407.7502.
Larsen, Bjornar, and Chinatsu Aone (1999), “Fast and effec- Lu, Sirui, Shilin Huang, Keren Li, Jun Li, Jianxin Chen,
tive text mining using linear-time document clustering,” in Dawei Lu, Zhengfeng Ji, Yi Shen, Duanlu Zhou, and
Proceedings of the fifth ACM SIGKDD international con- Bei Zeng (2017), “A separability-entanglement classifier via
ference on Knowledge discovery and data mining (ACM) machine learning,” arXiv preprint arXiv:1705.01523 .
pp. 16–22. Maaten, Laurens van der, and Geoffrey Hinton (2008), “Vi-
Le, Quoc V (2013), “Building high-level features using large sualizing data using t-sne,” Journal of machine learning re-
scale unsupervised learning,” in Acoustics, Speech and Sig- search 9 (Nov), 2579–2605.
nal Processing (ICASSP), 2013 IEEE International Con- MacKay, David JC (2003), Information theory, inference and
ference on (IEEE) pp. 8595–8598. learning algorithms (Cambridge university press).
LeCun, Yann, Yoshua Bengio, et al. (1995), “Convolutional Marsland III, Robert, Wenping Cui, and Pankaj Mehta
networks for images, speech, and time series,” The hand- (2019), “The Minimum Environmental Perturbation Prin-
book of brain theory and neural networks 3361 (10), 1995. ciple: A New Perspective on Niche Theory,” arXiv preprint
LeCun, Yann, Léon Bottou, Yoshua Bengio, and Patrick arXiv:1901.09673 .
Haffner (1998a), “Gradient-based learning applied to docu- Maskara, Nishad, Aleksander Kubica, and Tomas
ment recognition,” Proceedings of the IEEE 86 (11), 2278– Jochym-O’Connor (2018), “Advantages of versatile neural-
2324. network decoding for topological codes,” arXiv preprint
LeCun, Yann, Léon Bottou, Genevieve B Orr, and Klaus- arXiv:1802.08680 .
Robert Müller (1998b), “Efficient backprop,” in Neural net- Masson, JB, M Bailly Bechet, and Massimo Vergassola
works: Tricks of the trade (Springer) pp. 9–50. (2009), “Chasing information to search in random environ-
Lee, Jason D, Ioannis Panageas, Georgios Piliouras, Max Sim- ments,” Journal of Physics A: Mathematical and Theoret-
chowitz, Michael I Jordan, and Benjamin Recht (2017), ical 42 (43), 434009.
“First-order methods almost always avoid saddle points,” Mattingly, Henry H, Mark K Transtrum, Michael C Abbott,
arXiv preprint arXiv:1710.07406. and Benjamin B Machta (2018), “Maximizing the infor-
Lehmann, Erich L, and George Casella (2006), Theory of mation learned from finite data selects a simple model,”
point estimation (Springer Science & Business Media). Proceedings of the National Academy of Sciences 115 (8),
Lehmann, Erich L, and Joseph P Romano (2006), Testing 1760–1765.
statistical hypotheses (Springer Science & Business Media). McDermott, Drew, M Mitchell Waldrop, B Chandrasekaran,
Levine, Yoav, David Yakira, Nadav Cohen, and Amnon John McDermott, and Roger Schank (1985), “The dark
Shashua (2017), “Deep learning and quantum entangle- ages of ai: a panel discussion at aaai-84,” AI Magazine
ment: Fundamental connections with implications to net- 6 (3), 122.
work design.” arXiv preprint arXiv:1704.01552 . McInnes, Leland, John Healy, and James Melville
Li, Bo, and David Saad (2017), “Exploring the func- (2018), “UMAP: Uniform Manifold Approximation and
113

Projection for Dimension Reduction,” arXiv e-prints , 261.


arXiv:1802.03426arXiv:1802.03426 [stat.ML]. Nielsen, Michael A (2015), Neural networks and deep learning
Mehta, Pankaj (2015), “Big data’s radical potential, (Determination Press).
https://www.jacobinmag.com/2015/03/big-data-drones- van Nieuwenburg, Evert, Eyal Bairey, and Gil Refael (2017a),
privacy-workers,” Jacobin . “Learning phase transitions from dynamics,” arXiv preprint
Mehta, Pankaj, and David J Schwab (2014), “An exact map- arXiv:1712.00450 .
ping between the variational renormalization group and van Nieuwenburg, Evert PL, Ye-Hua Liu, and Sebastian D
deep learning,” arXiv preprint arXiv:1410.3831. Huber (2017b), “Learning phase transitions by confusion,”
Mehta, Pankaj, David J Schwab, and Anirvan M Sengupta Nature Physics 13 (5), 435.
(2011), “Statistical mechanics of transcription-factor bind- Niu, Murphy Yuezhen, Sergio Boixo, Vadim Smelyanskiy,
ing site discovery using hidden markov models,” Journal of and Hartmut Neven (2018), “Universal quantum con-
statistical physics 142 (6), 1187–1205. trol through deep reinforcement learning,” arXiv preprint
Melnikov, Alexey A, Hendrik Poulsen Nautrup, Mario Krenn, arXiv:1803.01857 .
Vedran Dunjko, Markus Tiersch, Anton Zeilinger, and Nomura, Yusuke, Andrew Darmawan, Youhei Yamaji, and
Hans J Briegel (2017), “Active learning machine learns Masatoshi Imada (2017), “Restricted-boltzmann-machine
to create new quantum experiments,” arXiv preprint learning for solving strongly correlated quantum systems,”
arXiv:1706.00868 . arXiv preprint arXiv:1709.06475 .
Metz, Cade (2017), “Move over, coders- Ohtsuki, Tomi, and Tomoki Ohtsuki (2017), “Deep learning
physicists will soon rule silicon valley,” the quantum phase transitions in random electron systems:
Https://deepmind.com/blog/deepmind-ai-reduces-google- Applications to three dimensions,” Journal of the Physical
data-centre-cooling-bill-40/. Society of Japan 86 (4), 044708.
Mezard, Marc, and Andrea Montanari (2009), Information, O’Neil, Cathy (2017), Weapons of math destruction: How big
physics, and computation (Oxford University Press). data increases inequality and threatens democracy (Broad-
Mhaskar, Hrushikesh, Qianli Liao, and Tomaso Poggio way Books).
(2016), “Learning functions: when is deep better than shal- Papanikolaou, Stefanos, Michail Tzimas, Hengxu Song, An-
low,” arXiv preprint arXiv:1603.00988. drew CE Reid, and Stephen A Langer (2017), “Learning
Mitarai, Kosuke, Makoto Negoro, Masahiro Kitagawa, and crystal plasticity using digital image correlation: Exam-
Keisuke Fujii (2018), “Quantum circuit learning,” arXiv ples from discrete dislocation dynamics,” arXiv preprint
preprint arXiv:1803.00745 . arXiv:1709.08225 .
Mnih, Volodymyr, Koray Kavukcuoglu, David Silver, An- Pedregosa, F, G. Varoquaux, A. Gramfort, V. Michel,
drei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer,
Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cour-
et al. (2015), “Human-level control through deep reinforce- napeau, M. Brucher, M. Perrot, and E. Duchesnay (2011),
ment learning,” Nature 518 (7540), 529. “Scikit-learn: Machine learning in Python,” Journal of Ma-
Morningstar, Alan, and Roger G Melko (2017), “Deep chine Learning Research 12, 2825–2830.
learning the ising model near criticality,” arXiv preprint Perdomo-Ortiz, Alejandro, Marcello Benedetti, John Realpe-
arXiv:1708.04622 . Gómez, and Rupak Biswas (2017), “Opportunities
Muehlhauser, Luke (2016), “What should we learn from past and challenges for quantum-assisted machine learn-
ai forecasts?” Open Philanthropy Website . ing in near-term quantum computers,” arXiv preprint
Müllner, Daniel (2011), “Modern hierarchical, agglomerative arXiv:1708.09757 .
clustering algorithms,” arXiv preprint arXiv:1109.2378 . Polyak, Boris T (1964), “Some methods of speeding up the
Murphy, Kevin (2012), Machine Learning: A Probabilistic convergence of iteration methods,” USSR Computational
Perspective (MIT press). Mathematics and Mathematical Physics 4 (5), 1–17.
Nagai, Yuki, Huitao Shen, Yang Qi, Junwei Liu, and Liang Qian, Ning (1999), “On the momentum term in gradient de-
Fu (2017), “Self-learning monte carlo method: Continuous- scent learning algorithms,” Neural networks 12 (1), 145–
time algorithm,” arXiv preprint arXiv:1705.06724 . 151.
Neal, Radford M (2001), “Annealed importance sampling,” Rabiner, Lawrence R (1989), “A tutorial on hidden markov
Statistics and computing 11 (2), 125–139. models and selected applications in speech recognition,”
Neal, Radford M, and Geoffrey E Hinton (1998), “A view Proceedings of the IEEE 77 (2), 257–286.
of the em algorithm that justifies incremental, sparse, and Radford, Alec, Luke Metz, and Soumith Chintala (2015),
other variants,” in Learning in graphical models (Springer) “Unsupervised representation learning with deep convo-
pp. 355–368. lutional generative adversarial networks,” arXiv preprint
Neal, Radford M, et al. (2011), “Mcmc using hamiltonian dy- arXiv:1511.06434.
namics,” Handbook of Markov Chain Monte Carlo 2 (11). Ramezanali, Mohammad, Partha P Mitra, and Anirvan M
Nesterov, Yurii (1983), “A method of solving a convex pro- Sengupta (2015), “Critical behavior and universality classes
gramming problem with convergence rate o (1/k2),” in So- for an algorithmic phase transition in sparse reconstruc-
viet Mathematics Doklady, Vol. 27, pp. 372–376. tion,” arXiv preprint arXiv:1509.08995.
Neukart, Florian, David Von Dollen, Christian Seidel, and Ramezanpour, A (2017), “Optimization by a quantum rein-
Gabriele Compostella (2017), “Quantum-enhanced rein- forcement algorithm,” Phys. Rev. A 96, 052307.
forcement learning for finite-episode games with discrete Rao, Wen-Jia, Zhenyu Li, Qiong Zhu, Mingxing Luo, and
state spaces,” arXiv preprint arXiv:1708.09354 . Xin Wan (2017), “Identifying product order with restricted
Nguyen, H Chau, Riccardo Zecchina, and Johannes Berg boltzmann machines,” arXiv preprint arXiv:1709.02597 .
(2017), “Inverse statistical problems: from the inverse ising Ravanbakhsh, Siamak, Francois Lanusse, Rachel Mandel-
problem to data science,” Advances in Physics 66 (3), 197– baum, Jeff G Schneider, and Barnabas Poczos (2017), “En-
114

abling dark energy science with deep generative models of Xu (1998), “Density-based clustering in spatial databases:
galaxy images.” in AAAI, pp. 1488–1494. The algorithm gdbscan and its applications,” Data mining
Rebentrost, Patrick, Thomas R. Bromley, Christian Weed- and knowledge discovery 2 (2), 169–194.
brook, and Seth Lloyd (2017), “A quantum hopfield neural Saxe, Andrew M, James L McClelland, and Surya Gan-
network,” arXiv:1710.03599 . guli (2013), “Exact solutions to the nonlinear dynamics of
Rebentrost, Patrick, Maria Schuld, Francesco Petruccione, learning in deep linear neural networks,” arXiv preprint
and Seth Lloyd (2016), “Quantum gradient descent and arXiv:1312.6120.
newton’s method for constrained polynomial optimization,” Schapire, Robert E, and Yoav Freund (2012), Boosting:
arXiv preprint arXiv:1612.01789 . Foundations and algorithms (MIT press).
Reddy, Gautam, Antonio Celani, Terrence J Sejnowski, and Schindler, Frank, Nicolas Regnault, and Titus Neupert
Massimo Vergassola (2016a), “Learning to soar in turbu- (2017), “Probing many-body localization with neural net-
lent environments,” Proceedings of the National Academy works,” Phys. Rev. B 95, 245134.
of Sciences 113 (33), E4877–E4884. Schmidhuber, Jürgen (2015), “Deep learning in neural net-
Reddy, Gautam, Antonio Celani, and Massimo Vergassola works: An overview,” Neural networks 61, 85–117.
(2016b), “Infomax strategies for an optimal balance be- Schneidman, Elad, Michael J Berry II, Ronen Segev, and
tween exploration and exploitation,” Journal of Statistical William Bialek (2006), “Weak pairwise correlations imply
Physics 163 (6), 1454–1476. strongly correlated network states in a neural population,”
Rem, Benno S, Niklas Käming, Matthias Tarnowski, Luca Nature 440 (7087), 1007.
Asteria, Nick Fläschner, Christoph Becker, Klaus Seng- Schoenholz, Samuel S (2017), “Combining machine learning
stock, and Christof Weitenberg (2018), “Identifying quan- and physics to understand glassy systems,” arXiv preprint
tum phase transitions using artificial neural networks on arXiv:1709.08015 .
experimental data,” arXiv preprint arXiv:1809.05519 . Schuld, Maria, Mark Fingerhuth, and Francesco Petruc-
Rezende, Danilo Jimenez, Shakir Mohamed, and Daan cione (2017), “Implementing a distance-based classifier
Wierstra (2014), “Stochastic backpropagation and approx- with a quantum interference circuit,” arXiv preprint
imate inference in deep generative models,” arXiv preprint arXiv:1703.10793 .
arXiv:1401.4082. Schuld, Maria, and Nathan Killoran (2018), “Quantum ma-
Rocchetto, Andrea, Scott Aaronson, Simone Severini, Gon- chine learning in feature hilbert spaces,” arXiv:1803.07128
zalo Carvacho, Davide Poderini, Iris Agresti, Marco Ben- .
tivegna, and Fabio Sciarrino (2017), “Experimental learn- Schuld, Maria, and Francesco Petruccione (2017), “Quan-
ing of quantum states,” arXiv preprint arXiv:1712.00127 tum ensembles of quantum classifiers,” arXiv preprint
. arXiv:1704.02146 .
Rocchetto, Andrea, Edward Grant, Sergii Strelchuk, Schuld, Maria, Ilya Sinayskiy, and Francesco Petruccione
Giuseppe Carleo, and Simone Severini (2018), “Learn- (2015), “An introduction to quantum machine learning,”
ing hard quantum distributions with variational autoen- Contemporary Physics 56 (2), 172–185.
coders,” npj Quantum Information 4 (1), 28. Schwab, David J, Ilya Nemenman, and Pankaj Mehta (2014),
Rockafellar, Ralph Tyrell (2015), Convex analysis (Princeton Physical review letters 113 (6), 068102.
university press). Sethna, James (2006), Statistical mechanics: entropy, or-
Rodriguez, Alex, and Alessandro Laio (2014), “Clustering by der parameters, and complexity, Vol. 14 (Oxford University
fast search and find of density peaks,” Science 344 (6191), Press).
1492–1496. Shanahan, Phiala E, Daniel Trewartha, and William
Rokach, Lior, and Oded Maimon (2005), “Clustering meth- Detmold (2018), “Machine learning action parameters
ods,” in Data mining and knowledge discovery handbook in lattice quantum chromodynamics,” arXiv preprint
(Springer) pp. 321–352. arXiv:1801.05784 .
Roweis, Sam T, and Lawrence K Saul (2000), “Nonlinear Shannon, Claude E (1949), “Communication theory of secrecy
dimensionality reduction by locally linear embedding,” sci- systems,” Bell Labs Technical Journal 28 (4), 656–715.
ence 290 (5500), 2323–2326. Shen, Huitao, Junwei Liu, and Liang Fu (2018), “Self-learning
Rudelius, Tom (2018), “Learning to inflate,” arXiv preprint monte carlo with deep neural networks,” arXiv preprint
arXiv:1810.05159 . arXiv:1801.01127 .
Ruder, Sebastian (2016), “An overview of gradient descent Shinjo, Kazuya, Shigetoshi Sota, Seiji Yunoki, and
optimization algorithms,” arXiv preprint arXiv:1609.04747 Takami Tohyama (2019), “Characterization of photoex-
. cited states in the half-filled one-dimensional extended hub-
Rumelhart, David E, and David Zipser (1985), “Feature dis- bard model assisted by machine learning,” arXiv preprint
covery by competitive learning,” Cognitive science 9 (1), arXiv:1901.07900 .
75–112. Shlens, Jonathon (2014), “A tutorial on principal component
Ruscher, Céline, and Jörg Rottler (2018), “Correlations in analysis,” arXiv preprint arXiv:1404.1100.
the shear flow of athermal amorphous solids: A principal Shwartz-Ziv, Ravid, and Naftali Tishby (2017), “Opening the
component analysis,” arXiv preprint arXiv:1809.06487 . black box of deep neural networks via information,” arXiv
Saito, Hiroki, and Masaya Kato (2017), “Machine learning preprint arXiv:1703.00810.
technique to find quantum many-body ground states of Sidky, Hythem, and Jonathan K Whitmer (2017), “Learn-
bosons on a lattice,” arXiv preprint arXiv:1709.05468 . ing free energy landscapes using artificial neural networks,”
Salazar, Domingos SP (2017), “Nonequilibrium thermody- arXiv preprint arXiv:1712.02840 .
namics of restricted boltzmann machines,” arXiv preprint Simonite, Tom (2018), “Should data scientist adhere to a hip-
arXiv:1704.08724 . pocratic oath?” Wired .
Sander, Jörg, Martin Ester, Hans-Peter Kriegel, and Xiaowei Singh, Kesar (1981), “On the asymptotic accuracy of efron’s
115

bootstrap,” The Annals of Statistics , 1187–1195. Tenenbaum, Joshua B, Vin De Silva, and John C Langford
Slonim, Noam, Gurinder S Atwal, Gasper Tkacik, and (2000), “A global geometric framework for nonlinear dimen-
William Bialek (2005), “Estimating mutual information sionality reduction,” science 290 (5500), 2319–2323.
and multi–information in large networks,” arXiv preprint Tibshirani, Ryan J, et al. (2013), “The lasso problem and
cs/0502017. uniqueness,” Electronic Journal of Statistics 7, 1456–1490.
Sønderby, Casper Kaae, Tapani Raiko, Lars Maaløe, Tieleman, Tijmen, and Geoffrey Hinton (2009), “Using fast
Søren Kaae Sønderby, and Ole Winther (2016), “Ladder weights to improve persistent contrastive divergence,” in
variational autoencoders,” in Advances in neural informa- Proceedings of the 26th Annual International Conference
tion processing systems, pp. 3738–3746. on Machine Learning (ACM) pp. 1033–1040.
Springenberg, Jost Tobias, Alexey Dosovitskiy, Thomas Brox, Tieleman, Tijmen, and Geoffrey Hinton (2012), “Lecture 6.5-
and Martin Riedmiller (2014), “Striving for simplicity: The rmsprop: Divide the gradient by a running average of its
all convolutional net,” arXiv preprint arXiv:1412.6806. recent magnitude,” COURSERA: Neural networks for ma-
Sriarunothai, Theeraphot, Sabine Wölk, Gouri Shankar Giri, chine learning 4 (2), 26–31.
Nicolai Fries, Vedran Dunjko, Hans J Briegel, and Christof Tishby, Naftali, Fernando C Pereira, and William Bialek
Wunderlich (2017), “Speeding-up the decision making of a (2000), “The information bottleneck method,” arXiv
learning agent using an ion trap quantum processor,” arXiv preprint physics/0004057.
preprint arXiv:1709.01366 . Tomczak, P, and H. Puszkarski (2018), “Ferromagnetic res-
Srivastava, Nitish, Geoffrey E Hinton, Alex Krizhevsky, Ilya onance in thin films studied via cross-validation of numer-
Sutskever, and Ruslan Salakhutdinov (2014), “Dropout: a ical solutions of the smit-beljers equation: Application to
simple way to prevent neural networks from overfitting.” (ga,mn)as,” Phys. Rev. B 98, 144415.
Journal of machine learning research 15 (1), 1929–1958. Torgerson, Warren S (1958), “Theory and methods of scaling.”
Stoudenmire, E Miles (2018), “Learning relevant features .
of data with multi-scale tensor networks,” arXiv preprint Torlai, Giacomo, Guglielmo Mazzola, Juan Carrasquilla,
arXiv:1801.00315 . Matthias Troyer, Roger Melko, and Giuseppe Carleo
Stoudenmire, E Miles, and David J Schwab (2016), “Super- (2018), “Neural-network quantum state tomography,” Na-
vised learning with tensor networks,” in Advances in Neural ture Physics 14 (5), 447.
Information Processing Systems, pp. 4799–4807. Torlai, Giacomo, and Roger G. Melko (2017), “Neural de-
Stoudenmire, EM, and Steven R White (2012), “Studying coder for topological codes,” Phys. Rev. Lett. 119, 030501.
two-dimensional systems with the density matrix renormal- Tramel, Eric W, Marylou Gabrié, Andre Manoel, Francesco
ization group,” Annu. Rev. Condens. Matter Phys. 3 (1), Caltagirone, and Florent Krzakala (2017), “A determin-
111–128. istic and generalized framework for unsupervised learn-
Stratonovich, RL (1957), “On a method of calculating quan- ing with restricted boltzmann machines,” arXiv preprint
tum distribution functions,” in Soviet Physics Doklady, arXiv:1702.03260 .
Vol. 2, p. 416. Tubiana, Jérôme, and Rémi Monasson (2017), “Emergence
Strouse, DJ, and David J Schwab (2017), “The deterministic of compositional representations in restricted boltzmann
information bottleneck,” Neural computation 29 (6), 1611– machines,” Physical Review Letters 118 (13), 138301.
1630. Van Der Maaten, Laurens (2014), “Accelerating t-sne using
Suchsland, Philippe, and Stefan Wessel (2018), “Parameter tree-based algorithms,” The Journal of Machine Learning
diagnostics of phases and phase transition learning by neu- Research 15 (1), 3221–3245.
ral networks,” arXiv preprint arXiv:1802.09876 . Venderley, Jordan, Vedika Khemani, and Eun-Ah Kim
Sutskever, Ilya, James Martens, George Dahl, and Geoffrey (2017), “Machine learning out-of-equilibrium phases of
Hinton (2013), “On the importance of initialization and matter,” arXiv preprint arXiv:1711.00020 .
momentum in deep learning,” in International conference Vergassola, Massimo, Emmanuel Villermaux, and Boris I
on machine learning, pp. 1139–1147. Shraiman (2007), Nature 445 (7126), 406.
Sutton, Richard S, and Andrew G Barto (1998), Reinforce- Vidal, Guifre (2007), “Entanglement renormalization,” Phys-
ment learning: An introduction, Vol. 1 (MIT press Cam- ical review letters 99 (22), 220405.
bridge). Wainwright, Martin J, Michael I Jordan, et al. (2008),
Swaddle, Michael, Lyle Noakes, Liam Salter, Harry Small- “Graphical models, exponential families, and variational in-
bone, and Jingbo Wang (2017), “Generating 3 qubit ference,” Foundations and Trends® in Machine Learning
quantum circuits with neural networks,” arXiv preprint 1 (1–2), 1–305.
arXiv:1703.10743 . Wang, Ce, and Hui Zhai (2017), “Unsupervised learning stud-
Sweke, Ryan, Markus S Kesselring, Evert PL van Nieuwen- ies of frustrated classical spin models i: Principle compo-
burg, and Jens Eisert (2018), “Reinforcement learning nent analysis,” arXiv preprint arXiv:1706.07977 .
decoders for fault-tolerant quantum computation,” arXiv Wang, Ce, and Hui Zhai (2018), “Machine learning of frus-
preprint arXiv:1810.07207 . trated classical spin models. ii. kernel principal component
Székely, GJ (2003), “E-statistics: The energy of statistical analysis,” arXiv preprint arXiv:1803.01205 .
samples,” Bowling Green State University, Department of Wang, Lei (2017), “Can boltzmann machines discover cluster
Mathematics and Statistics Technical Report 3 (05), 1–18. updates?” arXiv preprint arXiv:1702.08586 .
Tanaka, Akinori, and Akio Tomiya (2017a), “Detection of Wang, Yi-Nan, and Zhibai Zhang (2018), “Learning non-
phase transition via convolutional neural networks,” Jour- higgsable gauge groups in 4d f-theory,” arXiv preprint
nal of the Physical Society of Japan 86 (6), 063001. arXiv:1804.07296 .
Tanaka, Akinori, and Akio Tomiya (2017b), “Towards reduc- Wasserman, Larry (2013), All of statistics: a concise course in
tion of autocorrelation in hmc by machine learning,” arXiv statistical inference (Springer Science & Business Media).
preprint arXiv:1712.03893 . Wattenberg, Martin, Fernanda Viégas, and Ian Johnson
116

(2016), “How to use t-sne effectively,” Distill 1 (10), e2. robust control of single-triplet qubits,” arXiv preprint
Wei, Qianshi, Roger G Melko, and Jeff ZY Chen (2017), arXiv:1708.00238 .
“Identifying polymer states by machine learning,” Physical Yedidia, Jonathan (2001), “An idiosyncratic journey beyond
Review E 95 (3), 032504. mean field theory,” Advanced mean field methods: Theory
Weigt, Martin, Robert A White, Hendrik Szurmant, James A and practice , 21–36.
Hoch, and Terence Hwa (2009), “Identification of direct Yedidia, Jonathan S, William T Freeman, and Yair Weiss
residue contacts in protein–protein interaction by message (2003), “Understanding belief propagation and its general-
passing,” Proceedings of the National Academy of Sciences izations,” Morgan Kaufmann Publishers Inc. San Francisco,
106 (1), 67–72. CA, USA .
Weinstein, Steven (2017), “Learning the einstein-podolsky- Yoshioka, Nobuyuki, Yutaka Akagi, and Hosho Katsura
rosen correlations on a restricted boltzmann machine,” (2017), “Learning disordered topological phases by statisti-
arXiv preprint arXiv:1707.03114 . cal recovery of symmetry,” arXiv preprint arXiv:1709.05790
Wetzel, Sebastian Johann (2017), “Unsupervised learning of .
phase transitions: from principle component analysis to You, Yi-Zhuang, Zhao Yang, and Xiao-Liang Qi (2017),
variational autoencoders,” arXiv preprint arXiv:1703.02435 “Machine learning spatial geometry from entanglement fea-
. tures,” arXiv preprint arXiv:1709.01223 .
Wetzel, Sebastian Johann, and Manuel Scherzer (2017), Yu, Chao-Hua, Fei Gao, and Qiao-Yan Wen (2017),
“Machine learning of explicit order parameters: From the “Quantum algorithms for ridge regression,” arXiv preprint
ising model to SU (2) lattice gauge theory,” arXiv preprint arXiv:1707.09524 .
arXiv:1705.05582 . Zdeborová, Lenka, and Florent Krzakala (2016), “Statistical
White, Steven R (1992), “Density matrix formulation for physics of inference: Thresholds and algorithms,” Advances
quantum renormalization groups,” Physical review letters in Physics 65 (5), 453–552.
69 (19), 2863. Zeiler, Matthew D (2012), “Adadelta: an adaptive learning
White, Tom (2016), “Sampling generative networks: rate method,” arXiv preprint arXiv:1212.5701.
Notes on a few effective techniques,” arXiv preprint Zhang, Chengxian, and Xin Wang (2018), “Spin-qubit noise
arXiv:1609.04468. spectroscopy from randomized benchmarking by supervised
Williams, DRGHR, and Geoffrey Hinton (1986), “Learn- learning,” arXiv preprint arXiv:1810.07914 .
ing representations by back-propagating errors,” Nature Zhang, Chiyuan, Samy Bengio, Moritz Hardt, Benjamin
323 (6088), 533–538. Recht, and Oriol Vinyals (2016), “Understanding deep
Wilson, Ashia C, Rebecca Roelofs, Mitchell Stern, Nathan learning requires rethinking generalization,” arXiv preprint
Srebro, and Benjamin Recht (2017), “The marginal value arXiv:1611.03530.
of adaptive gradient methods in machine learning,” arXiv Zhang, Pengfei, Huitao Shen, and Hui Zhai (2017a), “Ma-
preprint arXiv:1705.08292. chine learning topological invariants with neural networks,”
Wilson, Kenneth G, and John Kogut (1974), “The renormal- arXiv preprint arXiv:1708.09401 .
ization group and the epsilon expansion,” Physics Reports Zhang, Xiao-Ming, Zi-Wei Cui, Xin Wang, and Man-Hong
12 (2), 75–199. Yung (2018), “Automatic spin-chain learning to explore the
Witte, RS, and J.S. Witte (2013), Statistics (Wiley). quantum speed limit,” arXiv preprint arXiv:1802.09248 .
Wu, Yadong, Pengfei Zhang, Huitao Shen, and Hui Zhai Zhang, Yi, Roger G Melko, and Eun-Ah Kim (2017b), “Ma-
(2018), “Visualizing neural network developing perturba- chine learning Z2 quantum spin liquids with quasi-particle
tion theory,” arXiv preprint arXiv:1802.03930 . statistics,” arXiv preprint arXiv:1705.01947 .
Xie, Junyuan, Ross Girshick, and Ali Farhadi (2016), “Un- Zimek, Arthur, Erich Schubert, and Hans-Peter Kriegel
supervised deep embedding for clustering analysis,” in In- (2012), “A survey on unsupervised outlier detection in high-
ternational conference on machine learning, pp. 478–487. dimensional numerical data,” Statistical Analysis and Data
Yang, Tynia, Jinze Liu, Leonard McMillan, and Wei Wang Mining: The ASA Data Science Journal 5 (5), 363–387.
(2006), “A fast approximation to multidimensional scaling,” Zou, Hui, and Trevor Hastie (2005), “Regularization and vari-
in IEEE workshop on Computation Intensive Methods for able selection via the elastic net,” Journal of the Royal Sta-
Computer Vision. tistical Society: Series B (Statistical Methodology) 67 (2),
Yang, Xu-Chen, Man-Hong Yung, and Xin Wang 301–320.
(2017), “Neural network designed pulse sequences for

You might also like