-
-
Notifications
You must be signed in to change notification settings - Fork 359
New chapter "Metropolis" with Python Implementation #929
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
New chapter "Metropolis" with Python Implementation #929
Conversation
I feel like this would make more sense grouped together with monte carlo under "Monte Carlo Methods", and rename monte carlo to "Approximating Areas" |
I dislike using numpy. It's specialised enough that not everyone will know it, and it has no counterpart in many languages. It could be replaced here with |
I agree - they belong in a similar category. |
I'm not sure I agree, but I see where you're coming from, with |
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.
Overall, I think the quality here is good. I a few lingering remarks that I didn't mention yet:
- I think random walk should not be capitalized in the text body
- It would be nice to talk briefly about how this is used in practice. I know it's used a lot in various physical applications, so maybe pointing to those with citations would be nice. I like that the code is for a general PDF, but maybe mentioning Mawell--Boltzmann or something would make the physics folk happy
For numpy, I think it's fine in this case. As someone coming from an HPC background, I genuinely thought the first thing everyone did when using python was to import numpy. I think we should be cognizant of the fact that this is not true for everyone and maybe remove numpy from less numerical methods. |
Co-authored-by: James Schloss <jrs.schloss@gmail.com>
Mostly typos, spelling, punctuation, and grammar. Co-authored-by: James Schloss <jrs.schloss@gmail.com>
I need to tell you two things @shudipto-amin. First we receive a notification on the discord server after every single commit. Second, I have a few problems with your notation, since I come from a mathematical background, the main thing being that I have never seen the [2..12] notation used anywhere. I have already seen "double brackets" (something that looks like I[2, 12]I, I can't reproduce it better right now) and $ [2, 12] \cap \mathbb{N}$ for the integer interval [2, 12]. |
I'm sorry about that, I was adding from conversations where that seems to be the only option. Later, I did discover that option in the files tab, and started batching about half-way through.
I personally only discovered this notation recently - I normally see something like your example with |
No problem, but keep that in mind for the future.
Yeah, that just tells me we need a mathematical notation chapter. I personally would prefer the ⟦a, b⟧ notation, but that's not a native latex symbol if I remember correctly. |
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.
Looks good! Mostly done, just have to look at the second half of Metropolis now!
Mostly punctuation and grammar. Co-authored-by: James Schloss <jrs.schloss@gmail.com>
Yeah, it looks good :) |
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.
Overall, very small changes to the text. Sorry to keep splitting this up into a bunch of smaller reviews.
I'll look at the code tomorrow and then I think the PR will be mostly ready to go!
|
||
|
||
## The Algorithm for a One Dimensional Example | ||
|
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 should be a comment here introducing the upcoming sections
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.
Couldn't come up with anything other than the line (147) below. Feel free to throw in some suggestions.
{% endmethod %} | ||
|
||
However, $$g$$ can be any function symmetric about $$0$$ for the above algorithm to work. | ||
For example, it can be a number chosen randomly from a discrete list, such as $$[ -3, -1, -1, +1, +1, +3]$$. |
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.
To be clear: this was meant to have multiple 1's, right?
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.
Yes, just to illustrate that g doesn't have to be uniform, only symmetric.
Mostly grammar and sentence structure. Co-authored-by: James Schloss <jrs.schloss@gmail.com>
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.
Added a line to introduce subsections in " The Algorithm for a One D..." section. Not sure if it's sufficient. Addressed all other minor edits in a previous commit.
{% endmethod %} | ||
|
||
However, $$g$$ can be any function symmetric about $$0$$ for the above algorithm to work. | ||
For example, it can be a number chosen randomly from a discrete list, such as $$[ -3, -1, -1, +1, +1, +3]$$. |
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.
Yes, just to illustrate that g doesn't have to be uniform, only symmetric.
|
||
|
||
## The Algorithm for a One Dimensional Example | ||
|
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.
Couldn't come up with anything other than the line (147) below. Feel free to throw in some suggestions.
…ithm-archive into metropolis_in_python
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.
Overall, this looks good to me. There are just a few small changes to be made, so I am happy to go ahead and approve this! Good work and thanks for the patience!
contents/metropolis/metropolis.md
Outdated
On the other hand, a walker with a large step size may not sample nearby regions accurately – and actually has a higher chance of being rejected if the walker is already in a high probability region, since the acceptance ratio is more drastic for large steps. | ||
The effect of step-size on the walker's efficiency is far from obvious! | ||
|
||
How to choose $$g$$ is in itself a research field and depends on what the goal of the sampling is. |
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.
How to choose $$g$$ is in itself a research field and depends on what the goal of the sampling is. | |
How to choose $$g$$ is in itself a research field and depends on what the goal of the sampling is. |
How to choose $$g$$ is in itself a research field and depends on what the goal of the sampling is. | |
How to choose $$g$$ is, itself, a research field and depends on what the goal of the sampling is. |
|
||
|
||
if __name__ == "__main__": | ||
xmin, xmax = -7, 7 |
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.
Didn't we say in the chapter that our domain was from -10 to 10?
* Minor edits for grammar and clarity. * Applies to both metropolis and probablity chapters. Co-authored-by: James Schloss <jrs.schloss@gmail.com>
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.
Suggesting changes to address remaining comments by Leios, namely:
- Changing the domain of x in python code,
- Rewording the statement regarding finding an optimal
$$g$$ .
Co-authored-by: Shudipto <32040453+shudipto-amin@users.noreply.github.com>
No description provided.