BayesianLogic / blog

The BLOG programming language
http://bayesianlogic.github.io/
BSD 4-Clause "Original" or "Old" License
98 stars 31 forks source link

DBLOG and backinstantiation #339

Closed davidenitti closed 9 years ago

davidenitti commented 9 years ago

In the DBLOG workshop poster a method to avoid backinstantiation is mentioned. Can I try this in the code?

jxwuyi commented 9 years ago

Which poster? What did you mean by backinstantiation?

davidenitti commented 9 years ago

this poster http://www.ai.sri.com/~braz/papers/nips08.ppt The backinstantiation is explained in the poster: if I have a cell grid with a distribution that does not change over time cell(x,y)_t+1=cell(x,y)_t and cell(x,y)_0~distribution. If I query cell(x,y) at time 100 it will sample all the variables cell(x,y) from 0 to 100, instead it would be meaningful to directly sample from the belief distribution cell(x,y)_t~distribution that does not change over time (in this case).

jxwuyi commented 9 years ago

I see. Here is a misunderstanding I have to explain. For a random variable, for example the random variable Maze(1,1) (without time step), there is only ONE Maze(1,1) always. If you define Maze() by Maze(x,y,timestep t) (with timestep), then there will be infinitely many random variables, namely Maze(1,1,@0), Maze(1,1,@1), Maze(1,1,@2)..... They are different concepts. If you include timestep in the arguments, then this variable becomes a temporal variable. For temporal variables, whenever timestep increases by 1, we will create a new variable with the latest timestep and remove the variable with an older timestep. For static variable, we will neither create a new one nor remove an old one. Instead, we will always keep the ONLY ONE in every particle. When we duplicate particles in the resample step, we will also duplicate all the included static variables. As long as a static variable is sampled, the value of it will never be changed.

It is a standard feature of particle filtering. It is already there.

jxwuyi commented 9 years ago

If you would like to define temporal Maze(), you should include timestep in the arguments, for example Maze(x,y,timestep t). However, I have to say if you really want it dynamic, due to current implementation issue of BLOG, you have to ensure that at each timestep all the possible positions of Maze(x,y) are sampled. Note that we only keep information of the latest timestep. For example, if you did not sample Maze(x,y,@2) but you did sample Maze(x,y,@4) while Maze(x,y,@4) somehow depends on Maze(x,y,@2), then a problem occurs since all the random variables for timestep @2 have been removed. In order to overcome that, at the current stage, the only way is to query that variable to ensure that it is sampled in every timestep. For example you can query Maze(1,1,@0), Maze(1,1,@1), Maze(1,1,@2), Maze(1,1,@3) .....

Well, it is for now the only solution. I know it is a little bit annoying. This is due to some implementation issue. We might propose a better solution in the near future.