Skip to content
This repo contains models for optimizing animal placement in kennels in shelters at risk of a distemper outbreak.
Jupyter Notebook Python
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.ipynb_checkpoints reworked agent actions, state, and reward Mar 28, 2019
.vscode reworked agent actions, state, and reward Mar 28, 2019
__pycache__ simple version of simulation (single sim, single instance) Apr 2, 2019
data major overhault of all system; stable version 1; still needs paramete… Oct 13, 2018
experimental reworked agent actions, state, and reward Mar 28, 2019
keras-rl added RL agent Oct 18, 2018
media Update RL agents and distemper.py and add them into the root folder Mar 3, 2019
.gitignore reworked agent actions, state, and reward Mar 28, 2019
.pylintrc major overhault of all system; stable version 1; still needs paramete… Oct 13, 2018
APA-XGB_BO-Distemper-03-16-2019-v1.json reworked agent actions, state, and reward Mar 28, 2019
README.md Update README.md Apr 2, 2019
aggregate_visualization.py resolved conflicts Mar 28, 2019
custom_disease_model.py reworked agent actions, state, and reward Mar 28, 2019
distemper.py Add look_ahead function for simulation; Add single hour training logi… Apr 18, 2019
download (1).png Add files via upload Apr 2, 2019
environment.yml Added conda environment.yml. Oct 3, 2018
interventions.py major overhault of all system; stable version 1; still needs paramete… Oct 13, 2018
main.py simple version of simulation (single sim, single instance) Apr 2, 2019
main_params.py Upload CNN agent; Add new distemper model; Apply new sim params Mar 22, 2019
realistic_sim_params.json reworked agent actions, state, and reward Mar 28, 2019
rl_agent2.py Upload Baysian Optimization method script to find desired probabilite… Mar 16, 2019
rl_agent3.py simple version of simulation (single sim, single instance) Apr 2, 2019
rl_agent4CNN.py Upload CNN agent; Add new distemper model; Apply new sim params Mar 22, 2019
rl_agent4RNN.py reworked agent actions, state, and reward Mar 28, 2019
sim_params.json simple version of simulation (single sim, single instance) Apr 2, 2019
simulation.py Add look_ahead function for simulation; Add single hour training logi… Apr 18, 2019
stats.ipynb reworked agent actions, state, and reward Mar 28, 2019
stats.pkl
test.mp4 reworked agent actions, state, and reward Mar 28, 2019
tmp_eval.py Create tmp_eval.py Apr 2, 2019

README.md

Distemper Outbreak Simulation

This repo contains models for optimizing animal placement in kennels in shelters at risk of a distemper outbreak.

The model uses a non-deterministic automata to update the local status for each kennel in a simulated shelter. Intervention objects can then operate on the kennel structure at any time point in the simulation to try out organizational strategies based on visible knowledge about the simulation state. The architecture of the simulation can be seen here:

Architecture of Distemper Model

Parameters

Parameter Name Description Type/Units
pSusceptibleIntake The probability that an animal intakes as Susceptible to the virus probability/hour
pInfectIntake The probability that an animal intakes as Infected with the virus (but not Symptomatic) probability/hour
pSymptomaticIntake The probability that an animal intakes as Infected and Symptomatic with the virus probability/hour
pInsusceptibleIntake The probability that an animal intakes as Fully Vaccinated/Insusceptible probability/hour
pSurviveInfected The probability that an animal will survive (become Insusceptible) given they are Infected (but not Symptomatic) probability/hour
pSurviveSymptomatic The probability that an animal will survive (become Insusceptible) given they are Symptomatic probability/hour
pDieAlternate The probability that an animal will die of alternate causes probability/hour
pDischarge The probability that an animal will be discharged given it is Insusceptible probability/hour
pCleaning The probability that a kennel will be cleaned given the presence of a Deceased animal probability/hour
pSymptomatic The probability that an animal will become symptomatic given they are Infected probability/hour
pDie The probability that an animal will die given they are Symptomatic probability/hour
refractoryPeriod The minimum time required for particular state transitions such as Symptomatic->Deceased and Infected->Symptomatic to have a non-zero probability number of hours
infection_kernel The probability of infection given a distance in kennel connections list of probabilities
infection_kernel_function A function that determines how immunity impacts infection rate given kernel probabilities from adjacent kennels string lambda function
immunity_lut Either a pair of floating point values specifying an iterative exponential growth function's parameters or a lookup table of values for each hour list of 0-1 bounded values
max_time The maximum time the simulation will run before ending automatically number of hours
max_intakes The maximum number of intakes before the simulation ends automatically number of animals

Parameter Estimation

Meta-Parameter Name Description Type/Units Hypothesized Value (or Range)
equation A time period in which to compute the meta-parameters (and, therefore, the regular parameters) hours 744 (i.e. 1 month)
equation The number of animals in a given time period, T count 847
equation The number of animals in a given time period, T, who came in infected with distemper count 68 (from APA Data)
equation The number of animals in a given time period, T, who came in susceptible to distemper count 432 (from APA Data)
equation The number of animals in a given time period, T, who came in confirmed fully vaccinated count 347 (1, 2, 3)
equation The number of animals in a given time period, T, who died due to reasons other than distemper count 68
equation The number of animals in a given time period, T, who died due to distemper count 111 (Watch+Confirmed Proportion; or 178 Confirmed Proportion for stricter criteria; via APA Internal Data)
equation The number of animals in a given time period, T, who were infected with distemper count 132 (Died From Distermper/0.85 survival rate)

Rate Averaging Equation This equation can be used to take population numbers over a time interval and convert them to probabilities per unit time in that interval.

equation

Parameter Name Estimation Method Type/Units Hypothesized Value (or Range)
pSusceptibleIntake Literature Review of 1, 2, 3 to determine average rate of 1-0.41-pInfectIntake in population across 4 shelters, extrapolated to AAC data and applied to equation (1) probability/hour ?
pInfectIntake 0.08 applied to equation (1) based on APA Internal Data on distemper watch or confirm intakes between August 2018 and January 2019 post-outbreak at AAC probability/hour ?
pSymptomaticIntake Assumed 0 probability/hour 0 (assumed)
pInsusceptibleIntake Literature Review of 1, 2, 3 to determine average rate of 0.41 in population across 4 shelters, extrapolated to AAC data and applied to equation (1) probability/hour ?
pSurviveInfected Determined via examination of all distemper watch animals at APA for months of August 2018 to January 2019 post-outbreak at AAC and extrapolated to AAC population then applied to equation (1) probability/hour 0 (assumed)
pSurviveSymptomatic Determined via examination of all distemper confirmed animals at APA for months of August 2018 to January 2019 post-outbreak at AAC and extrapolated to AAC population then applied to equation (1) or 0.15 if no treatment is provided probability/hour 0 (assumed)
pDieAlternate Determined via AAC average death rate extrapolated then applied to equation (1) probability/hour ?
pDischarge Assumed 0 probability/hour 0
pCleaning Assumed 1 probability/hour 1
pSymptomatic Determined via comparison of distemper exposed evolution in APA animals fro August 2018 to January 2019 post-outbreak at AAC and extrapolated to AAC population then applied to equation (1) - this figure is likely an overestimate as equation (1) assumes a uniform distribution when this is likely not the case (it is likely right skewed) probability/hour 0 (assumed)
pDie Determined via 1-pSurviveSymptomatic or 0.85 applied to equation (1) depending on assumptions of treatment (i.e. the former with APA protocols and the latter without) probability/hour ?
refractoryPeriod Assumed 0 days (hypothetically if infection occurs on-site it is 7-14 days, but infection could have occurred before arrival - the simulation does not currently differentiate these situations so no refractor period will be given) number of hours 168
infection_kernel Computed from 0.0053 per day global spread probabilitiy applied to equation (1) in neighbor then inverse square law (due to diffusion) for second neighbor list of probabilities [?, ?]
infection_kernel_function Inverse square law due to diffusion over 20 foot radius - assumed to be 2 kennel max distance for convenience (though this should be adjusted for sufficiently tight layouts) string lambda function k*(1-immunity)
immunity_lut Assumed to follow linear part of Michaelis-Menten Kinetics with fit to 0 and t=0 and 0.9 at t=72 list of 0-1 bounded values y=0.0125*t for t=0..72
max_time N/A number of hours 744
max_intakes N/A number of animals None

Demonstration

Using some probabilities which have not been verified, we can see how the simulation performs.

Single Simulation

When run in single simulation mode, visualizations of the temporal progress of the disease can be seen. Aggregate variable graphs are shown as follows:

Video of Graphs

Additionally, a simulation of the kennel network states can be seen here:

Video of Simulation

Batch Simulation

Finally, when run in batch mode, different strategies can be compared which intervene in position. Here, animals are sorted by immunity to avoid infection of new dogs. This intervention is compared to no intervention: Comparison of Methods

Current Agent

The current agent performance on a single instance of a single time point of a single graph:

Model Performance

You can’t perform that action at this time.