Skip to content
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

Custom Model With Diverging Paths #172

Closed
gaianoseworthy opened this issue Jun 14, 2020 · 3 comments
Closed

Custom Model With Diverging Paths #172

gaianoseworthy opened this issue Jun 14, 2020 · 3 comments

Comments

@gaianoseworthy
Copy link
Contributor

gaianoseworthy commented Jun 14, 2020

I am back with another question! Let's say we wanted to create a custom model by importing the DiffusionModel partial class, like you mentioned in #171 and wanted to make it such that the model is SE(IA)R, such that E -> I with rate = alpha and E -> A with rate = phi, what would be the best way to do this? My current code blocks for transitions are borrowed from the SEIR class, and are pasted below:

if u_status == 2:
                if self.progress[u] < 1:
                    self.progress[u] += self.params['model']['alpha']
                else:
                    actual_status[u] = 3  # I
                    del self.progress[u]

if u_status == 2:
                if self.progress[u] < 1:
                    self.progress[u] += self.params['model']['phi']
                else:
                    actual_status[u] = 4  # A
                    del self.progress[u]
@GiulioRossetti
Copy link
Owner

Yes, the idea is that within each iteration you cycle over the node set and, depending on the current node status, apply the transition rule you designed.

I haven't checked the code (I'm on the smartphone right now) but the scheme seems the standard one.

@gaianoseworthy
Copy link
Contributor Author

My only concern is that the rate is progressed through a simple '+=' counter in this example (taken from the SEIR model) and has no random elements, making it effectively a counter. I may just do a quick random chance instead, which matches more of what I would expect from the model, and is closer to the custom model with probabilities, where I check "if random() < (alpha): self.progress[u] = 1". This should solve the issue of the disease always doing E -> I and never E -> A.

@GiulioRossetti
Copy link
Owner

Yes, It Is something easy to achieve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants