Repository navigation
fix: build the adjacency graph with planar geometry and release 0.1.4 - #11
Merged
Merged
Conversation
…ject valid boundaries
ivargr
marked this pull request as ready for review
October 15, 2026 11:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prediction failed on the Vietnam provinces dataset on the chap benchmarking server:
spdep::poly2nbinbuild_graphuses sf's spherical s2 engine by default. s2 rejects the Ho Chi Minh City polygon, although every one of the 63 polygons is valid in the plane (GEOS). The adjacency graph only needs shared borders, sobuild_graphnow turns s2 off aroundpoly2nband restores the caller's setting afterwards. Nothing else changes; datasets that worked before get the same graph.scripts/lib.R:sf::sf_use_s2(FALSE)beforepoly2nb, restored withon.exit.tools/test_lib.R: checks that s2 rejects the fixture, thatbuild_graphstill finds the two provinces are neighbours, and that the s2 setting is restored.tools/fixtures/s2_invalid_geo.json: Ho Chi Minh City and Binh Duong from the Vietnam boundaries (geoBoundaries, via dhis2/climate-health-data).main.py: version 0.1.4, so the fix can be released and installed on its own. Draft PR feat: add an MLproject generated from main.py and bump the version to 0.1.5 #10 also bumps to 0.1.4 and will need 0.1.5 after this.Test plan
tools/test_lib.Rpasses in the 0.1.3 image (ghcr.io/chap-models/chapkit_ghr_model:sha-dfb2e3f). The oldbuild_graphfails on the fixture with the same s2 error.monthly_climateoptions).scripts/mounted into that image trains and predicts: 189 rows x 1000 samples, all finite. 87% of the observed values fall inside the 10-90% interval; Ho Chi Minh City gets its six neighbouring provinces.