bayes_factor_recovery#

bayesflow.diagnostics.plots.bayes_factor_recovery(pred_log_bayes_factors: ndarray, true_log_bayes_factors: ndarray, true_models: ndarray, model_names: Sequence[str] = None, reference_model: int = 0, add_corr: bool = True, figsize: tuple = None, label_fontsize: int = 16, title_fontsize: int = 18, metric_fontsize: int = 14, tick_fontsize: int = 12, alpha: float = 0.5, markersize: float = None, num_col: int = None, num_row: int = None) Figure[source]#

Scatter plot of true vs. predicted log Bayes factors for M-model comparison.

Produces one subplot per competing model, each showing the predicted log Bayes factor against the analytically or numerically exact value. Points are coloured by the true generating model. Quadrant shading distinguishes correct decisions (true and predicted Bayes factors favour the same model) from incorrect ones.

Parameters:
pred_log_bayes_factorsnp.ndarray of shape (num_datasets, num_models - 1)

Predicted log Bayes factors log BF_{k, reference} for k != reference, as output by a Bayes factor scoring rule network.

true_log_bayes_factorsnp.ndarray of shape (num_datasets, num_models - 1)

Ground-truth log Bayes factors with the same column ordering as pred_log_bayes_factors.

true_modelsnp.ndarray of shape (num_datasets, num_models) or (num_datasets,)

Either one-hot encoded model labels or integer class indices.

model_namesSequence[str] or None, optional

Human-readable names for all num_models models, used for axis labels and the legend. Defaults to M_1, M_2, ....

reference_modelint, optional

Index (0-based) of the reference model against which all log Bayes factors are computed (default: 0).

add_corrbool, optional

Annotate each panel with the Pearson correlation between true and predicted log Bayes factors (default: True).

figsizetuple or None, optional

Passed to matplotlib. Inferred from the number of panels if None.

label_fontsizeint, optional

Font size for axis labels (default: 16).

title_fontsizeint, optional

Font size for subplot titles (default: 18).

metric_fontsizeint, optional

Font size for the correlation annotation (default: 14).

tick_fontsizeint, optional

Font size for tick labels (default: 12).

alphafloat, optional

Scatter point opacity (default: 0.5).

markersizefloat or None, optional

Scatter point size in points (default: None → matplotlib default).

num_colint or None, optional

Number of subplot columns. Inferred if None.

num_rowint or None, optional

Number of subplot rows. Inferred if None.

Returns:
figplt.Figure