Giter VIP home page Giter VIP logo

Comments (6)

jxwuyi avatar jxwuyi commented on September 17, 2024

The easiest solution to fix this is to replace the definition of Maze() from

random Cell Maze(Integer x,Integer y,Timestep t) ~
  if t == @0 then
    if x==0 & y==0 then
        free
    else
    Categorical({free -> 0.6, wall -> 0.4}) 
  else Maze(x,y,prev(t))
;

to

random Cell Maze(Integer x,Integer y) ~
    if x==0 & y==0 then
        free
    else
    Categorical({free -> 0.6, wall -> 0.4}) 
;

The difference is that in the previous case, Maze() is a temporal random variable while in the latter case, Maze() is a static variable.

In the current implementation of Particle Filtering, we will only contain the information for the last two timesteps. Note that some positions of Maze() might not be sampled in time 1, or time 2. So when you trace back from time 3, all the information in time 1 or time 0 has been deleted.

from blog.

davidenitti avatar davidenitti commented on September 17, 2024

thanks for the reply, but your proposed solution does not work: now it seems that the same maze cell is sampled at every step, even if it was already sampled.
Instead a cell has to be constant over time. Thus the maze cell at time t+1 has to be equal to the maze cell at time t.

from blog.

jxwuyi avatar jxwuyi commented on September 17, 2024

It actually works. You can try it. It produces the result of 0.25.

In particle filtering, all the random variables without an argument of timestep will be always reserved in every time step. They will not be cleared or resampled. In each time step you will have the same variable since they have nothing to do with timestep. That's why they are called static variables here. We are only removing temporal variables.

If you really want to make random var Maze() temporal variables, for now, the only way is to query it in each time step to ensure that it will be sampled before being removed.

from blog.

davidenitti avatar davidenitti commented on September 17, 2024

my mistake, I forgot to remove the time. thanks!

from blog.

davidenitti avatar davidenitti commented on September 17, 2024

It works, but if I want to query a cell maze at each step I get the same result. The maze belief should change according to the evidence, even when the maze is static. If I try to query several time e.g., maze(1,1) I get always the same result.

from blog.

jxwuyi avatar jxwuyi commented on September 17, 2024

It is true, always the same result.

If you query the static variable, the result is always the posterior distribution, namely the distribution given all the data (or saying, the posterior at the final timestep, always).

If you would like to observe how the posterior distribution varies, perhaps the only way is to firstly include a timestep argument in the definition of Maze() and then query all the necessary cells of Maze() at each timestep. In this case you will probably write dozens of queries. Yes, it is really a little bit annoying. We will try to come up with some new syntax for this.

from blog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.