% Multi-Armed Test Distribution % Joe McCall; Chris Zahuranec % 03-23-2020
fontfamily: mathptmx geometry:
- margin=1in
header-includes:
- \usepackage{mathtools} abstract: | When an infectious disease such as COVID-19 infects an area, a common problem is a shortage of test kits. The resulting lack of adequate information on the spread of the disease makes it difficult to mitigate. Furthermore it is reasonable to conclude that the novel nature of such diseases imply a limited supply of testing capability at first. This experiment runs on data pulled from a public data source on actual infection rates, and explores whether or not the classical artificial intelligence problem of the multi-armed bandit yields useful test distrubiton strategies. Specifically, the epsilon-greedy algorithm is tested against a uniform-distribution model to determine if, given a more limited test supply, it out-performs the naive approach. bibliography:
- nyt_dataset.bib
- fdoh.bib csl: ieee.csl header-includes:
- \usepackage{mathtools} ...
During the COVID-19 pandemic, test kits were distributed among counties to help assess the spread of the disease, and determine whether or not treatment was necessary. Ideally there are adequate tests for every person in a geographical area, but given the novel nature of the disease the test kits were in short supply.
While test kits are manufactured every day, the distributor of those test kits is left with a dilemma: should one distribute more to areas that appear to be experiencing more infections? If so, how much of the limited test kits should be allocated to highly-infectuous areas and how much should be allocated to areas with low levels of infection?
By combining positive and negative cases into a "score," one could model this problem as a classical multi-armed bandit problem, which illustrates the dilemma between exploration and exploitation. The multi-armed bandit problem imagines a row of slot machines (colloquially known as one-armed bandits) that produce a seemingly random score when an arm is pulled. In such a problem, the agent must decide which arms to pull, considering one of the arms may produce a higher score when pulled more than the other arms. However, if the agent only pulls one arm, he loses out on the opportunity to explore a potentially higher-value arm. The agent can only pull so many arms in a period of time - hence the dilemma. Several algorithms exist to help solve this problem.
Specifically, the exploration of areas with low infection rates should be reconciled with the exploitation of areas with high infection rates. Given the multi-armed bandit problem is established, one can apply several known solutions to this problem and evaluate its performance against real publicly-provided infection data [@NYTData]. This paper explores the epsilon-greedy algorithm as applied to infected counties.
The goal is to use an artificial intelligent agent to smartly distribute limited test kits where they are needed most. Can an artificially intelligent agent out-perform a naive approach of equal test distribution? Such an agent would help mitigate the test kit shortage until enough test kits can be distributed for everyone.
The application is written in the Python programming language and uses an object-oriented programming design. Data is provided from [@NYTData] and [@FDOH] and parsed into accessible data frames. Both the naive agent and an epsilon greedy agent are provided. One is chosen in the simulation class before the experiment is run.
The code follows an object-oriented approach. Some classes have subclasses that offer a specific implementation of its purpose.
- Simulation - the container that sets up the simulation, defining the start/end dates, agents to use, and number of test kits available per-day.
- Environment - the container for the environment state at a specific day. Simulates the passage of time and computes the score of the agent.
- Agent - an abstraction of the agent that defines the sensors (
consume_result) and actuators (distribute_test_kits).- NaiveAgent - a specification of Agent that distributes test kits evenly among all the counties.
- EpsilonGreedyAgent - a specification of Agent that uses an epsilon-greedy approach to distribute test kits while balancing the exploration/exploitation trade-off.
- County - a county under simulation
- TestKitEvaluator - an asbtraction of a means to evaluate a test kit
- RandomTestKitEvaluator - a specification of TestKitEvaluator that evaluates the test based on the result of a coin-flip
- PandasTestKitEvaluator - a specification of TestKitEvaluator that reads in data from a dataset (using the Pandas library) to determine the appropriate percent of positive cases detected, and evaluate the test kit based on that percent chance of positivity.
- ResultConsumer - an abstraction of a class that consumes the result of the test
- PrintResultConsumer - prints the results of all the tests for that day to STDOUT
- PandasResultConsumer - stores the results in a Pandas data frame for later use
- ScoringStrategy - defines the scoring strategy in use
Pandas is an open source python library that is heavily used in the data science community that allows for the easy acquistion, transformation, and storage of data. Pandas was used in the follow ways for this project:
- Obtaining actual infection data from NY times that contains data by county and provides dates, infection counts, and death counts.
- Transformed the data from the entire United States to the five counties in Florida used for this project
- Computing, retrieving, and storing actual infection results and test results from the test kits the agent distributed
- Creating the graphs that are both generated when the simulation runs and the graphs included in this report
The simulation run with a start and end date, provided as parameters in the simulation class. Each day
The test kits for day
$$ N_i = \frac{N}{M} $${#fig:naiveAgent}
The epilon-greedy agent is described by a constant defined as
$$ N_i = \begin{dcases} N(1 - \epsilon) + \frac{N\epsilon}{M} & S(i-1) = max(S) \ \frac{N\epsilon}{M} & S(i-1) \ne S(P_m) \end{dcases} $${#fig:epsilonGreedyAgent}
In other words, the value of
The agent's effectiveness is computed based on both its measure of positive and negative tests. The number of points awarded for a positive test result is V_p, and for a negative test result is V_n. See @fig:score, where
$$ S = \displaystyle\sum_{c=1}^{C}\displaystyle\sum_{d=1}^{D}(V_p P_m(c, d) + V_n N_m(c, d)) $${#fig:score}
A test kit returns positive at a percent equal to the actual percent of positive cases for the county as reported by [@NYTData] for that day. See @fig:test, where
$$ R_m(c, d) = \frac{P_a(c, d)}{T_a(c, d)} $${#fig:test}
The test is positive if a random float between 0 and 1 is less than
The experiment was run on the following counties in Florida:
- Miami-Dade
- Broward
- Palm Beach
- Monroe
- Collier
These counties were chosen due to their proximity to one another and their differences in case numbers. The test simulated test kits being distributed between 21 January 2020, and 18 April 2020. A positive test is rewarded ten times higher than a negative test (
The naive agent was run first, then the epsilon-greedy agent was run with
- Test kit capacity remains constant throughout the simulation
- The population of each county is estimated by the total number tested (as reported by the Florida Department of Health [@FDOH]).
| Agent | Average Score |
|---|---|
| NaiveAgent | 60820 |
| EpsilonGreedyAgent, |
59368 |
| EpsilonGreedyAgent, |
65862 |
| EpsilonGreedyAgent, |
69072 |
| EpsilonGreedyAgent, |
68288 |
| EpsilonGreedyAgent, |
69120 |
The test was run with several values of NaiveAgent. The results are graphed in Figure 1.
It is useful to view these results within the context of the data from the data-set to reveal how close they are to actually measured data. These are illustrated in figures 2 and 3. The top line represents the actual positive cases found during the reported time period, while the bottom line shows the positive test cases found by the agent during a simulated trial. The y-axis uses a logarithmic scale due to the large difference between the measured cases and the actual cases.
\pagebreak
We found that our scoring algorithm rewarded exploitation heavily over exploration. The performance of the NaiveAgent performed slightly better than the performance of the EpsilonGreedyAgent with
As with many fields in AI the choice of a scoring function is very important when modelling real-world applications. Our simulation concluded that distributing the limited test kits to only the highest-infected county was the winning strategy. This conflicts with common knowledge, as at least some test kits must be distributed to uninfected counties in order to discover their infection rate. Put another way, our scoring function led to a local maxima, leaving the agent no choice but to continue distributing test kits to the highest county. The exploitation choice was favored heavily over the exploration choice.
There are further improvements that can be made. The local maxima can be alleviated with simulated annealing. Also, this experiment focused on five counties in Florida, but tests for more counties could prove useful. Further work could test the score of other solutions to the multi-armed bandit problem. A more sophisticated algorithm could take into account the county density, for example. Also the scoring function could be adjusted to reward negative test results, as those hold value as well as positive results. Another area worth exploring is training a neural network based on historical pandemic data to predict which areas should be prioritized before test kits are distributed.
Given the success of the multi-armed bandit problem when modelling other domains, there is high value in continuing this exercise with more advanced techniques. The problem of limited test kits will not be solved, given that novel diseases require novel test kits. While this experiment revealed a weakness in a specific choice of a scoring function, it still serves as a framework upon which new work can be built.


