jeanfeydy / geomloss

Geometric loss functions between point clouds, images and volumes
MIT License
570 stars 57 forks source link

Best way to use scikit-learn distance functions for cost #54

Open buchholzmd opened 2 years ago

buchholzmd commented 2 years ago

I am trying to use the sklearn.metrics.pairwise.haversine_distances as the cost for SamplesLoss, in order to calculate the EMD for spherical distributions (see [https://arxiv.org/abs/2012.11116]([EMLight: Lighting Estimation via Spherical Distribution](https://arxiv.org/abs/2012.11116))).

I am feeding in the sample locations in spherical coordinates (angles - dimensions [M,2]). The problem is when computing C_xx, C_yy, C_xy, C_yx, the cost function cannot do this for batches. What is the best way to efficiently implement this?