Jump to content

User talk:Wefatherley

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Welcome!

Hello, Wefatherley, and welcome to Wikipedia! Thank you for your contributions. I hope you like the place and decide to stay. Here are a few links to pages you might find helpful:

You may also want to complete the Wikipedia Adventure, an interactive tour that will help you learn the basics of editing Wikipedia. You can visit the Teahouse to ask questions or seek help.

Please remember to sign your messages on talk pages by typing four tildes (~~~~); this will automatically insert your username and the date. If you need help, check out Wikipedia:Questions, ask me on my talk page, or ask for help on your talk page, and a volunteer should respond shortly. Again, welcome!--Biografer (talk) 01:55, 18 June 2018 (UTC)[reply]

Hi Wefatherley, thank you for your nice plots in the article! I like it. However, I have trouble with posting the code of the pure helper class "SSAModel" in the article - it does not help to understand the algorithm. To me it makes the article too long and hides the clear essence of the alogrithm (just by the fact that the presentation of the algorithm is taking up less percent of lines in the article now). Could you think about hiding these implementation details by either a) moving the helper class to the sub page of the image or b) make the implementation so transparent that you do not need this helper class or c) ... ? Prior to your addition of code the algorithm was shortly presented as:

# Main loop
while t < T:
    if n_I == 0:
        break

    w1 = _alpha * n_S * n_I / V
    w2 = _beta * n_I
    W = w1 + w2

    # generate exponentially distributed random variable dt
    # using inverse transform sampling
    dt = -math.log(1 - random.uniform(0.0, 1.0)) / W
    t = t + dt

    if random.uniform(0.0, 1.0) < w1 / W:
        n_S = n_S - 1
        n_I = n_I + 1
    else:
        n_I = n_I - 1
        n_R = n_R + 1

    SIR_data.append((t, n_S, n_I, n_R))

Now it is much harder to spot the part of the code which does the job.

PS: I found a minor typo in the ordinate of your figure, could you please change the text to "recoverd" at the right spot (see article) and upload a new version of this nice picture? Biggerj1 (talk) 23:57, 23 November 2020 (UTC)[reply]

Thank you for your fast response! :) Maybe you can place the whole code of the script in the description page of the figure: https://commons.wikimedia.org/wiki/File:Sir2.png Then the next authors who want to regenerate the figure can reuse your work ! :) Biggerj1 (talk) 00:35, 24 November 2020 (UTC)[reply]

No probs, I am happy to simplifiy things. When I added the SIR example some time ago, I didn't realize that it was a special case of the algorithm- that it didn't actually demonstrate the second monte carlo step of choosing the next reaction based on propensities. I'll spend a few hours fixing up the algorithm section, so that the SSA class is the keystone example. I'll also make a subpage for the SSAModel in the trajectories image :) Wefatherley (talk) 00:59, 24 November 2020 (UTC)[reply]

Here’s the ipynb containing the code of the air example. The SSA and SSAModel classes are in a sub directory of that same repo: https://github.com/wefatherley/monte-carlo/blob/master/ssa.ipynb Wefatherley (talk) 03:06, 24 November 2020 (UTC) Wefatherley (talk) 03:06, 24 November 2020 (UTC)[reply]