Conversation
pleary
left a comment
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
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.