# Crackovid

*Louis Abraham*, *Gary Bécigneul* and *Bernhard Schölkopf*

**For questions and suggestions, join the slack channel: link**

## Description

Given n people and t testing kits, the characteristics of the test
and estimations of the probability for each person to be sick,
one wants to optimize the way the tests are used by combining several samples.

We assume the events "the i-th is sick" are independent.

Different metrics can be used. For the moment,
the two that are implemented are expected confidence and expected entropy.

## Modes of operation

The program supports 2 modes of operation:

In the optimization mode, the program tries to find an optimal testing framework.

In the evaluation mode, the program is given a testing framework, test results,
and gives the most probable result.

## Notations

- n: number of persons
- t: number of tests
- tpr: true positive rate / recall / hit rate of the test
- tnr: true negative rate / specificity / selectivity of the test
- p1,p2,...,pn: prior probabilities for each person to be sick (possibly estimated based on other data)
- threshold: confidence required to make a diagnosis. If threshold=0.9, the probability of being ill must be less than 0.1 or more than 0.1.
- mode:
`eval`

or `optim`

*in eval mode*:

- test1,test2,...,testt: t binary strings of length n representing tests (1 means testing the person)
- results: binary string of length n representing outcomes (1 means sick)

*in optim mode*:

- m: samples per person, put 0 if it's infinite or more than t
- metric:
`confidence`

, `entropy`

or `diagnosed [threshold]`

- method: optimization method, can be
`ga`

or `ga-luby`

- mutation_parameter: parameter than controls the search, 1-4 is a good range
- luby_basis: only used with
`ga-luby`

, good values are values of `epochs`

that give acceptable results.
- epochs: number of optimization steps

## Input format

**Eval mode**

```
n t
tpr tnr
p1 p2 ... pn
eval threshold
test1
test2
...
testt
results
```

**Optim mode**

```
n t
tpr tnr
p1 p2 ... pn
optim m metric
method mutation_parameter [luby_basis]
epochs
```

## Examples

Eval mode

Optim mode

## Troubleshoot / Feedback

Please report issues and feedback to louis.abraham@yahoo.fr.