Hi,
I’d like to estimate a model y=f(g(h(x)))
and update the parameters in an alternating fashion, i.e.
- in every even SVI step, I’d like to update the parameters of
g
andh
, and - in every odd SVI step, I’d like to update the parameters of
f
andh
.
Hence, h
is always updated. One can assume that all f,g,h
are simple non-linear functions.
If I understand correctly, unlike in Pytorch, I cannot simply set .required_grad
to False
for certain parameters in the Guide.
What I tried so far:
- First, I tried to use 2 different Guides, one for
h, f
and one forh, g
. This does not make sense, because they do not shareh
. - Second, I used an if statement in my guide and skipped the sample statements of
g
every other epoch, but somehow the parameters ofg
are still updated. Is that to be expected?
Are there any other possible solutions (or a fix for 2)? I am also happy to provide a minimum working example.
Thanks in advance!