Skip to content

f3dasm v2.4.1

Latest

Choose a tag to compare

@github-actions github-actions released this 05 Nov 14:14
181a145

f3dasm v2.4.1

A bug-fix release for two samplers that gave different designs than requested. The grid sampler left out the upper bound of continuous parameters, and the Sobol sampler ignored its seed. No function signatures change, but both samplers now return different points than in 2.4.0; see Upgrading below.

Highlights

Fix: the grid sampler includes the upper bound (#360, closes #357)

A 2-level grid on [0, 1], i.e. the corners of the domain, could not be built for continuous parameters. Whether the upper bound appeared at all depended on floating-point rounding: [1, 1.3] with step 0.1 included 1.3, but [0, 1] with step 0.25 stopped at 0.75. Integer parameters already included their upper bound.

  • Every continuous parameter's grid now runs from its lower bound to its upper bound. stepsize_continuous_parameters=0.5 on [0, 1] gives 0, 0.5, 1.
  • A step that does not divide the range evenly is rounded to the nearest step that does, and a UserWarning names the step actually used. For example, 0.3 on [0, 1] becomes three steps of 1/3. On an exact tie the smaller step wins.
  • A step of zero or less raises a ValueError. Before, it gave an empty grid or a ZeroDivisionError.

Behaviour change: grids gain one value per continuous parameter. For expensive simulations this means more runs.

Fix: the Sobol sampler uses its seed (#360, closes #358)

create_sampler("sobol_sampler", seed=0) and seed=123 returned the same points, so a "test" set drawn with another seed repeated the "training" set. The design was the raw, unscrambled sequence, starting at the lower corner and then the centre. Array parameters got rows of SALib's sensitivity-analysis design, which repeats coordinates across rows and so is not space-filling.

  • Continuous and array parameters now come from one scrambled scipy.stats.qmc.Sobol sequence, seeded with seed. Different seeds give different designs, and seed=None gives a fresh design on every call.
  • All dimensions share one sequence, so two parameters of the same size never receive identical coordinates.
  • scipy warns when n_samples is not a power of 2, since that is when Sobol points are best balanced.

Behaviour change: seeded Sobol designs differ from those in 2.4.0.

Dependencies

  • The Sobol sampler uses scipy, which stays an optional dependency (#301). A plain install still has it, because SALib depends on it. The sampler raises a clear ImportError if scipy is missing or older than 1.15.
  • The scipy and all extras now require scipy>=1.15, up from >=1.10.1.
  • The docs extra caps pymdown-extensions<12 (#361). Version 12 breaks mkdocstrings 1.0.6, which had made the docs build fail in CI.

Upgrading

pip install --upgrade f3dasm (2.4.0 → 2.4.1). Three things to know:

  1. Grids are larger. If the step divides the range, lowering each continuous parameter's upper bound by one step gives the old grid back.
  2. Seeded Sobol designs change. If you compare against designs saved with 2.4.0, regenerate them or stay on 2.4.0 for that comparison.
  3. Sobol needs scipy 1.15 or newer. If you see the ImportError, run pip install --upgrade "f3dasm[scipy]".

What's Changed

Full Changelog: v2.4.0...v2.4.1