Skip to content

PyBADS 1.1.0

Choose a tag to compare

@lacerbi lacerbi released this 25 Sep 04:25
1d075ab

Changes since PyBADS 1.0.6.

Upgrading from 1.0.6

What can stop an existing script, or change what it returns. Each point has
its entry below.

  • PyBADS needs Python 3.10 or later and gpyreg 1.3.3 or later.
  • Results differ from 1.0.6, also with a fixed seed.
  • random_seed no longer seeds NumPy's global random state.
  • The seed is read when the BADS object is created: a random_seed set in
    options afterwards, or np.random.seed called between creation and
    optimize(), does not fix a run.
  • random_seed refuses a float that is not a whole number, and a string,
    with a TypeError.

Added

  • Seeded runs through a random generator. Every random draw of a run
    comes from one numpy.random.Generator, bads.rng, which BADS creates
    from the random_seed option when the object is created. random_seed
    takes what numpy.random.default_rng takes, such as an integer or a
    SeedSequence, or a Generator, which BADS uses as given; a float that
    is a whole number is converted to an integer, and another float, or a
    string, raises a TypeError. A seeded run neither reads nor writes NumPy's
    global random state, so on one machine two runs with the same seed give
    the same result whatever else draws from that state. With
    random_seed=None, the default, the generator is derived from NumPy's
    global random state when the BADS object is created, so
    np.random.seed(...) before that fixes a run. The draws, and so the
    results, differ from those of 1.0.6, also with the same seed.
    • random_seed does not seed the target: a target that draws random
      numbers of its own, for example from np.random, has to be seeded
      separately. In 1.0.6 every draw came from NumPy's global random state,
      which random_seed seeded, the target's included.
    • In 1.0.6, optimize() reseeded NumPy's global random state from the
      option, so a random_seed set in options after creating the BADS
      object, or np.random.seed(...) called before optimize() with
      random_seed=None, fixed a run; neither does.
    • optimize_result["random_seed"] holds the seed when it is an integer
      (or a float converted to one), and None otherwise.

Changed

  • Requirements. PyBADS needs Python 3.10 or later (Python 3.9 has
    reached its end of life) and gpyreg 1.3.3 or later, the gpyreg release its
    tests run against. From gpyreg 1.3.2 on, the predictions of a GP with very
    small noise are more accurate. BADS's GP reaches that regime on many
    deterministic targets; on several benchmark problems runs then end closer
    to the minimum, some by orders of magnitude, and on the others the results
    change little.
  • Test dependencies. PyBADS no longer lists pytest, pytest-mock and
    pytest-rerunfailures among its dependencies. pip install "pybads[test]"
    installs what its test suite needs. (gpyreg 1.3.3 itself still installs
    pytest and pytest-rerunfailures.)

Fixed

  • Repeated evaluations with user-specified noise. With
    specify_target_noise=True, a run could stop with ValueError: setting an array element with a sequence after the optimizer evaluated a point a
    second time. The run now continues, with the two observations merged.