Upload folder using huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: flax
|
| 4 |
+
tags:
|
| 5 |
+
- jax
|
| 6 |
+
- flax
|
| 7 |
+
- nnx
|
| 8 |
+
- normalizing-flow
|
| 9 |
+
- rational-quadratic-spline
|
| 10 |
+
- quantile-regression
|
| 11 |
+
- malaria
|
| 12 |
+
- epidemiology
|
| 13 |
+
pipeline_tag: tabular-regression
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# estiMINT RQS models
|
| 17 |
+
|
| 18 |
+
Conditional rational-quadratic spline (RQS) normalizing flows used by
|
| 19 |
+
[estiMINT](https://github.com/CosmoNaught/estiMINT) to predict quantiles of
|
| 20 |
+
malaria transmission intensity targets (EIR, prevalence, human biting rate)
|
| 21 |
+
from intervention-coverage covariates.
|
| 22 |
+
|
| 23 |
+
Each model is a `ConditionalRQS` flow (`src/estimint/v2/models/rqs.py`): an
|
| 24 |
+
MLP maps context features to spline parameters, which transform a standard
|
| 25 |
+
normal base distribution into the target's (standardized, log10) distribution.
|
| 26 |
+
Sampling a quantile `q` amounts to inverting the flow at `Phi^-1(q)`, which
|
| 27 |
+
gives calibrated predictive intervals in addition to a point (median) estimate.
|
| 28 |
+
|
| 29 |
+
## Repo layout
|
| 30 |
+
|
| 31 |
+
Each subfolder is one trained predictor -> target artifact, named
|
| 32 |
+
`<predictor>-<target>`:
|
| 33 |
+
|
| 34 |
+
```
|
| 35 |
+
<predictor>-<target>/
|
| 36 |
+
config.json # architecture hyperparams + fitted feature/target scalers
|
| 37 |
+
checkpoint/ # Orbax checkpoint for the model params (nnx.State)
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
| Artifact | Predictor | Target |
|
| 41 |
+
|---|---|---|
|
| 42 |
+
| `eir-prev_y9` | `eir` | `prev_y9` |
|
| 43 |
+
|
| 44 |
+
Predictor/target values come from `PredictorType` in
|
| 45 |
+
`src/estimint/v2/common/types.py`: `"eir"`, `"prev_y9"`, `"hbr_y9"`.
|
| 46 |
+
|
| 47 |
+
Context features (`src/estimint/v2/data/features.py`) are the predictor
|
| 48 |
+
value followed by `FEATURES_BASE`:
|
| 49 |
+
`dn0_use, Q0, phi_bednets, seasonal, itn_use, irs_use`.
|
| 50 |
+
|
| 51 |
+
## Usage
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
from estimint.v2.models.rqs import ConditionalRQS
|
| 55 |
+
|
| 56 |
+
# from a local export directory
|
| 57 |
+
artifact = ConditionalRQS.from_pretrained("artifacts", name="eir-prev_y9")
|
| 58 |
+
|
| 59 |
+
# from this Hub repo
|
| 60 |
+
artifact = ConditionalRQS.from_pretrained("<org>/<repo>", name="eir-prev_y9")
|
| 61 |
+
|
| 62 |
+
artifact.predict(X_raw) # median prediction
|
| 63 |
+
artifact.quantile(X_raw, 0.9) # single quantile
|
| 64 |
+
artifact.interval(X_raw, alpha=0.10) # (lower, upper) conformal band
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
`X_raw` is a `(batch, n_context)` array of raw (unstandardized) feature
|
| 68 |
+
values in the order described above.
|
| 69 |
+
|
| 70 |
+
## Training
|
| 71 |
+
|
| 72 |
+
Models are trained with `estimint.v2.train_base` (Hydra config in
|
| 73 |
+
`src/estimint/v2/conf/train_config.yaml`) and exported for sharing with
|
| 74 |
+
`estimint.v2.model_export` (`src/estimint/v2/conf/export_config.yaml`),
|
| 75 |
+
which writes the `config.json` + `checkpoint/` pair uploaded here.
|
| 76 |
+
|
| 77 |
+
## License
|
| 78 |
+
|
| 79 |
+
MIT, matching the parent [estiMINT](https://github.com/CosmoNaught/estiMINT) repo.
|