-
Notifications
You must be signed in to change notification settings - Fork 10
sampathkumar - mitchell #4
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
Open
bsampath17
wants to merge
5
commits into
lyy005:master
Choose a base branch
from
bsampath17:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2c53f88
Add files via upload
twhmitchell 8fbb698
Plot generated for Q2 - Balaji
bsampath17 d09492c
Script for Q2 - Balaji
bsampath17 5264c3f
Results obtained for Q2 - Balaji
bsampath17 7499dc8
Explanation for patterns obsrved in the results for Q2 - Balaji
bsampath17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| Maximum daily incidence: | ||
| 87.3691177314 | ||
| 586.170819125 | ||
| 1.35394595053 | ||
| 0.979180304854 | ||
| 19.390316567 | ||
|
|
||
| Maximum daily prevalence: | ||
| 0.669182090042 | ||
| 0.667294350986 | ||
| 0.0941045383845 | ||
| 0.001 | ||
| 0.403596344712 | ||
|
|
||
| Percent affected: | ||
| 0.999954624904 | ||
| 0.999954624904 | ||
| 0.676436543943 | ||
| 0.0019970073129 | ||
| 0.980194131568 | ||
|
|
||
| Basic reproduction number: | ||
| 10.0 | ||
| 10.0 | ||
| 1.0 | ||
| 0.5 | ||
| 2.0 | ||
| 4.0 | ||
| 1.6666666666666667 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| import pandas | ||
| import numpy as np | ||
| import scipy | ||
| import scipy.integrate as spint | ||
| from plotnine import * | ||
|
|
||
| beta = [0.0005,0.005,0.0001,0.00005,0.0001,0.0002,0.0001] | ||
| gamma = [0.05,0.5,0.1,0.1,0.05,0.05,0.06] | ||
| beta_gamma_dict = {} | ||
| prev_I = 1 | ||
| incidence_arr = [] | ||
| prevalence_arr = [] | ||
| for i in range(0,len(beta)): | ||
| beta_gamma_dict[beta[i]] = gamma[i] | ||
| #beta_gamma_dict_2 = {0.0005: 0.05, 0.005: 0.5, 0.0001: 0.1, 0.00005: 0.1, 0.0001: 0.05, 0.0002: 0.05, 0.0001: 0.06} | ||
| basic_repr_num = (beta[i]*1000)/(gamma[i]) | ||
| print (basic_repr_num) | ||
|
|
||
| def ddSim(y,t0,beta,gamma): | ||
| # "unpack" lists containing state variables (y) | ||
| # y = np.zeros(3) | ||
| # [S,I,R] = y | ||
| S = y[0] | ||
| I = y[1] | ||
| R = y[2] | ||
| N = S + I + R | ||
| dSdt = (-1)*beta*I*S | ||
| dIdt = beta*I*S - gamma*I | ||
| dRdt = gamma*I | ||
|
|
||
| return dSdt,dIdt,dRdt | ||
|
|
||
| for key, value in beta_gamma_dict.items(): | ||
| ### Define parameters, initial values for state variables, and time steps | ||
| params=(key,value) | ||
| N = S + I + R | ||
| S0=999 | ||
| I0=1 | ||
| R0=0 | ||
| N=1000 | ||
| times=range(0,500) | ||
| y0 = [S0, I0, R0] | ||
| modelSim0=spint.odeint(func=ddSim, y0=y0, t=times, args=params) | ||
|
|
||
|
|
||
| ### put model output in a dataframe for plotting purposes | ||
| modelOutput=pandas.DataFrame({"t":times,"S":modelSim0[:,0],"I":modelSim0[:,1],"R":modelSim0[:,2]}) | ||
| #print (modelOutput) | ||
| for i in modelSim0[:,1]: | ||
| incidence = i - prev_I | ||
| prevalence = i / N | ||
| prev_I = i | ||
| incidence_arr.append(incidence) | ||
| prevalence_arr.append(prevalence) | ||
| print(max(incidence_arr)) | ||
| print(max(prevalence_arr)) | ||
| incidence_arr = [] | ||
| prevalence_arr = [] | ||
| #print(modelOutput) | ||
| percent_affected = ((modelSim0[:,1][-1]) + (modelSim0[:,2][-1]))/ N | ||
| print (percent_affected) | ||
| ggplot(modelOutput,aes(x="t",y="y0"))+geom_line(aes(x="t",y="S"),color='red')+geom_line(aes(x="t",y="I"),color='black')+geom_line(aes(x="t",y="R"),color='green') | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good job |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # Import packages: | ||
|
|
||
| import numpy | ||
| import os | ||
| import pandas | ||
| import scipy | ||
| import sklearn | ||
| import scipy.integrate as si | ||
| from plotnine import * | ||
|
|
||
| # Define custom function: | ||
|
|
||
| def ddSim(y,t0,r,K): | ||
|
|
||
| # Unpack lists containing state variables (y) | ||
| N=y[0] | ||
|
|
||
| dNdt=r*(1-N/K)*N | ||
|
|
||
| return [dNdt] | ||
|
|
||
| # Define paramaters, initial values for state variables and time steps: | ||
|
|
||
| N0=[10] | ||
| times=range(0,600) | ||
| K=100 | ||
|
|
||
| # Part 1a: | ||
| # Define initial parameters: | ||
|
|
||
| rs=[-0.1,0.1,0.4,0.8,1] | ||
| store_rs=pandas.DataFrame({"time":times,"r1":0,"r2":0,"r3":0,"r4":0,"r5":0}) | ||
|
|
||
| for i in range(0,len(rs)): | ||
| pars=(rs[i],K) | ||
| sim=si.odeint(func=ddSim,y0=N0,t=times,args=pars) | ||
| store_rs.iloc[:,i]=sim[:,0] | ||
|
|
||
| ggplot(store_rs,aes(x="times",y="r1",color="-0.1"))+geom_line()+geom_line(aes(y="r2",color="0.1"))+geom_line(aes(y="r3",color="0.4"))+geom_line(aes(y="r4",color="0.8"))+geom_line(aes(y="r5",color="1.0")) | ||
|
|
||
| # Part 1b: | ||
| # Define initial parameters: | ||
|
|
||
| r2=0.2 | ||
| N2=1.0 | ||
| times2=range(0,600) | ||
|
|
||
| Ks=[10,50,100] | ||
| store_Ks=pandas.DataFrame({"time":times,"K1":0,"K2":0,"K3":0}) | ||
|
|
||
| for j in range(0,len(Ks)): | ||
| pars2=(r2,Ks[j]) | ||
| sim=si.odeint(func=ddSim,y0=N2,t=times2,args=pars2) | ||
| store_Ks.iloc[:,j]=sim[:,0] | ||
|
|
||
| ggplot(store_Ks,aes(x="times2",y="K1",color="10"))+geom_line()+geom_line(aes(y="K2",color="50"))+geom_line(aes(y="K3",color="100")) | ||
|
|
||
| # Part 1c: | ||
| # Define initial parameters: | ||
|
|
||
| r3=0.1 | ||
| K3=50.0 | ||
| times3=range(0,600) | ||
|
|
||
| Ns=[1,50,100] | ||
| store_Ns=pandas.DataFrame({"time":times,"N1":0,"N2":0,"N3":0}) | ||
|
|
||
| for k in range(0,len(Ns)): | ||
| pars3=(r3,K3) | ||
| sim=si.odeint(func=ddSim,y0=Ns[k],t=times3,args=pars3) | ||
| store_Ns.iloc[:,k]=sim[:,0] | ||
|
|
||
| ggplot(store_Ns,aes(x="times3",y="N1",color="1"))+geom_line()+geom_line(aes(y="N2",color="50"))+geom_line(aes(y="N3",color="100")) | ||
|
|
||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good job |
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,10 @@ | ||
| # Intro_Biocom_ND_319_Tutorial10 | ||
| # Intro_Biocom_ND_319_Tutorial10 | ||
| All the 4 types of results observed max. incidence, max. prevalence, % affected | ||
| and basic reproduction no. stays constant in the beginning, then drops | ||
| and then increases towards the end again. | ||
| This can be interpreted in this way: since the model focuses on the host of | ||
| the disease, the no. of people susceptible to the diseases will be high during | ||
| the initial stage of the disease spread, the more people get infected; | ||
| later as the host develops resistance to the diseases and | ||
| would become almost immune to it. | ||
|
|
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.
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.
Don't need this equation here