to_arviz_inference_data()#
- liesel.experimental.arviz.to_arviz_inference_data(results, include_warmup=False)[source]#
Converts goose’s SamplingResults into InferenceData from arviz.
Arviz’ InferenceData seperates samples from the posterior and the warmup in the groups ‘posterior’ and ‘warmup_posterior’. By default, all summaries and plots use only the data in the group ‘posterior’.
- Parameters:
results (
SamplingResults
) – The sampling results.include_warmup (
bool
) – Whether to include the warmup in the returned object. (default:False
)
- Return type:
InferenceData
- Returns:
The inference data.
Notes
The inference data has a variable for each position key included in the SamplingResult object. These are usually the position keys of the sampled parameters. Goose can track more values if specified in the field
position_included
. This might be helpful to let arviz calculate information criteria like WAIC. Assuming that the position keyloglik_pointwise
corresponds to the point-wise evaluated log-likelihood then the inference data can be slightly changed so that arviz interprets these values as intended.# re-interpret the data llpw_extracted = idat.posterior['loglik_pointwise'] idat.posterior = idat.posterior.drop('loglik_pointwise') idat.add_groups({'log_likelihood': {'observed': llpw_extracted}}) az.waic(idat) # Computed from 300 posterior samples and 10 observations log-likelihood matrix. # Estimate SE # elpd_waic. -17.43 3.40 # p_waic 0.16 -