get_scene_samples

get_scene_samples#

scarlet2.infer.get_scene_samples(scene, uncertainties, samples=100, key=None)[source]#

Draw posterior sample scenes from a Laplace approximation.

Treats every parameter named in uncertainties as normally distributed, with mean taken from scene and standard deviation from uncertainties (e.g. as returned by uncertainty()), and draws independent joint samples. Each sample is inserted back into scene to produce one self-consistent variant of the model.

Parameters that are not included in scene (e.g. observational parameters) will be ignored.

Parameters:
  • scene (Scene) – The (fitted) model of the scene whose parameter means are sampled around.

  • uncertainties (dict) – Maps parameter name to its standard deviation, of the same shape as the parameter (e.g. the output of uncertainty()).

  • samples (int, optional) – Number of scene samples to draw.

  • key (jax.random.PRNGKey, optional) – A random key for sampling. If None, a new key will be generated.

Returns:

samples scene variants, each with one joint draw of the parameters in uncertainties substituted in.

Return type:

list of Scene