GT CS 7280: Network Science
GT CS 7280: Network Science
Assignment 4: Modeling Epidemics
Fall 2024OverviewThe objective of this assignment is to experiment with the concepts we covered in Module-4about network epidemics, and see how the theoretical results that were derived in classcompare to simulation results.
Submission
Please submit your Jupyter Notebook A4-YOURGTUSERNAME.ipynb with requirements.txt so that we may be able to replicate your Python dependencies to run your code as needed.With Anaconda, you can do this by running:conda list -e > requirements.txt Ensure all graphs and plots are properly labeled with unit labels and titles for x & y axes.Producing readable, interpretable graphics is part of the grade as it indicates understanding ofthe content – there may be point deductions if plots are not properly labeled. Getting StartedAssignment 4 requires Epidemics on Network python module available here. You can downloadthis module and run the examples given in the documentation to become familiar with it.You can install the library using: pip install EoNThis homework, especially parts 2 and 3, might take several minutes to run. Be aware of his and plan to complete it accordingly. **IMPORTANT** As with prior assignments the structure has been designed to have several subsections in each part. The first few subsections are meant to just define useful functions and the final subsection of each part s where the functions are called and the analysis is done. If you are confused about how a function is meant to be used, check the final subsection in each part to see how they are being called. This should clear up a lot of potential points of confusion early on.GT CS 7280: Network SciencePart 1: Outbreak Modeling [40 Points]The file “fludata.txt” has the list of students, 代写GT CS 7280: Network Science teachers and staff at a school. The interactionbetween them was measured based on the proximity of the sensors that people were carryingon them. The data file has three columns, the first two columns are the IDs of the people andthe third column is the number of interactions.Construct an undirected graph from that text file using functions in the networkX module.Forthe purpose of this assignment, we consider only the unweighted graph (i.e., you can ignorethe third column).
- [10 points] Suppose there is a pathogen with transmission rate of 0.01 and recovery
rate of 0.5. Suppose that an outbreak started at node 325 (“patient-0”). Complete thesimulate_outbreak function to simulate an outbreak under the SIS model using theprovided parameters. The function should return a list of length n_iter containingsimulation runs where n_iter is an argument to the function.Important: When running your simulations, you will want to discard the outbreaks that died out stochastically. To do this, check whether the number of infected nodesat the last time step is 0 and replace them with a simulation that does not die out. In total you should have n_iter simulations. Additionally, complete the plot_outbreaksfunction to visualize the results of thesimulate_outbreak function. Show the results for each of the simulations on aingleplot and break each simulation into 2 lines, one for the number of infected and the otherfor number of susceptible over time. Make sure to properly label these lines and tocreate a legend identifying which lines are which.
- [10 points] In the lecture we modeled the initial exponential increase of the number ofinfected nodes as 𝐼(𝑡) ≈ 𝐼 , where 𝜏 is a time constant. Note that here as onl0𝑒 𝑡/τ 𝐼 0 = one node was infected initially. Now, complete the get_exponent function to fit anexponent to the curve of the number of infections. Choose only the initial portion of thoutbreak, say for 𝐼(𝑡) ≤ 100 (the exponential region of the outbreak, where the number offected is less than or equal to 100) and return the estimated time constant 𝜏.Hint: scipy.optimize.curve_fit is a helpful function to fit the exponent to a curve. , complete the plot_curve_fit function to plot both the actual number oinfected and the theoretical curve given a value of 𝜏 (for values of Infected < 100). Thisfunction should also compute the r-squared between the two curves and print the valuefor 𝜏 and r-squared in the title of the plot. Again, make sure to label bothcurves andcreate a legend identifying which is which.
- [5 points] In the lecture and textbook we discussed theoretical values for 𝜏 that can becalculated from properties of the graph and the dynamics of the infection spread.Complete the calculate_theoretical_taus function to compute:GT CS 7280: NetworkScience
○ The random distribution shown in the Lesson 9 Canvas lecture “SIS Model”.
○ The arbitrary distribution from the Canvas lectures shown in the Lesson 9Canvas lecture “Summary of SI, SIS, SIR Models with Arbitrary Degree Distribution”.
○ The arbitrary distribution from the textbook found in Ch. 10, Equation 10.21.Additionally, complete the compare_taus function to show a boxplot of thedistribution ofsample 𝜏’s calculated from simulation runs (see 1.5 to understand where these comefrom). Visualize the theoretical calculations as dots on the box plot. Again, label each ofhese dots with the calculation used to generate them.
- [10 points] Complete the calculate_theoretical_endemic_size function to compute theize of the population that remains infected at the endemic state.Then, complete the compare_endemic_sizes function to plot the distribution oendemic sizes across several simulation runs as a boxplot, and compare it with thetheoretical calculation for endemic size as a single dot, similarly to the previoussubsection.
- [5 points] Run the code provided in cell 1.5 and look at the resulting figures. How good oa fit is the exponential curve in section 1.2? Explain how the theoretical estimates in 1.& 1.4 compare to the empirical distribution and indicate which you woulconsider areasonable fit for the data.
Part 2: Transmission Rate [25 PointsNext, let us vary the transmission rate and see how it affects the spread of infection. Since we
know that only the ratio of the transmission rate and the recovery rate matters, let us keep the recovery rate constant at 0.5 and vary only the transmission rate.
- [10 points] Complete the simulate_beta_sweep function to vary the transmission rateover a range of beta values between beta_min, beta_max with beta_samples number ofpoints. For each value of the transmission rate, compute 5 simulations to avoid outliers.You can reuse your simulate_outbreak function from Part 1 in thisfunction.Next, complete the extract_average_tau function to return a list of the average 𝜏 valuecalculated over the five simulation runs for EACH beta value. You may reuse heget_exponent function from Part 1.
nally, complete the plot_beta_tau_curves function to show the exponential curvegiven by the 𝜏 values for each beta value. The x-axis is time and y-axis is the number ofinfected people. Use a log scale on the y-axis and make sure that each line has its owcolor. This function should be similar to the plot_curve_fit function in part 1.2, but youGT CS 7280: Network Sciencewill be showing a series of exponentials instead of comparing an experimental with atheoretical curve.
- [10 points] Complete the extract_average_endemic_size function to return a list of the
average endemic size calculated over the five simulation runs for EACH beta value.Next, complete the calculate_theoretical_endemic function to find the minimumtheoretical beta values of the transmission rate for an epidemic to occur. Calculate thisminimum based on the equations derived in lecture for both the randodistribution andhe arbitrary distribution. Also, calculate the theoretical endemic size for each value ofbeta under the assumption of random distribution.Finally, complete the compare_endemic_sizes_vs_beta function to plot the averageendemic sizes and theoretical endemic sizes as a curve vs beta. Additionally, plot theminimum values for beta to start an epidemic as vertical lines. Make sure to label eachline and provide a legend.
[5 points] Run the code provided in cell 2.3 and look at the resulting figures. How similaris the theoretical to experimental endemic sizes? How closely do the minimum beta
values provide a reasonable lower bound for the start of an endemic?Part 3: Patient-0 Centrality & 𝜏 [30 Points]Now, let us see how the choice of “patient-0” affectsthe spread of an outbreak. Consider everynode of the network as patient-0, and run the SIS model using the parameters in Part 1 tocompute . Run the simulation with each node in the simulation as patient-0.Hint: You can skipcases where the infection quickly diminishes to 0.
- [10 points] Complete the sweep_initial_infected function to complete a singlesimulation run for each node in the graph as the initial infected. Check for runs thatstochastically die out and do not save those. Return the list of simulation run results anda list of nodes (integer IDs) where the simulation was successful.Additionally, complete the compute_centrality function to calculate the: degreecentrality, closeness centrality (with wf_improved=false), betweenness centrality, andeigenvector centrality of the graph. Remember to use the unweighted centrality metrics.Return the centralities for each node where the simulation was kept in the previousfunction.
Hint: We provide “nodes” as an argument which is meant to represent the second output of the previous function. You can use this to filter for centralities of onlythese nodes before you return them. Check the cell for 3.3 to see exactly how this is used.GT CS 7280: Network Science
- [15 points] Complete the calculate_pearson_correlation to compute the Pearsoncorrelation coefficient between each centrality metric and 𝜏, along with a p-value for thatcorrelation.Additionally, complete the plot_centrality_vs_tau function to plot a scatter plot betweenthe 𝜏 value that corresponds to each node, and different centrality metrics of that node:degree centrality, closeness centrality, betweenness centrality, and eigenvectocentrality. Do this all as one figure with four subfigures. Include the Pearson correlationvalues as well as the corresponding p-values in the title for each scatter plot. Rememberto use the unweighted centrality metrics.
- [5 points] Rank these centrality metrics based on Pearson’s correlation coefficient, anddetermine which metrics can be a better predictor of how fast an outbreak will spreadfrom the initial node. Analyze your results. That is, do the results match your intuition? Ifthey differ, why might that be?Part 4: Knowledge Question [5 Points]Answer the following food for thought question from Lesson 10 – Submodularity of ObjectiveFunction:Prove that a non-negative linear combination of a set of submodular functions is also a
submodular function. Hint: Make sure you understand the definition of linearity.

浙公网安备 33010602011771号