-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow initial-guess methods to solve for lambda #14
Conversation
I think this is a great extension. However, I wonder if we should maintain the function gcv_tr(Ψ::RegularizationProblem, b̄::AbstractVector, λ::AbstractFloat) function. If we want/need one with log10 initialization, maybe we can just add gcv_tr(Ψ::RegularizationProblem, b̄::AbstractVector, log10λ::AbstractFloat) = gcv_tr(Ψ, b̄, log10(λ)) which would maintain full backward compatibility. That way the docs won't break either, which is a plus. Do you agree? |
From what I could tell, the only use for |
It's mentioned here to help with diagnostics: https://mdpetters.github.io/RegularizationTools.jl/stable/manual/#Extracting-the-Validation-Function. It's of course not a big deal to change it in the docs. I doubt that anything relies on it. |
OIC, in that example you calculate and observe the shape of the GCV curve. That could be potentially useful for other problems, even just for illustration. I'll revert those few changes and create separate functions ones that take |
5ca099f
to
1ce6adb
Compare
This is ready for another review. Note that I did run the tests after these changes, and I am finding failures for some (not all) the tests in |
The test problem is relating size distribution to optical properties of particles and is highly sensitive to noise. Optimizing over If you have a good mathematical argument that using Solving the test problem, optimizing over
Solving the test problem, optimizing over
|
Yes, indeed, there are two local minima for your test problem: As an engineer, I do not have a rigorous mathematical argument, and I may even be abusing vocabulary, but clearly the GCV response to lambda happens more evenly in log-space. I discovered this when previously working on regularization for data-smoothing applications. A secondary motivation is that lambda stays positive when using unbounded optimization methods (e.g. NelderMead) with log10(lambda). I noticed I was getting negative values before I implemented this PR, an artifact of defining the regularization parameter as a squared term -- while easy to correct (just take the absolute value of the minimizer), it means the solver was traversing into negative space which is unnecessary and inefficient. |
I think this is a good argument to make |
I've implemented some changes to
solve(Psi, b; kwargs...)
so that the user may specify the optimization method to use to solve for lambda. I also changed the objective functions to solve forlog10(lambda)
, which I think speeds it up a little, and also lambda does not mistakenly become negative when used with an initial-guess solver (rather than a bounded solver). Example usage:Let me know what you think. AFAICT, everything is backward compatible. If you like the approach, I will also do the same for
solve(Psi, b, x0; kwargs...)
, and update docs and tests.