Skip to content

Commit 5969bd3

Browse files
committed
robust mean scores
1 parent 89361f7 commit 5969bd3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

bayesflow/networks/diffusion_model/diffusion_model.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -734,13 +734,11 @@ def compositional_score(
734734
individual_scores = self._compute_individual_scores(xz, log_snr_t, alpha_t, sigma_t, conditions_batch, training)
735735

736736
# Compute prior score component
737-
prior_score = compute_prior_score(xz)
737+
weighted_prior_score = (1.0 - time) * compute_prior_score(xz)
738738

739739
# Combine scores using compositional formula, mean over individual scores and scale with n to get sum
740-
summed_individual_scores = n_compositional * ops.mean(individual_scores, axis=1)
741-
742-
# Prior contribution
743-
weighted_prior_score = (1.0 - n_compositional) * (1.0 - time) * prior_score
740+
weighted_individual_scores = individual_scores - weighted_prior_score
741+
summed_individual_scores = n_compositional * ops.mean(weighted_individual_scores, axis=1)
744742

745743
# Combined score
746744
time_tensor = ops.cast(time, dtype=ops.dtype(xz))

0 commit comments

Comments
 (0)