Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update documentation #16
Update documentation #16
Changes from 11 commits
837847e
3648f4c
f7033db
673e670
8732544
6394704
f7bdf6a
573cab3
71c74cd
d603f56
a3af900
d40c277
8f64bf4
593d305
0a21829
18ab51e
5bcb4f1
09f1687
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can be a bit confusing here to use
x
which otherwise only denotes (internal) states. Maybe just define it in/via the model equations below and remove this list?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO these names are quite confusing. It was not clear to me at all that
particleof
was referring to some type (which type? of the states I assume?) and thatdimension
only refers to the internal states and does not considery
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this seems surprising for readers of the docs - why two exclamation marks? Should it return something or just do something? What is
step
? Why do we have to consider particles of other models as well? What isAbstractParticle
?IMO it would be better to introduce and explain the interface step by step with detailed explanations instead of adding a single code block with very short comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if every user has to write this check for every model, this indicates that the API could be better designed. Maybe the easiest would be to have different functions for whether its the initial transition or not?
Or maybe the example just incorrectly suggestes that the code always takes this structure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again I think this needs more explanations - what does this function do? What are the arguments? Should it return something or modify something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean with "log density of the model"? Just
g(y_t | x_t)
I assume based on the function name?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a state machine?
More conceptually/design-wise, why do we have to define such a function? The Markovian model above works just fine without any such restrictions - wouldn't it be more natural to just iterate as long as there are observations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will consider removing
isdone
function, and get such information from the size of the observation array.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again more explanations are needed IMO - what are the arguments and their types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I'm not sure about the term "model logdensity" here due to the multitude of different log densities that could be considered in this setting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This refers back to a question above - what is the interface and interpretation of
AbstractParticle
? And why are particles coupled with the model? Intuitively, to me they seem to be a separate entity.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this should be
Conceptually, again I think the size of this loop should be governed rather by the observations than the model or particles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to reset all log weights to zero after the resampling step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is
resample
, also a part of the interface? I think more explanations would make this example much clearer.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shadowing the variable makes it more difficult to follow the code, I assume. Maybe just save the particles at each time point for illustration purposes to make the sequential nature and the time-dependency of the particles clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't/shouldn't you just set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to keep this code block in the module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As already mentioned above, it is not clear to me why it is a good idea to add a type parameter of the model here. Also, are there any examples of other particle types that justify the abstract supertype?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compiler has many tricks and optimizations for this specific type of
Union{Nothing,...}
but it means that the type ofparent
can't be inferred.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is
state
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, is it
x
? That was not clear to me at all.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be inferred, or rather only works if constant propagation kicks in. Maybe this constructor should be removed and users should just define their desired particles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This suggests their is a constructor of this form - but it seems there isn't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In older Julia versions,
was more performant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just don't add this node in the first place? The indexing operation here actually creates a copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have my doubts about this function, as mentioned above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without intermediate allocations1:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably make
observation
an explicit argument:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an example of a function that closes over a non-const global. Often this leads to very bad performance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably make
observation
an explicit argument.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add an optional API for sampling from the emission process, so we can easily generate data from the SSM model.