Retrieve particles at a particular time #181
Replies: 15 comments 3 replies
-
Okay, I might have found the solution, I misunderstood the algorithm. The returned states are the latent space coordinates of the particles after resampling, so the weights can be easily calculated from |
Beta Was this translation helpful? Give feedback.
-
The particles retrieved by |
Beta Was this translation helpful? Give feedback.
-
Good idea. I have added the line:
to the By the way, I wonder whether it would be useful to save the weighted particles and their weights.... What do you think? |
Beta Was this translation helpful? Give feedback.
-
Well, the theory is about particles at sampling points with weights, while resampling is a method to avoid particles with small weights, so I think it is better to stick to the theory, and provide the particles with weights. Nevertheless, this returned states also allow to reconstruct the weights (and also the states are minimal representations), but we need to apply the same equations as the |
Beta Was this translation helpful? Give feedback.
-
Interesting perspective. Can you tell me what you intend to do with the particles with weights? |
Beta Was this translation helpful? Give feedback.
-
While the main purpose of the library is to select the proper hypothesis, I used the library to access the distribution of the latent variable, i.e. to approximate as |
Beta Was this translation helpful? Give feedback.
-
Just pushed some changes that make it easier to retrieve the weighted particles. At your leisure, have a look. Comments and suggestions (and of course pull requests) are welcome! |
Beta Was this translation helpful? Give feedback.
-
Very well, I've checked it, but I do not get it, please help me understand. Here is the algorithm as in the PDF (to speak about the very same SMC). In the unweighted case, we get the resampled In the weighted case, I would expect to have Now, I have two issues. First, weights do not add up to 1. As I see, the returned weights are log weights, but that does not work either (e.g. Can You confirm this? Am I wrong somewhere? |
Beta Was this translation helpful? Give feedback.
-
Good catch! I had checked the results, but not thoroughly enough. This was a bug, fixed with a one-character edit. I've put in some more units tests (in The weights returned, as you surmised, are the log unnormalized weights (per line 4). Since normalization introduces noise, I think it better to return the unnormalized weights. At any rate, they are normalized easily enough. |
Beta Was this translation helpful? Give feedback.
-
Sorry to disturb you again, but still I have the problem of duplicated particles. I have the new version:
However, running e.g. this test:
I still have a lot of particles at the same sampling point at step 10. It still seems to be the resampled particles, I think. I got a plot like this: Moreover, the sampled distribution of
Can You confirm this? |
Beta Was this translation helpful? Give feedback.
-
I don't get the same thing. I see
Some overlap is evident, but the particles are actually all distinct:
Plotting unnormalized weights against
Plotting the particles in the
I don't understand the discrepancies between what you and I see. Can you reproduce what I see? |
Beta Was this translation helpful? Give feedback.
-
Well, I forgot to clean up, so that was the issue I assume (you can see, I used the 'weight' attribute, not the '.log.weight', so sad :) ). Now, I can reproduce your plots, and yes, it seems to work well. Thank You! |
Beta Was this translation helpful? Give feedback.
-
As of release 4.4.3.0, this functionality is now part of pomp. |
Beta Was this translation helpful? Give feedback.
-
Hi @kingaa, lately I have been playing around with the saved latent states obtained from the
|
Beta Was this translation helpful? Give feedback.
-
@jeswheel: thanks for weighing in on this. Yes, it should be possible to make this quite clear. Please do take a stab at it and submit a pull request! You are correct that the FALSE, TRUE options are there for backwards compatibility. In the next six months or so, a breaking version will be released and it would be a good time to remove those. |
Beta Was this translation helpful? Give feedback.
-
I am experimenting with
pfilter()
, however, I cannot find a decent method to get the particles for a given timestamp. Thesaved.states()
method returns an array of weights, but I do not know the coordinates of the particles in state space, only the weight. Or I might be wrong? As far as I know, a particle is a state space point (with it's coordinates) and a weight. I see the weights, but the coordinates are missing. I would like to watch the - approximate - distribution of the latent variable with the help of the particles, however, the weights alone are not enough for me.Beta Was this translation helpful? Give feedback.
All reactions