:py:mod:`calibration` ===================== .. py:module:: calibration Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: calibration.get_p_Y_val_approx_mahalanobis calibration.plot_calibration .. py:function:: get_p_Y_val_approx_mahalanobis(post_samples, y_mean, y_truth, cov) Calculate the percentage of draws from the predicted distribution that encompasses the truth, for all of the examples in the validation set. Parameters ---------- post_samples : np.array of shape [n_samples, n_sightlines, Y_dim] BNN posterior samples y_mean : np.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 cov : float Scale factor to use in the distance calculation Notes ----- Adapted from https://github.com/swagnercarena/ovejero .. py:function:: 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) 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 https://github.com/swagnercarena/ovejero