I’m wondering what’s the most efficient way to go about optimizing over a specific distance metric.
As of right now, I have two vectors, x, y and bhattacharyya(x, y) as loaded from Distances.jl. I’d like to call something like optimize(bhattacharyya(x, y), x) in order to find the adjustment to x that minimizes the Bhattacharyya distance between it and y.
If I run the above directly, Julia will crash out without a warning or error after some time.
There’s a better way of coding what I’m trying to perform, but I don’t know how to go about that.
Can someone direct me to some resources or tell me if there’s something glaring that I’m missing?
Is this literally what you type? Then it obviously won’t work, as bhattacharyya(y,x) is a function call, so you call optimize with a number and a vector. What you probably mean is something like
optimize(x->bhattacharyya(y,x), x)
but as they others note… Per definition, a metric d has d(x,y)>= 0 and d(x,y)=0<=>x=y, so setting x to y will give you the global minimum, no need to use numerical optimization here.