Diagnostics Functions¶
- birdman.diagnostics.ess(inference_object: InferenceData, params: Optional[List[str]] = None, **kwargs) Dataset ¶
Estimate effective sample size for parameters.
Wrapper function for
az.ess
.See https://arviz-devs.github.io/arviz/api/generated/arviz.ess.html for details.
See Stan docs for more information on ESS.
- Parameters
inference_object (az.InferenceData) – Inference object with posterior draws
params (List[str]) – Variables to include, defaults to all
kwargs – Keyword arguments to pass to
az.ess
- Returns
Estimated effective sample sizes
- Return type
xr.Dataset
- birdman.diagnostics.loo(inference_object: InferenceData, **kwargs) ELPDData ¶
Compute Pareto-smoothed importance sampling LOO CV.
Wrapper function for
az.loo
.See https://arviz-devs.github.io/arviz/api/generated/arviz.loo.html for details.
Note
This function requires that the inference object has a
log_likelihood
group.- Parameters
inference_object (az.InferenceData) – Inference object with posterior draws
kwargs – Keyword arguments to pass to
az.loo
- Returns
Estimated log pointwise predictive density
- Return type
az.ELPDData
- birdman.diagnostics.r2_score(inference_object: InferenceData) Series ¶
Compute Bayesian \(R^2\).
Wrapper function for
az.r2_score
.Note
This function requires that the inference object has a
posterior_predictive
group.- Parameters
inference_object (az.InferenceData) – Inference object with posterior draws
- Returns
Bayesian \(R^2\) & standard deviation
- Return type
pd.Series
- birdman.diagnostics.rhat(inference_object: InferenceData, params: Optional[List[str]] = None, **kwargs) Dataset ¶
Estimate Gelman-Rubin statistic of chain convergence.
Wrapper function for
az.rhat
.See https://arviz-devs.github.io/arviz/api/generated/arviz.rhat.html for details.
Rhat values should be very close to 1.0.
- Parameters
inference_object (az.InferenceData) – Inference object with posterior draws
params (List[str]) – Variables to include, defaults to all
kwargs – Keyword arguments to pass to
az.rhat
- Returns
Estimated Rhat values
- Return type
xr.Dataset