-
Notifications
You must be signed in to change notification settings - Fork 16
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
Control over Learning Rate and/or initial step size in linesearch #108
Comments
Hi Matilda, you could indeed define a custom solver by re-using the searches and descents and tweaking their constants, if you desire smaller steps on average. A learning rate would not necessarily be a meaningful concept if used with a backtracking line search or a classical trust region. They choose the step length based on optimality criteria, rather than just going into some direction regardless of whether this actually improves the objective function (by the expected amount) or not. You could still bias these toward smaller step sizes (e.g. by requiring that Instead of tweaking solver attributes as above, you can also modify the solvers like this: import equinox as eqx
import optimistix as optx
solver = optx.SomeSolver(...)
search = optx.BacktrackingArmijo(..., step_init=...) # Use your pick of constants
get = lambda s: s.search
solver = eqx.tree_at(get, solver, search) I do this when I quickly want to try something out and don't want to bother writing down the attributes and constructor, but if I would actually use the solver many times, I'd do it properly :) |
@matillda123 do you have an example of the kind of thing you'd like to do, using a particular solver for clarity? :) |
I'm not sure if it's possible to give a short example here. What im trying to do is basically fitting of a high-dimensional function to some data. The function basically consists of some FFTs. I'm not using one specific solver, rather I'm trying to get a feeling which solvers work nicely for this problem I hope its clearer now what the issue is. |
I see, tough optimisation problem! It sounds like you want to do hyperparameter tuning - what do you get if a solver is not working well? Convergence to a local minimum, running out of steps, divergence? And are you working with complex numbers, or have you split the problem into complex and real parts? |
I have real inputs but I use those to make complex numbers. |
So optimistix only ever sees real numbers? The functions you are working with can have several local minima, right? In this case, you might want to try multi-starting your optimisation. Line 126 in dcafc48
(It sounds like you tried Those are but two suggestions - I'm afraid I can't say much more with only a basic idea of what your problem is. |
Yes, optimistix should only see real numbers. So far I only used standard solvers (mainly BFGS, NonlinearCG, GaussNewton and Dogleg). I think Dogleg has a trustregion linesearch. But it's tricky as that is one of the cases which can get stuck in local minima. Alright, so I guess there is no way around modifying the solvers with different searches and tuning their parameters. Thanks for the suggestions. :) |
Alright! Happy solving :) |
Hi,
is there a convenient way to influence the step size of the available minimizers/least_square solvers? (E.g. in optax one has the learning_rate argument for all optimizers)
So far with the optimistix solvers I was only able to gain some control by changing
solver.search.__dict__["step_init"]
, which doesnt seem right.I guess one could just define a custom solver. But it seems weird that on one side there is so much customizability with the modular approach of optimistix, while with the predefined solvers there is very little user-control.
The text was updated successfully, but these errors were encountered: