Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Domain error when using optimize_prior! #129

Open
pasq-cat opened this issue Nov 7, 2024 · 0 comments
Open

Domain error when using optimize_prior! #129

pasq-cat opened this issue Nov 7, 2024 · 0 comments

Comments

@pasq-cat
Copy link
Member

pasq-cat commented Nov 7, 2024

I was doing some tests for that paper i mentioned last time and sometimes when i try to fit the priors with

LaplaceRedux.fit!(la, data_loader)
optimize_prior!(la;verbose = false, n_steps = 200)

i get this error message

DomainError with -1.0:
log was called with a negative real argument but will only return a complex result if called with a complex argument. Try log(Complex(x)).

Stacktrace:
[1] throw_complex_domainerror(f::Symbol, x::Float64)
@ Base.Math .\math.jl:33
[2] _log
@ .\special\log.jl:295 [inlined]
[3] log(x::Float64)
@ Base.Math .\special\log.jl:261
[4] logdet
@ C:\Users\Pasqu.julia\juliaup\julia-1.11.1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\LinearAlgebra\src\generic.jl:1719 [inlined]
[5] rrule
@ C:\Users\Pasqu.julia\packages\ChainRules\vdf7M\src\rulesets\LinearAlgebra\dense.jl:148 [inlined]
[6] rrule
@ C:\Users\Pasqu.julia\packages\ChainRulesCore\6Pucz\src\rules.jl:138 [inlined]
[7] chain_rrule
@ C:\Users\Pasqu.julia\packages\Zygote\NRp5C\src\compiler\chainrules.jl:224 [inlined]
[8] macro expansion
@ C:\Users\Pasqu.julia\packages\Zygote\NRp5C\src\compiler\interface2.jl:0 [inlined]
[9] _pullback(ctx::Zygote.Context{true}, f::typeof(logdet), args::Matrix{Float64})
@ Zygote C:\Users\Pasqu.julia\packages\Zygote\NRp5C\src\compiler\interface2.jl:87
[10] log_det_posterior_precision
@ C:\Users\Pasqu.julia\packages\LaplaceRedux\LwTNd\src\baselaplace\utils.jl:157 [inlined]
[11] _pullback(ctx::Zygote.Context{true}, f::typeof(LaplaceRedux.log_det_posterior_precision), args::Laplace)
...
@ Zygote C:\Users\Pasqu.julia\packages\Zygote\NRp5C\src\compiler\interface.jl:147
[24] optimize_prior!(la::Laplace; n_steps::Int64, lr::Float64, λinit::Nothing, σinit::Nothing, verbose::Bool, tune_σ::Bool)
@ LaplaceRedux C:\Users\Pasqu.julia\packages\LaplaceRedux\LwTNd\src\baselaplace\optimize_prior.jl:40

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant