oukawa commited on
Commit
c41e3aa
·
verified ·
1 Parent(s): 7872046

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +94 -3
README.md CHANGED
@@ -1,3 +1,94 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: sklearn
4
+ tags:
5
+ - tabular-regression
6
+ - random-forest
7
+ - scikit-learn
8
+ - shap
9
+ - explainable-ai
10
+ - public-health
11
+ - air-quality
12
+ ---
13
+
14
+ # PRISMA: random forest models of respiratory hospital admissions in Curitiba and Araucária, Brazil
15
+
16
+ Code and trained models for the manuscript *Environmental and socioeconomic predictors of respiratory hospital
17
+ admissions: An explainable machine learning approach* (under review in *Urban Climate*).
18
+
19
+ Random forest (RF) models predict hospital admissions for lower respiratory infections (LRI), chronic respiratory
20
+ diseases (CRD) and other respiratory conditions (Other) in Curitiba and Araucária (Paraná State, Brazil), 2003–2017,
21
+ for four age groups. SHapley Additive exPlanations (SHAP) describe the contribution of each predictor.
22
+
23
+ - **Temporal models**: weekly admission rates for the city as a whole, from weather, climate indices, air pollutants,
24
+ trend and season (24 predictors).
25
+ - **Spatial models**: cumulative admissions on a 1-km grid, from socioeconomic variables, population density, road
26
+ density and local climate zones (27 predictors).
27
+
28
+ The models describe associations learned from the data; SHAP values are not causal effects, and correlated predictors
29
+ (e.g., temperature and season, or NOx, NO2 and CO) should be interpreted jointly.
30
+
31
+ ## Files
32
+
33
+ | File | Content |
34
+ |---|---|
35
+ | `RF_temporal_{LRI,CRD,Other}_admissions_per_1_million_all_groups.pkl` | Main temporal models (M2, all 24 predictors) |
36
+ | `RF_spatial_{LRI,CRD,Other}_admissions_per_1_million_all_groups.pkl` | Main spatial models (S2, all 27 predictors) |
37
+ | `RF_temporal_training_and_cross-validation_all_diseases_and_groups.ipynb` | Blocked cross-validation, buffer test, nested models and lags, final models, grid search |
38
+ | `RF_spatial_training_and_cross-validation_all_diseases_and_groups.ipynb` | Spatially blocked cross-validation, nested models, final models, grid search |
39
+ | `RF_data_processing_temporal_and_spatial.ipynb` | Builds both input matrices following the manuscript (Sections 2.3.1–2.3.4, S1): weekly air quality, weather, climate indices and admission rates; 1-km grid with census, income, GDP, roads, LCZ and admissions |
40
+
41
+ Each `.pkl` holds a dict with one fitted `RandomForestRegressor` per age group, keyed `{disease}_{group}`, e.g.
42
+ `LRI_General`, `LRI_G1`, `LRI_G2`, `LRI_G3`. Age groups: General (all ages), G1 (4 years and under), G2 (5–59 years)
43
+ and G3 (60 years and over). Targets are admissions per 1 million inhabitants (per week for the temporal models;
44
+ cumulative over 2003–2017 for the spatial models).
45
+
46
+ All models use 500 trees, a maximum depth of 20, all features at each split, a minimum of two samples to split a
47
+ node, one sample per leaf and bootstrap sampling (Table S3).
48
+
49
+ ## Usage
50
+
51
+ ```python
52
+ import joblib
53
+ import pandas as pd
54
+
55
+ models = joblib.load('RF_temporal_LRI_admissions_per_1_million_all_groups.pkl')
56
+ model = models['LRI_G1']
57
+ print(list(model.feature_names_in_)) # predictor columns, in order
58
+ # X: DataFrame with these columns -> weekly LRI admissions per 1 million inhabitants (children aged 4 and under)
59
+ # pred = model.predict(X[model.feature_names_in_])
60
+ ```
61
+
62
+ The models were trained with scikit-learn 1.6.1 and re-saved with scikit-learn 1.8.0 (same trees; predictions agree
63
+ with the original files to within 1e-12). Loading them with another version raises a warning, and scikit-learn 1.8
64
+ is recommended.
65
+
66
+ ## Predictors
67
+
68
+ **Temporal** (weekly means unless noted): `t_min`, `t_max`, `t_mean`, `t_amp` (°C), `rh` (%), `ws` (m s-1),
69
+ `insolation` (h), `evaporation` (mm), `rainfall` (mm, weekly total), `cdd`, `cwd`, `chd`, `ccd` (consecutive dry, wet,
70
+ hot and cold days), `julian_day`, `unix_time` (s), `season_fall`, `season_spring`, `season_winter` (summer is the
71
+ reference), `so2`, `no2`, `nox`, `o3`, `pm10` (µg m-3) and `co` (mg m-3).
72
+
73
+ **Spatial** (per 1-km cell): `WHT`, `BLK`, `YEL`, `BRN`, `IND` (% self-reported skin color/race), `LT` (% literate),
74
+ `PD` (inhabitants km-2), `PCI` and `GDP` (USD per capita), `RD` (road density, km-1) and `LCZ_1`–`LCZ_10`,
75
+ `LCZ_A`–`LCZ_G` (fraction of each local climate zone).
76
+
77
+ ## Validation
78
+
79
+ - Temporal: month-per-season blocked cross-validation, six folds, with a 1-week buffer between training and test
80
+ weeks (also tested with 0, 2 and 4 weeks).
81
+ - Spatial: spatially blocked 5-fold cross-validation with 5 × 5 km blocks.
82
+
83
+ Scores, nested models, lags and errors by predictor tertile are reported in the Supplementary Material (Tables S2–S8).
84
+
85
+ ## Data
86
+
87
+ The input matrices are not included. Hospital admissions are from DataSUS SIH, census data from IBGE (2010), the road
88
+ network from OpenStreetMap, local climate zones from the LCZ Generator, and per capita GDP from Kummu et al. (2025).
89
+ Air quality and weather data were obtained from IAT and INMET and cannot be shared. The notebooks document the
90
+ expected columns.
91
+
92
+ ## License
93
+
94
+ MIT