This branch introduces some small changes for tidiness and ease-of-use.
Bounds and starting positions passed as 1-D arrays are now coerced to 2-D row vectors (with a warning message), and an error is raised if they cannot be coerced.
Bounds and starting positions are cast to floating point, in case they are passed as integers.
This doesn't effect explicit integer variables (integer_vars), which are represented as floats anyway, but handled separately. It only avoids some erroneous rounding in ParameterTransformer in case something like lb = [1, 2, 3] is passed as input instead of lb = [1., 2., 3.].
Adds timing to active sampling.
Because some timings are repeated at different points in the same iteration, the timer is now cumulative: additional calls to start_timer(key)/stop_timer(key) beyond the first will add to the existing duration of key.
The timer is still manually reset after each iteration, so that iteration_history["timer"][i] contains only the timings for the i^th iteration, as before.
The timer is now shared globally, and can be accessed with from pyvbmc.timer import main_timer. So the timings can be started/stopped from any module without explicitly passing the timer object around.
Replace flatten() with ravel() where there is no danger of reference issues. (flatten always returns a copy, but ravel returns a view in most cases).
Changes assert statements to raise Error.
Tweaks test_viqr and test_vp_optimize to be less prone to fail. Makes noisy_likelihood test faster (by choosing a lower-dimensional problem).
Fixes some minor formatting typos in logging.
Fixes a couple minor TODO's. Most still require further review.
This branch introduces some small changes for tidiness and ease-of-use.
integer_vars
), which are represented as floats anyway, but handled separately. It only avoids some erroneous rounding in ParameterTransformer in case something likelb = [1, 2, 3]
is passed as input instead oflb = [1., 2., 3.]
.start_timer(key)
/stop_timer(key)
beyond the first will add to the existing duration of key.iteration_history["timer"][i]
contains only the timings for the i^th iteration, as before.pyvbmc.timer import main_timer
. So the timings can be started/stopped from any module without explicitly passing the timer object around.flatten()
withravel()
where there is no danger of reference issues. (flatten
always returns a copy, butravel
returns a view in most cases).assert
statements toraise Error
.test_viqr
andtest_vp_optimize
to be less prone to fail. Makesnoisy_likelihood
test faster (by choosing a lower-dimensional problem).VP
class.