From ac88dc8961e5e2737b6148312c953211084e45c4 Mon Sep 17 00:00:00 2001 From: Alejandro Moreo Date: Tue, 21 Nov 2023 10:26:13 +0100 Subject: [PATCH] understanding importance sampling --- .../tmp/understanding_divergence_montecarlo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distribution_matching/tmp/understanding_divergence_montecarlo.py b/distribution_matching/tmp/understanding_divergence_montecarlo.py index 8276f59..afce141 100644 --- a/distribution_matching/tmp/understanding_divergence_montecarlo.py +++ b/distribution_matching/tmp/understanding_divergence_montecarlo.py @@ -71,7 +71,7 @@ def montecarlo_classweight(p, q, f=hd2, trials=TRIALS, epsilon=EPS): qs = q.pdf(xs)+epsilon N = trials n = q.n - return (1/(N*n))*np.sum(weights*f(ps/qs)) + return (1/(N))*np.sum(weights*f(ps/qs)) class Q: