Skip to content

Conversation

@cscherrer
Copy link
Owner

I got importance sampling working. Here's a little example:

julia> importanceSample(p(),q=0.0, σ=0.5), (y=y,))
Weighted(-7.45008.4
,(x = -0.5199557318297471,)


julia> p = @model begin
           x ~ Normal()
           y ~ Normal(x,1) |> iid(5)
       end;

julia> q = @model μ,σ begin
           x ~ Normal(μ,σ)
       end;

julia> y = rand(p()).y;

julia> importanceSample(p(),q=0.0, σ=0.5), (y=y,))
Weighted(-7.13971.4
,(x = -0.12280566635062592,)

This can be used on its own or as part of variational inference

@cscherrer cscherrer merged commit 97e49f2 into master Oct 20, 2020
@cscherrer cscherrer deleted the cs-importance-sampling branch October 20, 2020 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants