# Heuristic Reasons
### Description
I wanted to investigate which rules in the heuristic algorithm were the most "efficient". To do this, I have partitioned the population into 4 groups (though I'm happy to add more):
- **symptomatic infected** (people who have covid symptoms and are either infectious or exposed state)
- **symptomatic uninfected** (people who have cold or flu symptoms)
- **asymptomatic infected** (this includes presymptomatic people, just people who do not have symptoms),
- **asymptomatic uninfected** (this is the general population)
The "reasons" for a recommendation level are essentially the rules that were triggered and to produce a rec level. We may have multiple rules triggered, e.g. risk message and recovered. In this example, someone has received a high-risk message that would normally put them into rec level 3, but since they are recovered they remain rec level 0.
The form of these plots is a stack bar plot, with colors representing rec levels from -1 (pre-intervention initialized rec level), 0 (most free), to 3 (quarantine / 0 mobility). The y-axis is the number of samples (where a sample is recorded every hour for every person).
### Preliminary Results
Simulation parameters `n_people=3000 init_fraction_sick=0.006 INTERVENTION_DAY=5 GLOBAL_MOBILITY_SCALING_FACTOR=0.6 simulation_days=50 intervention=heuristicv1`
#### Heuristic v1




##### Analysis
Of course, the Asymptomatic Infected population only has non-zero rec level as a result of risk messages. Sadly, when compared to asymptomatic _infected_, we see that in heuristicv1 99.65% of the time, asymptomatic people who have a rec level of 2 or 3 based on risk messages are actually uninfected. This implies that we should be more conservative with risk messages.
I think we need more information about that. We can modify the rule to increase the number of high risk messages that must be received to increase the rec level. We could also make this rule depend on prevalence.
Comparing the symptomatic groups seems to indicate that there are actually substantially more people who are symptomatic as a result of of non-covid disease than covid. I see 60,000 samples from symptomatic infected people compared to more like 6,000 samples from symptomatic _uninfected_. This may mean that cold/flu are causing too many symptoms. Regardless, we could modify the symptom rule to differentiate between covid-like and non-covid-like symptoms.
#
#### Heuristic v3




##### Analysis
Comparing **Asymptomatic Infected** to **Asymptomatic Uninfected** reveals that heuristicv3 puts more uninfected people in rec level 1 than infected people. The dominant method of catching asymptomatic infected people remains, of course, risk messages.
Analyzing the symptomatic population reveals that cold and flu do not result in rec level 3 (no severe symptoms). Again, there are ~3x more samples from uninfected people with low-grade symptoms than infected people. The majority of these are placed into rec level 1.
#### Risk Messages
I'm in the process of running additional plot showing the distribution of risk messages in infected and uninfected people. Here are preliminary results from a run of heuristicv3 with only 1,000 people (to be replaced). Our heuristic class of algorithms have 4 groups of risk messages (with 3 thresholds). These thresholds are set differently in v1, v2, and v3. The risk message plots are stack bar plots that use the thresholds defined by these algs. Our goal in analyzing them is to propose better thresholds and a rule based on number of encounters with a risk. In these plots, we do not distinguish between when the encounters were had, rather just the quantity of encounters.
##### Heuristicv1 risk messages (GLOBAL_MOBILITY_SCALING_FACTOR 0.6)




##### Heuristicv3 risk messages (GLOBAL_MOBILITY_SCALING_FACTOR 0.6)




#### Risk MessageComparison plot heuristicv1

#### Symptoms Comparison Heuristicv1


### Heuristicv4
#### Pareto


#### Jelly Beans









#### Presymptomatic (global mobility scaling0.5 )





### Next steps
Record heuristic v4 plot
TODO:
- [ ] modify recovered rule to align with simulator
- [x] analyze heuristic v3
<!-- - [ ] average multiple seeds (these plots were generated from 1 run) -->
- [x] make new plots that show the distribution of risk messages received by asymptomatic people, split into infected/uninfected
- [x] Plot number of symptoms for infected/uninfected and their cause (dropin). Plot breakdown by type of symptom, too.
- [x] compare performance across multiple mobility settings (low, medium, high)
- [x] write (and analyze) heuristicv4