calibration#

Module Contents#

Functions#

get_p_Y_val_approx_mahalanobis(post_samples, y_mean, ...)

Calculate the percentage of draws from the predicted distribution that

plot_calibration(post_samples, y_mean, y_truth, cov[, ...])

Plot the calibration metric for a grid of p_X percentages,

calibration.get_p_Y_val_approx_mahalanobis(post_samples, y_mean, y_truth, cov)[source]#

Calculate the percentage of draws from the predicted distribution that encompasses the truth, for all of the examples in the validation set.

Parameters#

post_samplesnp.array of shape [n_samples, n_sightlines, Y_dim]

BNN posterior samples

y_meannp.array of shape [n_lenses, Y_dim]

Central prediction to use in the distance calculation

y_truth: np.array of shape [n_lenses, Y_dim]

True values

covfloat

Scale factor to use in the distance calculation

Notes#

Adapted from swagnercarena/ovejero

calibration.plot_calibration(post_samples, y_mean, y_truth, cov, color_map=['#377eb8', '#4daf4a'], n_perc_points=20, figure=None, ls='--', legend=None, show_plot=True, block=True, title=None, dpi=200)[source]#

Plot the calibration metric for a grid of p_X percentages, with error bars obtained through jackknife sampling

Parameters#

See the docstring for get_p_Y_val_approx_mahalanobis. n_perc_points : int

Grid size of p_X (probability volume) to compare p_Y against

Notes#

Adapted from swagnercarena/ovejero