DiffEqFlux.jl icon indicating copy to clipboard operation
DiffEqFlux.jl copied to clipboard

SGLD and pSGLD: incorrect weighting of noise term

Open evolbio opened this issue 3 years ago • 2 comments

The noise term may be weighted incorrectly for SGLD and pSGLD. I am just learning this topic and apologize if I have misread the theory.

For SGLD, on page https://diffeqflux.sciml.ai/stable/examples/BayesianNODE_SGLD/, in the sgld() function, the variance of the noise should be , which means that randn in the noise term should be weighted by .

For preconditioned SGLD (pSGLD), the sample code is in https://github.com/RajDandekar/MSML21_BayesianNODE, in the files BayesiaNUDE_PSGLD_LV.jl and BayesianUDE_SEIR.jl. In that code, the preconditioning values are calculated as m. Let g = 1 ./ m, then the gradient is correctly weighted by g. However, the noise should be weighted by , which is not done.

evolbio avatar Mar 26 '22 13:03 evolbio

@RajDandekar

ChrisRackauckas avatar Mar 26 '22 13:03 ChrisRackauckas

@evolbio I will take a look at this..

RajDandekar avatar Mar 28 '22 00:03 RajDandekar

Removed.

ChrisRackauckas avatar Nov 22 '23 16:11 ChrisRackauckas