Skip to content

Commit

Permalink
fix wrong usage of n_montecarlo in inference tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Red-Portal committed Dec 5, 2024
1 parent 09c7276 commit 801a76b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 15 deletions.
5 changes: 2 additions & 3 deletions test/inference/repgradelbo_distributionsad.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ end
[Float64, Float32],
(modelname, modelconstr) in Dict(:Normal => normal_meanfield),
(objname, objective) in Dict(
:RepGradELBOClosedFormEntropy => RepGradELBO(n_montecarlo),
:RepGradELBOClosedFormEntropy => RepGradELBO(10),
:RepGradELBOStickingTheLanding =>
RepGradELBO(n_montecarlo; entropy=StickingTheLandingEntropy()),
RepGradELBO(10; entropy=StickingTheLandingEntropy()),
),
(adbackname, adtype) in AD_repgradelbo_distributionsad

Expand All @@ -30,7 +30,6 @@ end
T = 1000
η = 1e-3
opt = Optimisers.Descent(realtype(η))
n_montecarlo = 10

# For small enough η, the error of SGD, Δλ, is bounded as
# Δλ ≤ ρ^T Δλ0 + O(η),
Expand Down
5 changes: 2 additions & 3 deletions test/inference/repgradelbo_locationscale.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ end
(modelname, modelconstr) in
Dict(:Normal => normal_meanfield, :Normal => normal_fullrank),
(objname, objective) in Dict(
:RepGradELBOClosedFormEntropy => RepGradELBO(n_montecarlo),
:RepGradELBOClosedFormEntropy => RepGradELBO(10),
:RepGradELBOStickingTheLanding =>
RepGradELBO(n_montecarlo; entropy=StickingTheLandingEntropy()),
RepGradELBO(10; entropy=StickingTheLandingEntropy()),
),
(adbackname, adtype) in AD_repgradelbo_locationscale

Expand All @@ -31,7 +31,6 @@ end
T = 1000
η = 1e-3
opt = Optimisers.Descent(realtype(η))
n_montecarlo = 10

# For small enough η, the error of SGD, Δλ, is bounded as
# Δλ ≤ ρ^T Δλ0 + O(η),
Expand Down
5 changes: 2 additions & 3 deletions test/inference/repgradelbo_locationscale_bijectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ end
(modelname, modelconstr) in
Dict(:NormalLogNormalMeanField => normallognormal_meanfield),
(objname, objective) in Dict(
:RepGradELBOClosedFormEntropy => RepGradELBO(n_montecarlo),
:RepGradELBOClosedFormEntropy => RepGradELBO(10),
:RepGradELBOStickingTheLanding =>
RepGradELBO(n_montecarlo; entropy=StickingTheLandingEntropy()),
RepGradELBO(10; entropy=StickingTheLandingEntropy()),
),
(adbackname, adtype) in AD_repgradelbo_locationscale_bijectors

Expand All @@ -31,7 +31,6 @@ end
T = 1000
η = 1e-3
opt = Optimisers.Descent(realtype(η))
n_montecarlo = 10

b = Bijectors.bijector(model)
b⁻¹ = inverse(b)
Expand Down
3 changes: 1 addition & 2 deletions test/inference/scoregradelbo_distributionsad.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end
@testset "$(modelname) $(objname) $(realtype) $(adbackname)" for realtype in
[Float64, Float32],
(modelname, modelconstr) in Dict(:Normal => normal_meanfield),
(objname, objective) in Dict(:ScoreGradELBO => ScoreGradELBO(n_montecarlo)),
(objname, objective) in Dict(:ScoreGradELBO => ScoreGradELBO(10)),
(adbackname, adtype) in AD_scoregradelbo_distributionsad

seed = (0x38bef07cf9cc549d)
Expand All @@ -26,7 +26,6 @@ end
T = 1000
η = 1e-4
opt = Optimisers.Descent(realtype(η))
n_montecarlo = 10

# For small enough η, the error of SGD, Δλ, is bounded as
# Δλ ≤ ρ^T Δλ0 + O(η),
Expand Down
3 changes: 1 addition & 2 deletions test/inference/scoregradelbo_locationscale.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ end
[Float64, Float32],
(modelname, modelconstr) in
Dict(:Normal => normal_meanfield, :Normal => normal_fullrank),
(objname, objective) in Dict(:ScoreGradELBO => ScoreGradELBO(n_montecarlo)),
(objname, objective) in Dict(:ScoreGradELBO => ScoreGradELBO(10)),
(adbackname, adtype) in AD_scoregradelbo_locationscale

seed = (0x38bef07cf9cc549d)
Expand All @@ -27,7 +27,6 @@ end
T = 1000
η = 1e-4
opt = Optimisers.Descent(realtype(η))
n_montecarlo = 10

# For small enough η, the error of SGD, Δλ, is bounded as
# Δλ ≤ ρ^T Δλ0 + O(η),
Expand Down
3 changes: 1 addition & 2 deletions test/inference/scoregradelbo_locationscale_bijectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ end
[Float64, Float32],
(modelname, modelconstr) in
Dict(:NormalLogNormalMeanField => normallognormal_meanfield),
(objname, objective) in Dict(:ScoreGradELBO => ScoreGradELBO(n_montecarlo)),
(objname, objective) in Dict(:ScoreGradELBO => ScoreGradELBO(10)),
(adbackname, adtype) in AD_scoregradelbo_locationscale_bijectors

seed = (0x38bef07cf9cc549d)
Expand All @@ -27,7 +27,6 @@ end
T = 1000
η = 1e-4
opt = Optimisers.Descent(realtype(η))
n_montecarlo = 10

b = Bijectors.bijector(model)
b⁻¹ = inverse(b)
Expand Down

0 comments on commit 801a76b

Please sign in to comment.