Custom cost function? #164
-
Hi, is there a way to define custom cost function in the PointCloud geometry? https://ott-jax.readthedocs.io/en/latest/_modules/ott/geometry/costs.html#CostFn Here I can't find a clean way to define a cost function that is not there. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @prabhant! To define a custom cost function, you should create a class that inherits from The simple example is the Euclidean distance:
so for instance you could define your own distance,
and then instantiate a point cloud with that distance should work (in principle!) |
Beta Was this translation helpful? Give feedback.
Hi @prabhant!
To define a custom cost function, you should create a class that inherits from
CostFn
, and, at the very least, define apairwise
function that computes the difference between two vectors (at this moment we only handle distance functions between vectors).The simple example is the Euclidean distance:
so for instance you could define your own distance,