probcomp / GenExperimental.jl

Featherweight embedded probabilistic programming language and compositional inference programming library
MIT License
17 stars 2 forks source link

Add missing door demo to goal inference notebook. #28

Closed marcoct closed 7 years ago

marcoct commented 7 years ago

Like in the paper. immediately after the first importance sampling demo.

marcoct commented 7 years ago

For this part of the model program agent_model:

    # assumed scene
    scene = Scene(0, 100, 0, 100) # the scene spans the square [0, 100] x [0, 100]
    add!(scene, Tree(Point(30, 20))) # place a tree at x=30, y=20
    add!(scene, Tree(Point(83, 80)))
    add!(scene, Tree(Point(80, 40)))
    wall_height = 30.
    add!(scene, Wall(Point(20., 40.), 1, 40., 2., wall_height))
    add!(scene, Wall(Point(60., 40.), 2, 40., 2., wall_height))
    add!(scene, Wall(Point(60.-15., 80.), 1, 15. + 2., 2., wall_height))
    add!(scene, Wall(Point(20., 80.), 1, 15., 2., wall_height))
    add!(scene, Wall(Point(20., 40.), 2, 40., 2., wall_height))    

Make the walls be added something like this:

wall_height = 30.
walls = [
    Wall(Point(20., 40.), 1, 40., 2., wall_height)
    Wall(Point(60., 40.), 2, 40., 2., wall_height)
    Wall(Point(60.-15., 80.), 1, 15. + 2., 2., wall_height)
    Wall(Point(20., 80.), 1, 15., 2., wall_height)
    Wall(Point(20., 40.), 2, 40., 2., wall_height)    ] ~ "walls"
for wall in walls
    add!(scene, wall)
end

Then, add a subsection to the end of section 3, that changes the walls to make a door in the bottom wall, by using intervene!, e.g. something like:

trace = Trace()
new_walls = [ .... ] # a list of walls that includes a door in the bottom
intervene!(trace, "walls", new_walls)
... do importance sampling inference like before
marcoct commented 7 years ago

Use the same dataset (i.e. dataset) as before. The results should look something like Figure 2(b) in https://arxiv.org/pdf/1704.04977.pdf

mirisr commented 7 years ago

Changes to implement this are shown under %IRIS-MW

  1. Changed the model to make 'walls' a variable in the trace 2.Added SIR inference with gap in the upper wall
  2. Added section explaining the new inferences (don't need to use... just there in case)

passing this to Marco to add to official notebook. Let me know if your'd like this in MH as well (i don't think you need to)

screen shot 2017-06-23 at 1 10 37 pm
marcoct commented 7 years ago

Integrated in https://github.com/probcomp/gen-examples/commit/b4c8dcc203204bbf0be55db6a102a7336f58b108