mici.transitions module#

Markov transition kernels.

class mici.transitions.CorrelatedMomentumTransition(system, mom_resample_coeff=1.0)[source]#

Bases: MomentumTransition

Correlated (partial) momentum transition.

Rather than independently sampling a new momentum, instead a pertubative Crank-Nicolson type update which produces a new momentum value with a specified correlation with the previous value is used. It is assumed that the conditional distribution of the momenta is zero-mean Gaussian such that the Crank-Nicolson update leaves the momenta conditional distribution exactly invariant. This approach is sometimes known as partial momentum refreshing or updating, and was originally proposed in (Horowitz, 1991).

If the resampling coefficient is equal to zero then the momentum is not randomized at all and succesive applications of the coupled integration transitions will continue along the same simulated Hamiltonian trajectory. When an integration transition is accepted this means the subsequent simulated trajectory will continue evolving in the same direction and so not randomising the momentum will reduce random-walk behaviour. However on a rejection the integration direction is reversed and so without randomisation the trajectory will exactly backtrack along the previous tractory states. A resampling coefficient of one corresponds to the standard case of independent resampling of the momenta while intermediate values between zero and one correspond to varying levels of correlation between the pre and post update momentums.

References

  1. Horowitz, A.M. (1991). A generalized guided Monte Carlo algorithm. Phys. Lett. B, 268(CERN-TH-6172-91), pp.247-252.

Parameters:
  • system (System) – Hamiltonian system defining conditional distribution on momentum to leave invariant.

  • mom_resample_coeff (float) – Scalar value in [0, 1] defining the momentum resampling coefficient.

sample(state, rng)[source]#

Sample a new momentum component to state.

Assigns a new momentum component to state by sampling from a Markov transition kernel which leaves the conditional distribution on the momentum under the canonical distribution defined by the Hamiltonian system invariant.

Parameters:
  • state (ChainState) – Current chain state to condition transition kernel on.

  • rng (Generator) – Numpy random number generator.

Returns:

Tuple of updated state object and any statistics computed during the transition or None if no statistics.

Return type:

tuple[ChainState, Optional[dict[str, ScalarLike]]]

property state_variables: set[str]#

A set of names of state variables accessed by this transition.

property statistic_types: dict[str, tuple[DTypeLike, ScalarLike]] | None#

A dictionary describing the statistics computed during transition.

Either None if no statistics are returned by sample() method or a dictionary with string keys and tuple values, with the keys defining the keys of the statistics returned in the trans_stats return value of the sample() method and the first entry of the value tuples an appropriate NumPy dtype for the array used to store the corresponding statistic values and second entry the default value to initialize this array with.

class mici.transitions.DynamicIntegrationTransition(system, integrator, *, max_tree_depth=10, max_delta_h=1000.0, termination_criterion=<function riemannian_no_u_turn_criterion>, do_extra_subtree_checks=True)[source]#

Bases: IntegrationTransition

Base class for dynamic integration transitions.

In each transition a binary tree of states is recursively computed by integrating randomly forward and backward in time by a number of steps equal to the previous tree size until a termination criteria on the tree’s subtrees is met. The next chain state is chosen from the candidate states using a progressive sampling scheme based on relative weights of the different candidate states, with the sampling biased towards states further from the current state.

References

  1. Hoffman, M.D. and Gelman, A., 2014. The No-U-turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo. Journal of Machine Learning Research, 15(1), pp.1593-1623.

  2. Betancourt, M., 2017. A conceptual introduction to Hamiltonian Monte Carlo. arXiv preprint arXiv:1701.02434.

Parameters:
  • system (System) – Hamiltonian system to be simulated.

  • integrator (Integrator) – Symplectic integrator appropriate to the specified Hamiltonian system.

  • max_tree_depth (int) – Maximum depth to expand trajectory binary tree to. The maximum number of integrator steps corresponds to 2**max_tree_depth.

  • max_delta_h (float) – Maximum change to tolerate in the Hamiltonian function over a trajectory before signalling a divergence.

  • termination_criterion (TerminationCriterion) – Function computing criterion to use to determine when to terminate trajectory tree expansion. The function should take a Hamiltonian system as its first argument, a pair of states corresponding to the two edge nodes in the trajectory (sub-)tree being checked and an array containing the sum of the momentums over the trajectory (sub)-tree. Defaults to riemannian_no_u_turn_criterion.

  • do_extra_subtree_checks (bool) – Whether to perform additional termination criterion checks on overlapping subtrees of the current tree to improve robustness in systems with dynamics which are well approximated by independent system of simple harmonic oscillators. In such systems (corresponding to e.g. a standard normal target distribution and identity metric matrix representation) at certain step sizes a ‘resonant’ behaviour is seen by which the termination criterion fails to detect that the trajectory has expanded past a half-period i.e. has ‘U-turned’ resulting in trajectories continuing to expand, potentially up until the max_tree_depth limit is hit. For more details see this Stan Discourse discussion. If do_extra_subtree_checks is set to True additional termination criterion checks are performed on overlapping subtrees which help to reduce this resonant behaviour at the cost of more conservative trajectory termination in some correlated models and some overhead from additional checks.

sample(state, rng)[source]#

Sample a position-momentum pair using integration based proposal(s).

Samples new position and momentum values from a Markov transition kernel which leaves the canonical distribution on the state space corresponding to the Hamiltonian system invariant.

Parameters:
  • state (ChainState) – Current chain state.

  • rng (Generator) – Numpy random number generator.

Returns:

Tuple of updated state object and any statistics computed during the transition or None if no statistics.

Return type:

tuple[ChainState, dict[str, ScalarLike]]

property state_variables: set[str]#

A set of names of state variables accessed by this transition.

property statistic_types: dict[str, tuple[DTypeLike, ScalarLike]]#

A dictionary describing the statistics computed during transition.

Either None if no statistics are returned by sample() method or a dictionary with string keys and tuple values, with the keys defining the keys of the statistics returned in the trans_stats return value of the sample() method and the first entry of the value tuples an appropriate NumPy dtype for the array used to store the corresponding statistic values and second entry the default value to initialize this array with.

class mici.transitions.IndependentMomentumTransition(system)[source]#

Bases: MomentumTransition

Independent momentum transition.

Independently resamples the momentum component of the state from its conditional distribution given the remaining state.

Parameters:

system (System) – Hamiltonian system defining conditional distribution on momentum to leave invariant.

sample(state, rng)[source]#

Sample a new momentum component to state.

Assigns a new momentum component to state by sampling from a Markov transition kernel which leaves the conditional distribution on the momentum under the canonical distribution defined by the Hamiltonian system invariant.

Parameters:
  • state (ChainState) – Current chain state to condition transition kernel on.

  • rng (Generator) – Numpy random number generator.

Returns:

Tuple of updated state object and any statistics computed during the transition or None if no statistics.

Return type:

tuple[ChainState, Optional[dict[str, ScalarLike]]]

property state_variables: set[str]#

A set of names of state variables accessed by this transition.

property statistic_types: dict[str, tuple[DTypeLike, ScalarLike]] | None#

A dictionary describing the statistics computed during transition.

Either None if no statistics are returned by sample() method or a dictionary with string keys and tuple values, with the keys defining the keys of the statistics returned in the trans_stats return value of the sample() method and the first entry of the value tuples an appropriate NumPy dtype for the array used to store the corresponding statistic values and second entry the default value to initialize this array with.

class mici.transitions.IntegrationTransition(system, integrator)[source]#

Bases: Transition

Base class for integration transtions.

Markov transition kernel which leaves canonical distribution invariant and jointly updates the position and momentum components of the chain state by integrating the Hamiltonian dynamics of the system to propose new values for the state.

Parameters:
  • system (System) – Hamiltonian system to be simulated.

  • integrator (Integrator) – Symplectic integrator appropriate to the specified Hamiltonian system.

abstract sample(state, rng)[source]#

Sample a position-momentum pair using integration based proposal(s).

Samples new position and momentum values from a Markov transition kernel which leaves the canonical distribution on the state space corresponding to the Hamiltonian system invariant.

Parameters:
  • state (ChainState) – Current chain state.

  • rng (Generator) – Numpy random number generator.

Returns:

Tuple of updated state object and any statistics computed during the transition or None if no statistics.

Return type:

tuple[ChainState, Optional[dict[str, ScalarLike]]]

property state_variables: set[str]#

A set of names of state variables accessed by this transition.

property statistic_types: dict[str, tuple[DTypeLike, ScalarLike]]#

A dictionary describing the statistics computed during transition.

Either None if no statistics are returned by sample() method or a dictionary with string keys and tuple values, with the keys defining the keys of the statistics returned in the trans_stats return value of the sample() method and the first entry of the value tuples an appropriate NumPy dtype for the array used to store the corresponding statistic values and second entry the default value to initialize this array with.

class mici.transitions.MetropolisIntegrationTransition(system, integrator)[source]#

Bases: IntegrationTransition

Base for HMC methods using a Metropolis accept step to sample new state.

In each transition a trajectory is generated by integrating the Hamiltonian dynamics from the current state in the current integration time direction for a number of integrator steps.

The state at the end of the trajectory with the integration direction negated (this ensuring the proposed move is an involution) is used as the proposal in a Metropolis acceptance step. The integration direction is then deterministically negated again irrespective of the accept decision, with the effect being that on acceptance the integration direction will be equal to its initial value and on rejection the integration direction will be the negation of its initial value.

Parameters:
  • system (System) – Hamiltonian system to be simulated.

  • integrator (Integrator) – Symplectic integrator appropriate to the specified Hamiltonian system.

abstract sample(state, rng)#

Sample a position-momentum pair using integration based proposal(s).

Samples new position and momentum values from a Markov transition kernel which leaves the canonical distribution on the state space corresponding to the Hamiltonian system invariant.

Parameters:
  • state (ChainState) – Current chain state.

  • rng (Generator) – Numpy random number generator.

Returns:

Tuple of updated state object and any statistics computed during the transition or None if no statistics.

Return type:

tuple[ChainState, Optional[dict[str, ScalarLike]]]

property state_variables: set[str]#

A set of names of state variables accessed by this transition.

property statistic_types: dict[str, tuple[DTypeLike, ScalarLike]]#

A dictionary describing the statistics computed during transition.

Either None if no statistics are returned by sample() method or a dictionary with string keys and tuple values, with the keys defining the keys of the statistics returned in the trans_stats return value of the sample() method and the first entry of the value tuples an appropriate NumPy dtype for the array used to store the corresponding statistic values and second entry the default value to initialize this array with.

class mici.transitions.MetropolisRandomIntegrationTransition(system, integrator, n_step_range)[source]#

Bases: MetropolisIntegrationTransition

Random integration transition with Metropolis sampling of new state.

In each transition a trajectory is generated by integrating the state in the current integration direction in time a random integer number of integrator steps sampled from the uniform distribution on an integer interval. The randomisation of the number of integration steps avoids the potential of the chain mixing poorly due to using an integration time close to the period of (near) periodic systems (Neal, 2011; Mackenzie, 1989).

References

  1. Neal, R.M. (2011). MCMC using Hamiltonian dynamics. Handbook of Markov Chain Monte Carlo, 2(11), p.2.

  2. Mackenzie, P.B. (1989). An improved hybrid Monte Carlo method. Physics Letters B, 226(3-4), pp.369-371.

Parameters:
  • system (System) – Hamiltonian system to be simulated.

  • integrator (Integrator) – Symplectic integrator appropriate to the specified Hamiltonian system.

  • n_step_range (tuple[int, int]) – Tuple (lower, upper) with two positive integer entries lower and upper (with upper > lower) specifying respectively the lower and upper bounds (inclusive) of integer interval to uniformly draw random number integrator steps to simulate in each transition.

sample(state, rng)[source]#

Sample a position-momentum pair using integration based proposal(s).

Samples new position and momentum values from a Markov transition kernel which leaves the canonical distribution on the state space corresponding to the Hamiltonian system invariant.

Parameters:
  • state (ChainState) – Current chain state.

  • rng (Generator) – Numpy random number generator.

Returns:

Tuple of updated state object and any statistics computed during the transition or None if no statistics.

Return type:

tuple[ChainState, Optional[dict[str, ScalarLike]]]

property state_variables: set[str]#

A set of names of state variables accessed by this transition.

property statistic_types: dict[str, tuple[DTypeLike, ScalarLike]]#

A dictionary describing the statistics computed during transition.

Either None if no statistics are returned by sample() method or a dictionary with string keys and tuple values, with the keys defining the keys of the statistics returned in the trans_stats return value of the sample() method and the first entry of the value tuples an appropriate NumPy dtype for the array used to store the corresponding statistic values and second entry the default value to initialize this array with.

class mici.transitions.MetropolisStaticIntegrationTransition(system, integrator, n_step)[source]#

Bases: MetropolisIntegrationTransition

Static integration transition with Metropolis sampling of new state.

In this variant the trajectory is generated by integrating the state through time a fixed number of integrator steps. This is original proposed Hybrid Monte Carlo (often now instead termed Hamiltonian Monte Carlo) algorithm (Duane et al., 1987; Neal, 2011).

References

  1. Duane, S., Kennedy, A.D., Pendleton, B.J. and Roweth, D. (1987). Hybrid Monte Carlo. Physics letters B, 195(2), pp.216-222.

  2. Neal, R.M. (2011). MCMC using Hamiltonian dynamics. Handbook of Markov Chain Monte Carlo, 2(11), p.2.

Parameters:
  • system (System) – Hamiltonian system to be simulated.

  • integrator (Integrator) – Symplectic integrator appropriate to the specified Hamiltonian system.

  • n_step (int) – Number of integrator steps to simulate in each transition.

sample(state, rng)[source]#

Sample a position-momentum pair using integration based proposal(s).

Samples new position and momentum values from a Markov transition kernel which leaves the canonical distribution on the state space corresponding to the Hamiltonian system invariant.

Parameters:
  • state (ChainState) – Current chain state.

  • rng (Generator) – Numpy random number generator.

Returns:

Tuple of updated state object and any statistics computed during the transition or None if no statistics.

Return type:

tuple[ChainState, Optional[dict[str, ScalarLike]]]

property state_variables: set[str]#

A set of names of state variables accessed by this transition.

property statistic_types: dict[str, tuple[DTypeLike, ScalarLike]]#

A dictionary describing the statistics computed during transition.

Either None if no statistics are returned by sample() method or a dictionary with string keys and tuple values, with the keys defining the keys of the statistics returned in the trans_stats return value of the sample() method and the first entry of the value tuples an appropriate NumPy dtype for the array used to store the corresponding statistic values and second entry the default value to initialize this array with.

class mici.transitions.MomentumTransition(system)[source]#

Bases: Transition

Base class for momentum transitions.

Markov transition kernel which leaves the conditional distribution on the momentum under the canonical distribution invariant, updating only the momentum component of the chain state.

Parameters:

system (System) – Hamiltonian system defining conditional distribution on momentum to leave invariant.

abstract sample(state, rng)[source]#

Sample a new momentum component to state.

Assigns a new momentum component to state by sampling from a Markov transition kernel which leaves the conditional distribution on the momentum under the canonical distribution defined by the Hamiltonian system invariant.

Parameters:
  • state (ChainState) – Current chain state to condition transition kernel on.

  • rng (Generator) – Numpy random number generator.

Returns:

Tuple of updated state object and any statistics computed during the transition or None if no statistics.

Return type:

tuple[ChainState, Optional[dict[str, ScalarLike]]]

property state_variables: set[str]#

A set of names of state variables accessed by this transition.

property statistic_types: dict[str, tuple[DTypeLike, ScalarLike]] | None#

A dictionary describing the statistics computed during transition.

Either None if no statistics are returned by sample() method or a dictionary with string keys and tuple values, with the keys defining the keys of the statistics returned in the trans_stats return value of the sample() method and the first entry of the value tuples an appropriate NumPy dtype for the array used to store the corresponding statistic values and second entry the default value to initialize this array with.

class mici.transitions.MultinomialDynamicIntegrationTransition(system, integrator, *, max_tree_depth=10, max_delta_h=1000.0, termination_criterion=<function riemannian_no_u_turn_criterion>, do_extra_subtree_checks=True)[source]#

Bases: DynamicIntegrationTransition

Dynamic integration transition with multinomial sampling of new state.

In each transition a binary tree of states is recursively computed by integrating randomly forward and backward in time by a number of steps equal to the previous tree size (Hoffman and Gelman, 2014; Betancourt, 2017) until a termination criteria on the tree leaves is met. The next chain state is chosen from the candidate states using a progressive multinomial sampling scheme (Betancourt, 2017) based on the relative probability densities of the different candidate states, with the sampling biased towards states further from the current state.

References

  1. Hoffman, M.D. and Gelman, A. (2014). The No-U-turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo. Journal of Machine Learning Research, 15(1), pp.1593-1623.

  2. Betancourt, M. (2017). A conceptual introduction to Hamiltonian Monte Carlo. arXiv preprint arXiv:1701.02434.

Parameters:
  • system (System) – Hamiltonian system to be simulated.

  • integrator (Integrator) – Symplectic integrator appropriate to the specified Hamiltonian system.

  • max_tree_depth (int) – Maximum depth to expand trajectory binary tree to. The maximum number of integrator steps corresponds to 2**max_tree_depth.

  • max_delta_h (float) – Maximum change to tolerate in the Hamiltonian function over a trajectory before signalling a divergence.

  • termination_criterion (TerminationCriterion) – Function computing criterion to use to determine when to terminate trajectory tree expansion. The function should take a Hamiltonian system as its first argument, a pair of states corresponding to the two edge nodes in the trajectory (sub-)tree being checked and an array containing the sum of the momentums over the trajectory (sub)-tree. Defaults to riemannian_no_u_turn_criterion.

  • do_extra_subtree_checks (bool) –

    Whether to perform additional termination criterion checks on overlapping subtrees of the current tree to improve robustness in systems with dynamics which are well approximated by independent system of simple harmonic oscillators. In such systems (corresponding to e.g. a standard normal target distribution and identity metric matrix representation) at certain step sizes a ‘resonant’ behaviour is seen by which the termination criterion fails to detect that the trajectory has expanded past a half-period i.e. has ‘U-turned’ resulting in trajectories continuing to expand, potentially up until the max_tree_depth limit is hit. For more details see this Stan Discourse discussion. If do_extra_subtree_checks is set to True additional termination criterion checks are performed on overlapping subtrees which help to reduce this resonant behaviour at the cost of more conservative trajectory termination in some correlated models and some overhead from additional checks.

sample(state, rng)#

Sample a position-momentum pair using integration based proposal(s).

Samples new position and momentum values from a Markov transition kernel which leaves the canonical distribution on the state space corresponding to the Hamiltonian system invariant.

Parameters:
  • state (ChainState) – Current chain state.

  • rng (Generator) – Numpy random number generator.

Returns:

Tuple of updated state object and any statistics computed during the transition or None if no statistics.

Return type:

tuple[ChainState, dict[str, ScalarLike]]

property state_variables: set[str]#

A set of names of state variables accessed by this transition.

property statistic_types: dict[str, tuple[DTypeLike, ScalarLike]]#

A dictionary describing the statistics computed during transition.

Either None if no statistics are returned by sample() method or a dictionary with string keys and tuple values, with the keys defining the keys of the statistics returned in the trans_stats return value of the sample() method and the first entry of the value tuples an appropriate NumPy dtype for the array used to store the corresponding statistic values and second entry the default value to initialize this array with.

class mici.transitions.SliceDynamicIntegrationTransition(system, integrator, *, max_tree_depth=10, max_delta_h=1000.0, termination_criterion=<function riemannian_no_u_turn_criterion>, do_extra_subtree_checks=True)[source]#

Bases: DynamicIntegrationTransition

Dynamic integration transition with slice sampling of new state.

In each transition a binary tree of states is recursively computed by integrating randomly forward and backward in time by a number of steps equal to the previous tree size until a termination criteria on the tree leaves is met. The next chain state is chosen from the candidate states using a progressive slice sampling scheme based on the relative probability densities of the different candidate states, with the slice sampler biased towards states further from the current state.

When used with the euclidean_no_u_turn_criterion this transition is equivalent to the transitions in ‘Algorithm 3: Efficient No-U-Turn Sampler’ in Hoffman and Gelman (2014).

References

  1. Hoffman, M.D. and Gelman, A. (2014). The No-U-turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo. Journal of Machine Learning Research, 15(1), pp.1593-1623.

Parameters:
  • system (System) – Hamiltonian system to be simulated.

  • integrator (Integrator) – Symplectic integrator appropriate to the specified Hamiltonian system.

  • max_tree_depth (int) – Maximum depth to expand trajectory binary tree to. The maximum number of integrator steps corresponds to 2**max_tree_depth.

  • max_delta_h (float) – Maximum change to tolerate in the Hamiltonian function over a trajectory before signalling a divergence.

  • termination_criterion (TerminationCriterion) – Function computing criterion to use to determine when to terminate trajectory tree expansion. The function should take a Hamiltonian system as its first argument, a pair of states corresponding to the two edge nodes in the trajectory (sub-)tree being checked and an array containing the sum of the momentums over the trajectory (sub)-tree. Defaults to riemannian_no_u_turn_criterion.

  • do_extra_subtree_checks (bool) –

    Whether to perform additional termination criterion checks on overlapping subtrees of the current tree to improve robustness in systems with dynamics which are well approximated by independent system of simple harmonic oscillators. In such systems (corresponding to e.g. a standard normal target distribution and identity metric matrix representation) at certain step sizes a ‘resonant’ behaviour is seen by which the termination criterion fails to detect that the trajectory has expanded past a half-period i.e. has ‘U-turned’ resulting in trajectories continuing to expand, potentially up until the max_tree_depth limit is hit. For more details see this Stan Discourse discussion. If do_extra_subtree_checks is set to True additional termination criterion checks are performed on overlapping subtrees which help to reduce this resonant behaviour at the cost of more conservative trajectory termination in some correlated models and some overhead from additional checks.

sample(state, rng)#

Sample a position-momentum pair using integration based proposal(s).

Samples new position and momentum values from a Markov transition kernel which leaves the canonical distribution on the state space corresponding to the Hamiltonian system invariant.

Parameters:
  • state (ChainState) – Current chain state.

  • rng (Generator) – Numpy random number generator.

Returns:

Tuple of updated state object and any statistics computed during the transition or None if no statistics.

Return type:

tuple[ChainState, dict[str, ScalarLike]]

property state_variables: set[str]#

A set of names of state variables accessed by this transition.

property statistic_types: dict[str, tuple[DTypeLike, ScalarLike]]#

A dictionary describing the statistics computed during transition.

Either None if no statistics are returned by sample() method or a dictionary with string keys and tuple values, with the keys defining the keys of the statistics returned in the trans_stats return value of the sample() method and the first entry of the value tuples an appropriate NumPy dtype for the array used to store the corresponding statistic values and second entry the default value to initialize this array with.

class mici.transitions.Transition[source]#

Bases: ABC

Base class for Markov transition kernels.

Defines expected interface for transitions by sampler classes.

abstract sample(state, rng)[source]#

Sample a new chain state from the Markov transition kernel.

Parameters:
  • state (ChainState) – Current chain state to condition transition kernel on.

  • rng (Generator) – Numpy random number generator.

Returns:

Tuple of updated state object and any statistics computed during the transition or None if no statistics.

Return type:

tuple[ChainState, Optional[dict[str, ScalarLike]]]

abstract property state_variables: set[str]#

A set of names of state variables accessed by this transition.

property statistic_types: dict[str, tuple[DTypeLike, ScalarLike]] | None#

A dictionary describing the statistics computed during transition.

Either None if no statistics are returned by sample() method or a dictionary with string keys and tuple values, with the keys defining the keys of the statistics returned in the trans_stats return value of the sample() method and the first entry of the value tuples an appropriate NumPy dtype for the array used to store the corresponding statistic values and second entry the default value to initialize this array with.

mici.transitions.euclidean_no_u_turn_criterion(system, state_1, state_2, _sum_mom)[source]#

No-U-turn termination criterion for Euclidean manifolds.

Terminates trajectories when the velocities at the terminal states of the trajectory both have negative dot products with the vector from the position of the first terminal state to the position of the second terminal state, corresponding to further evolution of the trajectory reducing the distance between the terminal state positions.

Parameters:
  • system (System) – Hamiltonian system being integrated.

  • state_1 (ChainState) – First terminal state of trajectory.

  • state_2 (ChainState) – Second terminal state of trajectory.

  • _sum_mom (ArrayLike) – Sum of momentums of trajectory states (unused).

Returns:

Whether termination criterion is satisfied.

Return type:

bool

References

  1. Hoffman, M.D. and Gelman, A. (2014). The No-U-turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo. Journal of Machine Learning Research, 15(1), pp.1593-1623.

mici.transitions.riemannian_no_u_turn_criterion(system, state_1, state_2, sum_mom)[source]#

Generalized no-U-turn termination criterion on Riemannian manifolds.

Terminates trajectories when the velocities at the terminal states of the trajectory both have negative dot products with the sum of the the momentums across the trajectory from the first to second terminal state of the first terminal state to the position of the second terminal state (Betancourt, 2013). This generalizes the no-U-turn criterion of Hoffman and Gelman (2014) to Riemannian manifolds where due to the intrinsic curvature of the space the geodesic between two points is general no longer a straight line.

Parameters:
  • system (System) – Hamiltonian system being integrated.

  • state_1 (ChainState) – First terminal state of trajectory.

  • state_2 (ChainState) – Second terminal state of trajectory.

  • sum_mom (ArrayLike) – Sum of momentums of trajectory states.

Returns:

Whether termination criterion is satisfied.

Return type:

bool

References

  1. Hoffman, M.D. and Gelman, A. (2014). The No-U-turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo. Journal of Machine Learning Research, 15(1), pp.1593-1623.

  2. Betancourt, M. (2013). Generalizing the no-U-turn sampler to Riemannian manifolds. arXiv preprint arXiv:1304.1920.