DensityRatioEstimation.jl icon indicating copy to clipboard operation
DensityRatioEstimation.jl copied to clipboard

densratiofunc never terminates

Open 3f6a opened this issue 11 months ago • 4 comments
trafficstars

using DensityRatioEstimation, Optim
d = densratiofunc(5randn(100), randn(1000), KLIEP())

I am running this but it takes forever. Seems it will never finish.

3f6a avatar Nov 26 '24 08:11 3f6a

I can reproduce the issue. Thank you for reporting. Will take a look into it.

juliohm avatar Nov 26 '24 08:11 juliohm

@3f6a this is actually a problem with the Optim backend. If you switch to ConvexLib for example, it works as expected:

using DensityRatioEstimation, Convex, ECOS

d = densratiofunc(5randn(100), randn(1000), KLIEP(), optlib=ConvexLib)

I am investigating if something changed in Optim.jl that could potentially affect the convergence rate here.

In any case, I am also investigating a complete refactor to help end-users. The approach with extensions is non-trivial as we need to load both the optimization framework (Convex.jl) and the solver (ECOS.jl) for it to work.

juliohm avatar Nov 26 '24 13:11 juliohm

The issue is indeed in Optim.jl, reported here: https://github.com/JuliaNLSolvers/Optim.jl/issues/1121

juliohm avatar Nov 26 '24 16:11 juliohm

@3f6a as a side note, I would simply use SLIC instead of KLIEP as it is much faster and produces better results in general. Still, we need to fix the issue with the Optim.jl backend. Any help is appreciated.

juliohm avatar Nov 27 '24 16:11 juliohm