Closed marcoct closed 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
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
Changes to implement this are shown under %IRIS-MW
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)
Like in the paper. immediately after the first importance sampling demo.