yohandi
A recent graduate with a strong interest in algorithms and data structures.

[Tutorial] Variations of Golden-section Search on a Density Function

Taking a further step from my previous post, in this one, we are going to see the application of the Golden-section Search to a density function. If you are not quite familiar with the method yet, you might want to refer first here.

Motivational Problem

Suppose we have a function

KaTeX can only parse string typed expression
satisfying

KaTeX can only parse string typed expression

, which shows the spread of local minimum/maximum of a function

KaTeX can only parse string typed expression
that is unimodal. Denote
KaTeX can only parse string typed expression
as the minimum/maximum peak point of
KaTeX can only parse string typed expression
, we aim to find a point
KaTeX can only parse string typed expression
such that

KaTeX can only parse string typed expression

, where

KaTeX can only parse string typed expression
represents an acceptable error and
KaTeX can only parse string typed expression
. We achieve this by only querying the value of the function at specific points, i.e., evaluating
KaTeX can only parse string typed expression
for chosen values of
KaTeX can only parse string typed expression
in the interval
KaTeX can only parse string typed expression
, as efficiently as possible.

Golden-section Search Method

Performing search based on the unimodal function

In the previous post, we have shown that in the Golden-section Search method, we usually want to have our pivot points to be located in both

KaTeX can only parse string typed expression
and
KaTeX can only parse string typed expression
. However, we notice that the number of queries depends on the value of
KaTeX can only parse string typed expression
and
KaTeX can only parse string typed expression
; consequently, when the range between
KaTeX can only parse string typed expression
and
KaTeX can only parse string typed expression
is big enough (say they are approaching
KaTeX can only parse string typed expression
and
KaTeX can only parse string typed expression
), the number of queries used will also become bigger. That being said, performing a search based on function
KaTeX can only parse string typed expression
will not be reliable.

Performing search based on the density function

To make up for this, we need to make an adjustment for which interval we are going to query as our base. By using prior knowledge about the statistical method, we can focus our search on where the minimum / maximum is more likely to be found. Hence, we want to perform our search based on function

KaTeX can only parse string typed expression
. For the pivots that we needed, we want to set
KaTeX can only parse string typed expression
and
KaTeX can only parse string typed expression
as values that satisfy

KaTeX can only parse string typed expression

and

KaTeX can only parse string typed expression

Figure 1
Figure 1
Figure 2
Figure 2

This works well as after each transition; we manage to remove either

KaTeX can only parse string typed expression
or
KaTeX can only parse string typed expression
from our search space. Although, in a sense, it is quite hard to calculate the number of queries needed as
KaTeX can only parse string typed expression
and
KaTeX can only parse string typed expression
do not entirely depends on both
KaTeX can only parse string typed expression
and
KaTeX can only parse string typed expression
, but also
KaTeX can only parse string typed expression
. However, notice that we can always choose
KaTeX can only parse string typed expression
and
KaTeX can only parse string typed expression
in any valid interval that subject to
KaTeX can only parse string typed expression
. Denote
KaTeX can only parse string typed expression
as
KaTeX can only parse string typed expression
, let's analyze the two cases:

  • Case

    KaTeX can only parse string typed expression
    is removed from the interval
    KaTeX can only parse string typed expression
    :

    KaTeX can only parse string typed expression
  • Case

    KaTeX can only parse string typed expression
    is removed from the interval
    KaTeX can only parse string typed expression
    :

    KaTeX can only parse string typed expression

Each query allows us to reduce

KaTeX can only parse string typed expression
to
KaTeX can only parse string typed expression
; denote
KaTeX can only parse string typed expression
as the number of queries needed, then:

KaTeX can only parse string typed expression

Additional Variation: Density Function

When encountering a similar function, say

KaTeX can only parse string typed expression
, that does not satisfy the
KaTeX can only parse string typed expression
condition, but still represents the spread of the peak point in a unimodal function, we can make a transformation to accommodate this scenario. We will transform the function
KaTeX can only parse string typed expression
into
KaTeX can only parse string typed expression
and
KaTeX can only parse string typed expression
into
KaTeX can only parse string typed expression
, where:

KaTeX can only parse string typed expression

and

KaTeX can only parse string typed expression

. And there we have it! If prior knowledge about the function's behavior or specific features of the local minima/maxima is known, we can always customize the search strategy accordingly. This could involve using different weighting schemes or adapting the pivots.

© 2023 Yohandi. All rights reserved.