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. |
Answered by
marcocuturi
Nov 4, 2022
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!) |
0 replies
Answer selected by
prabhant
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @prabhant!
To define a custom cost function, you should create a class that inherits from
CostFn, and, at the very least, define apairwisefunction 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,