Skip to content

Conversation

@alexshepard
Copy link
Contributor

note there are required changes to config.yml, check out config.yml.example

the current path, with centroids, requires no changes other than to mention in the config file that use_coord_encoder = false. I did this because I didn't want to assume you'd be ok with switching the whole coord encoding scheme to this coord encoder class, Patrick. if you're ok with it, I can migrate the existing centroid based geo prior inference and geo encoding scheme to use the CoordEncoder class throughout the repo, but that seems like more work than I wanted to take on without at least talking with you first. basically, I was trying to add the possibility of the new coordinate encoding scheme in a way that would be flexible going forward (supporting hd encodings, other env covariates, etc) while making as little impact to the existing implementation as possible. however you think I should proceed, happy to follow your direction.

@alexshepard alexshepard requested a review from pleary August 11, 2025 12:30
Copy link
Member

@pleary pleary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all is looking good to me. I made a few changes so that the geo_score returned by the API uses the same calculation it used to (H3 elevation encoder). It returns the new CoordEncoder geo score in a new attribute raster_geo_score so we can assess both as needed

elif encoder == "raster" and self.coord_encoder is not None:
stacked_loc = np.array([[float(lng), float(lat)]])
encoded_loc = self.coord_encoder.encode(stacked_loc)
geo_scores = self.geo_elevation_model.predict_encoded(encoded_loc)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point I think I'd like to refactor things so the TFGeoPriorModelElev class accepts a lat/lng and elevation encoding type and does the elevation calculation and scoring itself. That way TFGeoPriorModelElev can call CoordEncoder if it needs to, and this InatInferrer class doesn't need to think about those things. InatInferrer will just ask for the geo score for a lat lng using the traditional H3 encoder, or using the new CoordEncoder encoder and TFGeoPriorModelElev will handle the rest

@pleary pleary merged commit 524c6b0 into main Aug 15, 2025
9 checks passed
@pleary pleary deleted the centroids_fix branch August 15, 2025 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants