From 8a0a4fc3300311ba628414de51fcb5a0b916eb5d Mon Sep 17 00:00:00 2001 From: Thore Kockerols Date: Fri, 29 Nov 2024 13:12:58 +0000 Subject: [PATCH] more grid points on findiff tests --- test/runtests.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index c6b8ed14..73419fbd 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -207,7 +207,7 @@ if test_set == "plots" back_grad = Zygote.gradient(x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) - fin_grad = FiniteDifferences.grad(FiniteDifferences.central_fdm(3,1),x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) + fin_grad = FiniteDifferences.grad(FiniteDifferences.central_fdm(4,1),x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) @test isapprox(back_grad[1], fin_grad[1], rtol = 1e-6) end @@ -229,7 +229,7 @@ if test_set == "plots" back_grad = Zygote.gradient(x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) - fin_grad = FiniteDifferences.grad(FiniteDifferences.central_fdm(3,1, max_range = 1e-4),x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) + fin_grad = FiniteDifferences.grad(FiniteDifferences.central_fdm(4,1, max_range = 1e-4),x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) @test isapprox(back_grad[1], fin_grad[1], rtol = 1e-6) end @@ -249,7 +249,7 @@ if test_set == "plots" back_grad = Zygote.gradient(x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) - fin_grad = FiniteDifferences.grad(FiniteDifferences.central_fdm(3,1),x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) + fin_grad = FiniteDifferences.grad(FiniteDifferences.central_fdm(4,1),x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) @test isapprox(back_grad[1], fin_grad[1], rtol = 1e-6) end @@ -269,7 +269,7 @@ if test_set == "plots" back_grad = Zygote.gradient(x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) - fin_grad = FiniteDifferences.grad(FiniteDifferences.central_fdm(3,1),x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) + fin_grad = FiniteDifferences.grad(FiniteDifferences.central_fdm(4,1),x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) @test isapprox(back_grad[1], fin_grad[1], rtol = 1e-6) end @@ -290,7 +290,7 @@ if test_set == "plots" back_grad = Zygote.gradient(x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) - fin_grad = FiniteDifferences.grad(FiniteDifferences.central_fdm(3,1),x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) + fin_grad = FiniteDifferences.grad(FiniteDifferences.central_fdm(4,1),x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) @test isapprox(back_grad[1], fin_grad[1], rtol = 1e-6) end @@ -312,7 +312,7 @@ if test_set == "plots" back_grad = Zygote.gradient(x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) - fin_grad = FiniteDifferences.grad(FiniteDifferences.central_fdm(3,1),x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) + fin_grad = FiniteDifferences.grad(FiniteDifferences.central_fdm(4,1),x-> get_loglikelihood(m, simulated_data(observables, :, :simulate), x), m.parameter_values) @test isapprox(back_grad[1], fin_grad[1], rtol = 1e-6) end