flow

This module contains functions to estimate the probability of a parameter shift given a synthetic probability model of the parameter difference distribution.

For further details we refer to arxiv 2105.03324.

tensiometer.mcmc_tension.flow.estimate_shift(flow, prior_flow=None, tol=0.05, max_iter=1000, step=100000)[source]

Compute the normalizing flow estimate of the probability of a parameter shift given the input parameter difference chain. This is done with a Monte Carlo estimate by comparing the probability density at the zero-shift point to that at samples drawn from the normalizing flow approximation of the distribution.

Parameters:
  • flow – the input flow for a parameter difference distribution.

  • prior_flow – the input flow for the prior distribution, defaults to None.

  • tol (float, optional) – absolute tolerance on the shift significance, defaults to 0.05.

  • max_iter (int, optional) – maximum number of sampling steps, defaults to 1000.

  • step (int, optional) – number of samples per step, defaults to 100000.

Returns:

probability value and error estimate.

tensiometer.mcmc_tension.flow.estimate_shift_from_samples(flow, prior_flow=None)[source]

Compute the normalizing flow estimate of the probability of a parameter shift given the input parameter difference chain. This is done with a Monte Carlo estimate by comparing the probability density at the zero-shift point to that at samples drawn from the normalizing flow approximation of the distribution. This function does not use the flow to sample but rather uses the input samples. As a downside there is no control on the end accuracy of the estimate.

Parameters:
  • flow – the input flow for a parameter difference distribution.

  • prior_flow – the input flow for the prior distribution, defaults to None.

  • tol (float, optional) – absolute tolerance on the shift significance, defaults to 0.05.

  • max_iter (int, optional) – maximum number of sampling steps, defaults to 1000.

  • step (int, optional) – number of samples per step, defaults to 100000.

Returns:

probability value and error estimate.

tensiometer.mcmc_tension.flow.flow_parameter_shift(diff_chain, cache_dir=None, root_name='sprob', tol=0.05, max_iter=1000, step=100000, **kwargs)[source]

Wrapper function to compute a normalizing flow estimate of the probability of a parameter shift given the input parameter difference chain. The function accepts as kwargs all the ones that are relevant for the function flow_from_chain.

Parameters:
  • diff_chain (MCSamples) – input parameter difference chain.

  • cache_dir – name of the directory to save training cache files. If none (default) does not cache.

  • root_name – root name for the cache files.

  • tol (float, optional) – absolute tolerance on the shift significance, defaults to 0.05.

  • max_iter (int, optional) – maximum number of sampling steps, defaults to 1000.

  • step (int, optional) – number of samples per step, defaults to 100000.

Returns:

probability value and error estimate, then the parameter difference flow