Skip to content

Commit 51b1985

Browse files
authored
Merge pull request #7 from ihmeuw/feature/rmbarber/v7-supplemental
use v7.1 and experiment 101; for gbd_2023 raking, set 2024 to end year
2 parents 4c32f0a + c5ddec5 commit 51b1985

File tree

7 files changed

+48
-14
lines changed

7 files changed

+48
-14
lines changed

src/rra_population_model/constants.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def to_list(cls) -> list[str]:
2727

2828
class BuiltVersion(BaseModel):
2929
provider: Literal["ghsl", "microsoft"]
30-
version: Literal["v6", "v7", "r2023a"]
30+
version: Literal["v6", "v7", "v7_1", "v7_e101", "r2023a"]
3131
time_points: list[str]
3232
measures: list[str]
3333

@@ -72,9 +72,6 @@ def time_points_float(self) -> list[float]:
7272
"microsoft_v7": BuiltVersion(
7373
provider="microsoft",
7474
version="v7",
75-
# time_points=[
76-
# f"{y}q{q}" for y, q in itertools.product(range(2020, 2025), range(1, 5))
77-
# ][1:-2],
7875
time_points=[
7976
f"{y}q{q}" for y, q in itertools.product(range(2020, 2024), range(1, 5))
8077
][1:],
@@ -83,6 +80,24 @@ def time_points_float(self) -> list[float]:
8380
"height",
8481
],
8582
),
83+
"microsoft_v7_1": BuiltVersion(
84+
provider="microsoft",
85+
version="v7_1",
86+
time_points=['2020q2', '2024q2'],
87+
measures=[
88+
"density",
89+
"height",
90+
],
91+
),
92+
"microsoft_v7_e101": BuiltVersion(
93+
provider="microsoft",
94+
version="v7_e101",
95+
time_points=['2023q4'],
96+
measures=[
97+
"density",
98+
"height",
99+
],
100+
),
86101
}
87102

88103
DENOMINATORS = []

src/rra_population_model/model/train/runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def train(
110110
queue: str,
111111
) -> None:
112112
pm_data = PopulationModelData(output_dir)
113-
today, last_version = utils.get_last_run_version(output_dir)
113+
today, last_version = utils.get_last_run_version(pm_data.model_root(resolution))
114114
node_args = []
115115
for i, (denom, ntl) in enumerate(itertools.product(denominator, ntl_option)):
116116
version = f"{today}.{last_version + i + 1:03d}"
@@ -132,7 +132,7 @@ def train(
132132
"queue": queue,
133133
"cores": 1,
134134
"memory": "240G",
135-
"runtime": "120m",
135+
"runtime": "150m",
136136
"project": "proj_rapidresponse",
137137
},
138138
log_root=pm_data.log_dir("model_train"),

src/rra_population_model/model_prep/features/built.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def generate_derived_measures(
132132
if self.built_version.name == "ghsl_r2023a":
133133
# No derived measures for GHSL
134134
return {}
135-
elif self.built_version.name in ["microsoft_v6", "microsoft_v7"]:
135+
elif self.built_version.name.startswith("microsoft"):
136136
return _generate_microsoft_derived_measures(pm_data, self.feature_metadata, self.built_version.name)
137137
else:
138138
msg = f"Unknown built version: {self.built_version.name}"
@@ -269,6 +269,16 @@ def _generate_microsoft_derived_measures(
269269
"height": "microsoft_v7_height",
270270
"p_residential": "ghsl_r2023a_proportion_residential",
271271
},
272+
"microsoft_v7_1": {
273+
"density": "microsoft_v7_1_density",
274+
"height": "microsoft_v7_1_height",
275+
"p_residential": "ghsl_r2023a_proportion_residential",
276+
},
277+
"microsoft_v7_e101": {
278+
"density": "microsoft_v7_e101_density",
279+
"height": "microsoft_v7_e101_height",
280+
"p_residential": "ghsl_r2023a_proportion_residential",
281+
},
272282
}[built_version_name]
273283
density = pm_data.load_feature(
274284
feature_name=feature_dict["density"],

src/rra_population_model/model_prep/features/runner.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@
1515
from rra_population_model.model_prep.features.metadata import get_feature_metadata
1616
from rra_population_model.model_prep.features.ntl import process_ntl
1717

18-
# GHSL first, as we need the height and residential mask for msft
18+
# GHSL first, as we need the residential mask for msft
1919
BUILT_VERSIONS = [
2020
# pmc.BUILT_VERSIONS["ghsl_r2023a"],
21-
pmc.BUILT_VERSIONS["microsoft_v7"],
21+
# pmc.BUILT_VERSIONS["microsoft_v6"],
22+
# pmc.BUILT_VERSIONS["microsoft_v7"],
23+
pmc.BUILT_VERSIONS["microsoft_v7_1"],
24+
pmc.BUILT_VERSIONS["microsoft_v7_e101"],
2225
]
2326

2427

@@ -172,8 +175,8 @@ def features(
172175
task_resources={
173176
"queue": queue,
174177
"cores": 1,
175-
"memory": "15G",
176-
"runtime": "30m",
178+
"memory": "5G",
179+
"runtime": "10m",
177180
"project": "proj_rapidresponse",
178181
"constraints": "archive",
179182
},

src/rra_population_model/model_prep/training_data/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def training_data(
154154
"queue": queue,
155155
"cores": 1,
156156
"memory": "30G",
157-
"runtime": "60m",
157+
"runtime": "30m",
158158
"project": "proj_rapidresponse",
159159
},
160160
max_attempts=5,

src/rra_population_model/postprocess/rake_itu.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ def load_admin_populations(
2828
# Interpolate the time point population
2929
if "q" in time_point:
3030
year, quarter = (int(s) for s in time_point.split("q"))
31-
next_year = min(year + 1, 2100)
31+
if RAKING_VERSION == "gbd_2023":
32+
next_year = min(year + 1, 2024)
33+
else:
34+
next_year = min(year + 1, 2100)
3235
weight = (int(quarter) - 1) / 4
3336

3437
prior_year_pop = all_pop.loc[year]

src/rra_population_model/postprocess/raking_factors/runner.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ def load_admin_populations(
2929
# Interpolate the time point population
3030
if "q" in time_point:
3131
year, quarter = (int(s) for s in time_point.split("q"))
32-
next_year = min(year + 1, 2100)
32+
if RAKING_VERSION == "gbd_2023":
33+
next_year = min(year + 1, 2024)
34+
else:
35+
next_year = min(year + 1, 2100)
3336
weight = (int(quarter) - 1) / 4
3437

3538
prior_year_pop = all_pop.loc[year]

0 commit comments

Comments
 (0)