Views
No views yet
well-being = 5.407 + 1.132 · DEV + 0.119 · SOCindex_specification.json — standardization parameters + index definitions/weightslatentwb1/regression.json — fitted regression (coefficients, CIs, fit stats)1import json
2from huggingface_hub import hf_hub_download
3
4spec = json.load(open(hf_hub_download("snowfire/wellspring-latentwb1", "index_specification.json")))
5reg = json.load(open(hf_hub_download("snowfire/wellspring-latentwb1", "latentwb1/regression.json")))
6p = reg["fit"]["params"] # {const, DEV_index_std, SOC_index_std}
7
8def predict(row): # row: dict of the six raw drivers
9 z = {d: (row[d] - spec["standardize_mean"][d]) / spec["standardize_std"][d] for d in spec["drivers"]}
10 idx = {code: sum(ax["weights"][m] * z[m] for m in ax["members"]) for code, ax in spec["axes"].items()}
11 return p["const"] + p["DEV_index_std"] * idx["DEV"] + p["SOC_index_std"] * idx["SOC"]