Professional Documents
Culture Documents
Bayesian Optimization
Theory and Practice Using Python
Peng Liu
Singapore, Singapore
Apress Standard
The publisher, the authors and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, expressed or implied, with respect to the
material contained herein or for any errors or omissions that may have
been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
Figure 1-1 The overall Bayesian optimization process. The policy digests the
historical observations and proposes the new sampling location. The environment
governs how the (possibly noise-corrupted) observation at the newly proposed
location is revealed to the policy. Our goal is to learn an efficient and effective policy
that could navigate toward the global optimum as quickly as possible
Global Optimization
Optimization aims to locate the optimal set of parameters of interest
across the whole domain through carefully allocating limited resources.
For example, when searching for the car key at home before leaving for
work in two minutes, we would naturally start with the most promising
place where we would usually put the key. If it is not there, think for a
little while about the possible locations and go to the next most
promising place. This process iterates until the key is found. In this
example, the policy is digesting the available information on previous
searches and proposing the following promising location. The
environment is the house itself, revealing if the key is placed at the
proposed location upon each sampling.
This is considered an easy example since we are familiar with the
environment in terms of its structural design. However, imagine
locating an item in a totally new environment. The policy would need to
account for the uncertainty due to unfamiliarity with the environment
while sequentially determining the next sampling location. When the
sampling budget is limited, as is often the case in real-life searches in
terms of time and resources, the policy needs to argue carefully on the
utility of each candidate sampling location.
Let us formalize the sequential global optimization using
mathematical terms. We are dealing with an unknown scalar-valued
objective function f based on a specific domain Α. In other words, the
unknown subject of interest f is a function that maps a certain sample
in Α to a real number in ℝ, that is, f : Α → ℝ. We typically place no
specific assumption about the nature of the domain Α other than that it
should be a bounded, compact, and convex set.
Unless otherwise specified, we focus on the maximization setting
instead of minimization since maximizing the objective function is
equivalent to minimizing the negated objective, and vice versa. The
optimization procedure thus aims at locating the global maximum f∗ or
its corresponding location x∗ in a principled and systematic manner.
Mathematically, we wish to locate f∗ where
Figure 1-6 Assuming a normal probability distribution for the actual observation as
a random variable. The Gaussian distribution is centered around the objective
function f value evaluated at a given location x and spread by the variance of the
noise term
The following section introduces Bayesian statistics to lay the
theoretical foundation as we work with probability distributions along
the way.
Bayesian Statistics
Bayesian optimization is not a particular algorithm for global
optimization; it is a suite of algorithms based on the principles of
Bayesian inference. As the optimization proceeds in each iteration, the
policy needs to determine the next sampling decision or if the current
search needs to be terminated. Due to uncertainty in the objective
function and the observation model, the policy needs to cater to such
uncertainty upon deciding the following sampling location, which bears
both an immediate impact on follow-up decisions and a long-term
effect on all future decisions. The samples selected thus need to
reasonably contribute to the ultimate goal of global optimization and
justify the cost incurred due to sampling.
Using Bayesian statistics in optimization paves the way for us to
systematically and quantitatively reason about these uncertainties
using probabilities. For example, we would place a prior belief about
the characteristics of the objective function and quantify its
uncertainties by assigning high probability to specific ranges of values
and low probability to others. As more observations are collected, the
prior belief is gradually updated and calibrated toward the true
underlying distribution of the objective function in the form of a
posterior distribution.
We now cover the fundamental concepts and tools of Bayesian
statistics. Understanding these sections is essential to appreciate the
inner workings of Bayesian optimization.
Bayesian Inference
Bayesian inference essentially relies on the Bayesian formula (also
called Bayes’ rule) to reason about the interactions among three
components: the prior distribution p(θ) where θ represents the
parameter of interest, the likelihood p(data| θ) given a specific
parameter θ, and the posterior distribution p(θ| data). There is one
more component, the evidence of the data p(data), which is often not
computable. The Bayesian formula is as follows:
Let us look closely at this widely used, arguably the most important
formula in Bayesian statistics. Remember that any Bayesian inference
procedure aims to derive the posterior distribution p(θ| data) (or
calculate its marginal expectation) for the parameter of interest θ, in
the form of a probability density function. For example, we might end
up with a continuous posterior distribution as in Figure 1-7, where θ
varies from 0 to 1, and all the probabilities (i.e., area under the curve)
would sum to 1.
Figure 1-8 Updating the prior uniform distribution toward a posterior normal
distribution as more data is collected. The role of the prior distribution decreases as
more data is collected to support the approximation to the true underlying
distribution
A very striking difference is noticeable between the account given by Matthew of the
death of Judas, and that given by Luke in the speech of Peter, Acts i. 18, 19. The various
modes of reconciling these difficulties are found in the ordinary commentaries. In respect to
a single expression in Acts i. 18, there is an ingenious conjecture offered by Granville Penn,
in a very interesting and learned article in the first volume of the transactions of the Royal
Society of Literature, which may very properly be mentioned here, on account of its
originality and plausibility, and because it is found only in an expensive work, hardly ever
seen in this country. Mr. Penn’s view is, that “the word ελακησε (elakese,) in Acts i. 18, is
only an inflection of the Latin verb, laqueo, (to halter or strangle,) rendered insititious in the
Hellenistic Greek, under the form λακεω.” He enters into a very elaborate argument, which
can not be given here, but an extract may be transcribed, in order to enable the learned to
apprehend the nature and force of his views. (Translated by R. S. Lit. Vol. I. P. 2, pp. 51,
52.)
“Those who have been in the southern countries of Europe know, that the operation in
question, as exercised on a criminal, is performed with a great length of cord, with which the
criminal is precipitated from a high beam, and is thus violently laqueated, or snared in a
noose, mid-way――medius or in medio; μεσος, and medius, referring to place as well as to
person; as, μεσος ὑμων ἑστηκεν. (John i. 26.) ‘Considit scopulo medius――――’ (Virgil,
Georgics, iv. 436.) ‘―――― medius prorumpit in hostes.’ (Aeneid, x. 379.)
“Erasmus distinctly perceived this sense in the words πρηνης γενομενος, although he did
not discern it in the word ελακησε, which confirms it: ‘πρηνης Graecis dicitur, qui vultu est in
terram dejecto: expressit autem gestum et habitum laqueo praefocati; alioquin, ex hoc
sane loco non poterat intelligi, quod Judas suspenderit se,’ (in loc.) And so Augustine also
had understood those words, as he shows in his Recit. in Act. Apostol. l. i. col. 474. ‘et
collem sibi alligavit, et dejectus in faciem,’ &c. Hence one MS., cited by Sabatier, for πρηνης
γενομενος, reads αποκρεμαμένος; and Jerom, in his new vulgate, has substituted suspensus
for the pronus factus of the old Latin version, which our old English version of 1542
accordingly renders, and when he was hanged.
“That which follows, and which evidently determined the vulgar interpretation of
ελακησε――εξεχυνθη παντα τα σπλαγχνα αυτου, all his bowels gushed out――states a natural
and probable effect produced, by the sudden interruption in the fall and violent capture in
the noose, in a frame of great corpulency and distension, such as Christian antiquity has
recorded that of the traitor to have been; so that a term to express rupture would have been
altogether unnecessary, and it is therefore equally unnecessary to seek for it in the verb
ελακησε. Had the historian intended to express disruption, we may justly presume that he
would have said, as he had already said in his gospel, v. 6, διερρηγνυτο, or xxiii. 45, εσχισθη
μεσος: it is difficult to conceive, that he would here have traveled into the language of
ancient Greek poetry for a word to express a common idea, when he had common terms at
hand and in practice; but he used the Roman laqueo, λακεω, to mark the infamy of the
death.
“(Πρησθεις επι τοσουτον την σαρκα, ὡστε μη δυνασθαι δειλθειν. Papias, from Routh's
Reliquiæ Sacræ tom. I. p. 9. and Oecumenius, thus rendered by Zegers, Critici Sacri, Acts i.
18, in tantum enim corpore inflatus est ut progredi non posset. The tale transmitted by those
writers of the first and tenth centuries, that Judas was crushed to death by a chariot
proceeding rapidly, from which his unwieldiness rendered him unable to escape, merits no
further attention, after the authenticated descriptions of the traitor’s death which we have
here investigated, than to suggest a possibility that the place where the suicide was
committed might have overhung a public way, and that the body falling by its weight might
have been traversed, after death, by a passing chariot;――from whence might have arisen
the tales transmitted successively by those writers; the first of whom, being an inhabitant of
Asia Minor, and therefore far removed from the theater of Jerusalem, and being also (as
Eusebius witnesses, iii. 39,) a man of a very weak mind――σφοδρα μκρος τον νουν――was
liable to be deceived by false accounts.)
“The words of St. Peter, in the Hellenistic version of St. Luke, will therefore import,
praeceps in ora fusus, laqueavit (i. e. implicuit se laqueo) medius; (i. e. in medio, inter
trabem et terram;) et effusa sunt omnia viscera ejus――throwing himself headlong, he
caught mid-way in the noose, and all his bowels gushed out. And thus the two reporters of
the suicide, from whose respective relations charges of disagreement, and even of
contradiction, have been drawn in consequence of mistaking an insititious Latin word for a
genuine Greek word of corresponding elements, are found, by tracing that insititious word to
its true origin, to report identically the same fact; the one by a single term, the other by a
periphrasis.”
Such was the end of the twelfth of Jesus Christ’s chosen ones. To
such an end was the intimate friend, the trusted steward, the festal
companion of the Savior, brought by the impulse of some not very
unnatural feelings, excited by occasion, into extraordinary action.
The universal and intense horror which the relation of his crime now
invariably awakens, is by no means favorable to a just and fair
appreciation of his sin and its motives, nor to such an honest
consideration of his course from rectitude to guilt, as is most
desirable for the application of the whole story to the moral
improvement of its readers. Originally not an infamous man, he was
numbered among the twelve as a person of respectable character,
and long held among his fellow-disciples a responsible station, which
is itself a testimony of his unblemished reputation. He was sent forth
with them, as one of the heralds of salvation to the lost sheep of the
house of Israel. He shared with them the counsels, the instructions,
and the prayers of Jesus. If he was stupid in apprehending, and
unspiritual in conceiving the truths of the gospel, so were they. If he
was an unbeliever in the resurrection of Jesus, so were they; and
had he survived till the accomplishment of that prophecy, he could
not have been slower in receiving the evidence of the event, than
they. As it was, he died in his unbelief; while they lived to feel the
glorious removal of all their doubts, the purification of all their gross
conceptions, and the effusion of that spirit of truth, through which, by
the grace of God alone, they afterwards were what they were.
Without a merit, in faith, beyond Judas, they maintained their dim
and doubtful adherence to the truth, only by their nearer
approximation to moral perfection; and by their nobler freedom from
the pollution of sordid and spiteful feeling. Through passion alone he
fell, a victim, not to a want of faith merely,――for therein, the rest
could hardly claim a superiority,――but to the radical deficiency of
true love for Jesus, of that “charity which never faileth,” but “endureth
to the end.” It was their simple, devoted affection, which, through all
their ignorance, their grossness of conception, and their
faithlessness in his word, made them still cling to his name and his
grave, till the full revelations of his resurrection and ascension had
displaced their doubts by the most glorious certainties, and given
their faith an eternal assurance. The great cause of the awful ruin of
Judas Iscariot, then, was the fact, that he did not love Jesus. Herein
was his grand distinction from all the rest; for though their regard
was mingled with so much that was base, there was plainly, in all of
them, a solid foundation of true, deep affection. The most ambitious
and skeptical of them, gave the most unquestionable proofs of this.
Peter, John, both the Jameses, and others, are instances of the
mode in which these seemingly opposite feelings were combined.
But Judas was without this great refining and elevating principle,
which so redeemed the most sordid feelings of his fellows. It was not
merely for the love of money that he was led into this horrid crime.
The love of four dollars and eighty cents! Who can believe that this
was the sole motive? It was rather that his sordidness and
selfishness, and ambition, if he had any, lacked this single, purifying
emotion, which redeemed their characters. Is there not, in this
reflection, a moral which each Christian reader can improve to his
own use? For the lack of the love of Jesus alone, Judas fell from his
high estate, to an infamy as immortal as their fame. Wherever,
through all ages, the high heroic energy of Peter, the ready faith of
Andrew, the martyr-fire of James Boanerges, the soul-absorbing love
of John, the willing obedience of Philip, the guileless purity of
Nathanael, the recorded truth of Matthew, the slow but deep
devotion of Thomas, the blameless righteousness of James the Just,
the appellative zeal of Simon, and the earnest warning eloquence of
Jude, are all commemorated in honor and bright renown,――the
murderous, sordid spite of Iscariot, will insure him an equally lasting
proverbial shame. Truly, “the sin of judas is written with a pen
of iron on a tablet of marble.”
MATTHIAS.
The events which concern this person’s connection with the
apostolic company, are briefly these. Soon after the ascension of
Jesus, the eleven disciples being assembled in their “upper room,”
with a large company of believers, making in all, together, a meeting
of one hundred and twenty, Peter arose and presented to their
consideration, the propriety and importance of filling, in the apostolic
college, the vacancy caused by the sad defection of Judas Iscariot.
Beginning with what seems to be an apt allusion to the words of
David concerning Ahithophel,――(a quotation very naturally
suggested by the striking similarity between the fate of that ancient
traitor, and that of the base Iscariot,) he referred to the peculiarly
horrid circumstances of the death of this revolted apostle, and also
applied to these occurrences the words of the same Psalmist
concerning those upon whom he invoked the wrath of God, in words
which might with remarkable emphasis be made descriptive of the
ruin of Judas. “Let his habitation be desolate,” and “let another take
his office.” Applying this last quotation more particularly to the
exigency of their circumstances, he pronounced it to be in
accordance with the will of God that they should immediately
proceed to select a person to “take the office” of Judas. He declared
it an essential requisite for this office, moreover, that the person
should be one of those who, though not numbered with the select
twelve, had been among the intimate companions of Jesus, and had
enjoyed the honors and privileges of a familiar discipleship, so that
they could always testify of his great miracles and divine instructions,
from their own personal knowledge as eye-witnesses of his actions,
from the beginning of his divine career at his baptism by John, to the
time of his ascension.
Agreeably to this counsel of the apostolic chief, the whole
company of the disciples selected two persons from those who had
been witnesses of the great actions of Christ, and nominated them to
the apostles, as equally well qualified for the vacant office. To decide
the question with perfect impartiality, it was resolved, in conformity
with the common ancient practice in such cases, to leave the point
between these two candidates to be settled by lot; and to give this
mode of decision a solemnity proportioned to the importance of the
occasion, they first invoked, in prayer, the aid of God in the
appointment of a person best qualified for his service. They then
drew the lots of the two candidates, and Matthias being thus
selected, was thenceforth enrolled with the eleven apostles.
SAUL,
AFTERWARDS NAMED PAUL.
his country.
This account by Ammianus Marcellinus is found in book XIV. of his history, (p. 19, edited
by Vales.)
The native land of Saul was classic ground. Within the limits of
Cilicia, were laid the scenes of some of the most splendid passages
in early Grecian fable; and here too, were acted some of the
grandest events in authentic history, both Greek and Roman. The
very city of his birth, Tarsus, is said to have been founded by
Perseus, the son of Jupiter and Danae, famed for his exploit at
another place on the shore of this part of the Mediterranean. More
authentic history however, refers its earliest foundation to
Sardanapalus, king of Assyria, who built Tarsus and Anchialus in
Cilicia, nine hundred years before Christ. Its origin is by others
ascribed to Triptolemus with an Argive colony, who is represented on
some medals as the founder. These two stories may be made
consistent with each other, on the supposition that the same place
was successively the scene of the civilizing influence of each of