estimator.util.local_minimum

estimator.util.local_minimum#

class estimator.util.local_minimum(start, stop, precision=1, smallerf=<function local_minimum.<lambda>>, suppress_bounds_warning=False, log_level=5)[source]#

An iterator context for finding a local minimum using binary search.

We use the neighborhood of a point to decide the next direction to go into (gradient descent style), so the algorithm is not plain binary search (see update() function.)

We also zoom out by a factor precision, find an approximate local minimum and then search the neighbourhood for the smallest value.

Note

We combine an iterator and a context to give the caller access to the result.

Create a fresh local minimum search context.

Parameters:
  • start – starting point

  • stop – end point (exclusive)

  • precision – only consider every precision-th value in the main loop

  • smallerf – a function to decide if lhs is smaller than rhs.

  • suppress_bounds_warning – do not warn if a boundary is picked as optimal

__call__(**kwargs)#

Call self as a function.

Methods

__init__(start, stop[, precision, smallerf, ...])

Create a fresh local minimum search context.

update(res)

TESTS:

Attributes

neighborhood

An iterator over the neighborhood of the currently best value.

x

y