Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions bayesflow/diagnostics/plots/calibration_ecdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,11 @@ def calibration_ecdf(
tq_targets = test_quantity_fn(data=targets)
test_quantities_targets[key] = np.expand_dims(tq_targets, axis=1)

# # Flatten estimates for batch processing in test_quantity_fn, apply function, and restore shape
# Flatten estimates for batch processing in test_quantity_fn, apply function, and restore shape
num_conditions, num_samples = next(iter(estimates.values())).shape[:2]
flattened_estimates = keras.tree.map_structure(lambda t: np.reshape(t, (-1, *t.shape[2:])), estimates)
flattened_estimates = keras.tree.map_structure(
lambda t: np.reshape(t, (num_conditions * num_samples, *t.shape[2:])), estimates
)
flat_tq_estimates = test_quantity_fn(data=flattened_estimates)
test_quantities_estimates[key] = np.reshape(flat_tq_estimates, (num_conditions, num_samples, 1))

Expand Down
378 changes: 325 additions & 53 deletions examples/Linear_Regression_Starter.ipynb

Large diffs are not rendered by default.