Manifold Markov chain Monte Carlo methods in Python
MIT License
Bot releases are hidden (Show)
Minor release.
Bug fixes:
NaN
Hamiltonian values when computing Metropolis accept probability due to min(0, float("nan"))
evaluating to 0.div
element causing horizontal scrollbars to appear.sample_chains
method with argument display_progress=False
.Packaging changes
docs
and images
folders from sdist
builds to minimize download size.Published by matt-graham about 1 year ago
Major release.
Dependency changes
API changes
sample_chain
and sample_chains_with_adaptive_warm_up
methods in favour of combining all functions into a single sample_chains
method, which now requires arguments to be passed specifying both number of warm-up iterations (n_warm_up_iter
, can be zero) and number of main iterations (n_main_iter
). All arguments to sample_chain
other than n_warm_up_iter
, n_main_iter
and init_states
are now keyword only.metric
and optional arguments specifying derivatives (for example grad_neg_log_dens
and jacob_constr
) to system classes are now all keyword only.sample_chains
methods now return named tuples with entries final_states
, traces
and statistics
.memmap_enabled
keyword argument to sample_chains
removed and replaced with force_memmap
argument, with adjusted semantics that memory mapping is now always enabled when sampling chain in parallel on multiple processes, with force_memmap
allowing memory mapping to also be used when sampling a chain or chains on a single process.Bug fixes
mici.transitions.Transition.statistic_types
being shared across subclasses as a mutable set fixed.exp(min(.))
rather than min(exp(.))
to improve numerical stability.reverse_norm
argument to ConstrainedLeapfrogIntegrator
initializer was previously ignored - this is now fixed.numpy.bool
type removed.New, changed and removed features
mici.integrators.ImplicitMidpointIntegrator
) for non-separable Hamiltonian systems, with dh2_dpos
method added to EuclideanMetricSystem
to allow also using with implicit midpoint integrator for testing purposes.trace_warm_up
argument to sample_chains
method).mici.interop
module with convenience functions for converting Mici sample_chains
output to an arviz.InferenceData
object, sampling a PyMC model with Mici and sampling a PyStan model with Mici.ConstrainedLeapfrogIntegrator
which performs a Newton iteration with backtracking line search (mici.solvers.solve_projection_onto_manifold_newton_with_line_search
).projection_solver
argument to ConstrainedLeapfrogIntegrator
initializer changed to mici.solvers.solve_projection_onto_manifold_newton
.step_size
) allowing live monitoring using monitor_stats
argument to sample_chains
.mici.errors.LinAlgError
exception being raised.jax.Array
instances.Documentation and packaging
pyproject.toml
file with setup.py
script removed.Published by matt-graham about 4 years ago
Minor release.
Bug fixes:
Published by matt-graham about 4 years ago
Minor release.
New features
max_threads_per_process
option to sample_chains*
methods if threadpoolctl
is installed.Bug fixes
state._call_counts
from dictionary to collections.Counter
instance which meant call counter not shared by all copies of state which is intended behaviour to ensure that all calls are recorded.Published by matt-graham over 4 years ago
Bug fixes
multiprocess
installed introduced in v0.1.6 release due to use of non-pickleable local function in default value for trace_funcs
argument.LogRepFloat
class.*BlockDiagonalMatrix
classes.sample_chain
method with display_progress=False
.Dependency changes and deprecations
numpy
version changed to 1.17 to ensure new-style numpy.random.Generator
RNGs are available with use of numpy.random.RandomState
instances deprecated.API changes
tqdm
based progress bar implementation mici.progressbars.TqdmProgressBar
removed as alternative to inbuilt progress bar class.mici.utils.convert_to_arviz_inference_data
helper function removed as traces dictionary can be directly used in most ArviZ API functions and/or explicitly converted to an ArviZ InferenceData
container using the inbuilt convert functions.sample_chains_with_adaptive_warm_up
methods factored out to 'stager' classes in mici.stagers
module. The sample_chains_with_adaptive_warm_up
methods now accept a new keyword argument stager
which replaces the previous windowed-adaptation specific n_init_fast_stage_iter
, n_init_slow_window_iter
, n_final_fast_stage_iter
and slow_window_multiplier
keywords, with these parameters now able to be instead set via the initializer for the mici.stagers.WindowedWarmUpStager
class.multi_cache_in_state
, used to cache outputs of system functions with additionally auxiliary outputs, renamed to cache_in_state_with_aux
.Published by matt-graham over 4 years ago
Minor release.
Bug fixes
[sampler].sample_chains_with_adaptive_warmup
methods added in previous release for sampling chains with adaptive warm up stage(s) previously were reinitialising each stage at the initial state rather than the final state from the previous stage. This is now fixed.New features
LabelledSequenceProgressBar
used for indicating progress through stages of adaptive chains to improve visualisation in interfaces supporting HTML output such as Jupyter notebooks.Published by matt-graham over 4 years ago
New features and efficiency improvements
mici.adapters
module and associated sample_chains_with_adaptive_warm_up
methods added to sampler classes. Initial adapters implemented are a dual averaging step size adapter, a diagonal metric adapter based on estimated variances and dense metric adapter based on estimated covariance matrices.transpose
/ sqrt
/ inv
methods and explicit matrix-vector multiplies used for inverted factored definite matrices to avoid bottleneck of scipy.linalg.solve_triangular
which is much slower than a direct matrix-vector multiply.h2
Hamiltonian component.Bug fixes
Backwards incompatible changes
ExplicitLeapfrogIntegrator
was aliased to LeapfrogIntegrator
. ExplicitLeapfrogIntegrator
has now been renamed to LeapfrogIntegrator
with no aliases.sample_chain
and sample_chains
call no longer contain an hamiltonian
key. Instead by default the traces
dictionary returned by these methods includes a hamiltonian
entry (as generated by the default trace function used when a custom list of trace functions are not specified by the trace_funcs
keyword argument). The rationale for this change is to standardize the chain statistics dictionary as only including values which don't correspond directly to a function of the chain states at the end of each iteration but instead generally depend on the whole transition, with the trace_funcs
keyword argument already allowing recording of quantities outside this category.sample_chain
and sample_chains
call no longer contain an accept_prob
key due to the ambiguity of its meaning and differing usage in the static Metropolis and dynamic HMC integration transitions. Both classes of transitions now return a accept_stat
statistic in the statistics dictionary, this corresponding to an overall measure of the probability of accepting a move both due to non-zero changes in the Hamiltonian over a trajectory and any early termination of trajectories due to convergence errors or non-reversible steps when using an implicit integrator. This single summary statistic is intended to both provide a quick summary of sampling performance e.g. in the monitored statistics in chain progress bars, and as the default target for adaptation of the integrator step size. Individual transitions also provide additional acceptance probability related statistics with differing meanings. The dynamic integration transitions (subclasses of DynamicIntegrationTransition
and corresponding Dynamic*HMC
sampler classes) additionally return an av_metrop_accept_prob
statistic which is the average Metropolis acceptance probability for a move from the initial state to each of the states on the whole trajectory tree built (including subtrees which are invalid under the no-U-turn criteria); this does not include any adjustment for early termination of trajectories due to convergence errors / non-reversible steps in implicit integrators so should be used with caution in such cases. The Metropolis integration transitions (subclasses of MetropolisIntegrationTransition
and corresponding *MetropolisHMC
sampler classes) additionally return a metrop_accept_prob
statistic which is the Metropolis acceptance probability of the move proposed by the transition without any adjustment for rejection due to convergence errors / non-reversible steps in implicit integrators.mici.systems.SoftAbsRegularisedPositiveDefiniteMatrix
to mici.systems.SoftAbsRegularizedPositiveDefiniteMatrix
.Published by matt-graham over 4 years ago
Minor release.
New features
DynamicMultinomialHMC
sampler.mici.systems
module is now much fuller.LinAlgError
exceptions when attempting Cholesky decomposition of non (numerically) positive definite matrix now handled rather than halting sampling.Bug fixes
Published by matt-graham almost 5 years ago
Minor release with several bug fixes. Thanks to @kx-au for spotting and suggesting fixes to the bugs in the ImplicitLeapfrogIntegrator
and solve_fixed_point_direct
implementations.
multiprocess
installed incorrectly assumed the exception raised would always be a PicklingError
while in reality an AttributeError
was being raised. The code now handles this case and correctly outputs an error message suggesting for the user to try installing multiprocess
when trying to sample chains in parallel with Autograd model functions when multiprocess
is not available.mici.integrators.ImplicitLeapfrogIntegrator
have been fixed which previously prevented instantiation of this class.mici.solvers.solve_fixed_point_direct
introduced in 5e012034 has been fixed.mici.matrices
module have been refactored to use abc
abstract base classes to make the expected interfaces for the various matrix types more explicit and docstrings added to most classes and methods.mici.matrices
unit tests have been updated to improve the coverage of the classes and reduce code duplication in writing the tests.mici.integrator
unit tests coverage has also been improved slightly by adding a basic test for a ImplicitLeapfrogIntegrator
instance.Published by matt-graham almost 5 years ago
Minor release with improvements to non-linear equation solvers, additional block diagonal matrix classes and fix to bug when monitoring boolean chain statistics.
Published by matt-graham almost 5 years ago
Minor release with sampling efficiency improvements, new facility for tracking the number of model function calls during sampling, improved robustness to use of non-NumPy arrays, and miscellaneous bug fixes.
_count_calls
dictionary object which will be used to record the number of calls to system methods decorated with the cache_in_state
and multi_cache_in_state
decorators. This can be used to give a hardware independent measure of the operation cost of a sampling run.+=
when acting on NumPy arrays. NumPy array like objects such as JAX DeviceArray
instances do not perform updates in place, instead creating a new array object, meaning relying on such operations happening in place was silently failing when using such arrays.autograd
in the autograd_wrapper
module has now been fixed meaning the package can be imported without autograd
being installed as intended.ipywidgets
stylesheets, instead now using explicit values.Published by matt-graham almost 5 years ago
Minor release improving robustness of parallel sampling and progress bars.
Published by matt-graham almost 5 years ago
Post-release update to add HTML API documentation
Published by matt-graham almost 5 years ago
Initial PyPI release