|
I'm interested in the simple algorithm for particles filter shown in the algorithm above. It seems very simple but I have no idea on how to do it practically. Edit: After the example and explanation given by @smjohns , I've implemented the simple example of two states according to what he said, just to better understand how it works. Can you, please check this simple C++ implementation that I made from his example, then tell me if I understood it correctly. If it is the case, I will add some more questions about particle filters algorithm. here is the code: http://pastebin.com/M1q1HcN4 Note, the algorithm from page 11 of www.cs.ubc.ca/~arnaud/doucet_defreitas_gordon_smcbookintro.ps
|
|
Not sure about the paper but I coded a Kalman filter on jsfiddle for cs 373 that has a pretty little implementation. The actual kalman update is only about 7 lines. The rest is setup and interface code. If you are going to use this example, be careful, I add a decay step that makes the Kalman filter forget the past. This allows it to do fun things like change directions, but it is not part of the kalman definition.
Well, I want to implement particle filters alown from scrach just to understand it. I've edited my first post to add a simple C++ implementation of the example that @smjohns gave before. Can you please check if I understood it well, or there are some misunderstanding ?
I don't know C++, so I can't guarantee for you that your code is working properly. I did take a look... I didn't notice anything glaring, other than you coded for this single example rather than coding it more generally and using this as an example. I know this probably isn't as helpful as you hoped. C++ isn't my cup of tea.
@ShN sorry I don't have experience with C++. But I think the best way to test a kalman fiddle is to build a simple UI and determine if it performs as it should. That is does it track a particle with constant velocity simply. My jsfiddle code has an example of that. It didn't take too long to code, but it was harder than the kalman filter itself. I don't know how hard it would be in C++.
When I execute my C++ program with N = 50 (number of particles), I can see that at each time t: there is (among the N particles generated at this time) much more particles having a state which correspond exactly to the observation Y_t. Does this means that my algorithm performs well ?
Do'h I've been showing off my kalman filter code. I mixed it up with particle filters. Sorry about that.
To test your algorithm check how well your particles correspond with the true position of the robot. Your observations should include artificial noise and your particles should filter out that noise and center on the true position. This correspondance should grow stronger as more observations are made.
How do you include some artificial noise to the observations, since in this example each observation data (Y_t) is just a state which can be 'A' or 'B' ?
And by the way, the context of the original problem that I want to deal with, is related to sequential data clustering, not robot moving. So I still need to understand how all this stuff can apply for that context.
The probability P(y|x) is measurement noise. I used a simple model; your observation has an 80% chance of being correct. If nearby states are distributed in some kind of space, then you could apply gaussian noise (or whatever distribution makes sense in your problem).
@smjohns If you know C++, can you check the implementation I've made with your example ? I see that at any given time t, the probability P(x^i_t = A) is the same for all particles i generate at this time, is this normal ?
|
|
You may find this post useful: http://www.aiqus.com/questions/25074/85-did-i-actually-get-particle-filters-right/25635 This link is also useful, thanks. By the way, I've edited my first post to add a simple C++ implementation of the example that @smjohns gave before. Can you please check if I understood it well, or there are some misunderstanding ?
Sorry, I can't spare the time to look at code... Test it, make an object that uses it to locate itself. By the way here's a theoretical explanation:
http://www.aiqus.com/questions/22778/how-i-attempted-the-measurement-question-using-bayes-rule/24133
There are lots of useful posts back from AI-class.
Well, can you just tell me if it is normal that: at any given time t, the probability P(x^i_t = A) is the same for all particles (i=1...N) generated at this time t.
|
