Skip to content

[WIP] COBYLA solver: Track best-performing parameters during optimization#1240

Open
carolinafernandezp wants to merge 3 commits intojonescompneurolab:masterfrom
carolinafernandezp:track-best-params-cobyla
Open

[WIP] COBYLA solver: Track best-performing parameters during optimization#1240
carolinafernandezp wants to merge 3 commits intojonescompneurolab:masterfrom
carolinafernandezp:track-best-params-cobyla

Conversation

@carolinafernandezp
Copy link
Contributor

The COBYLA algorithm implemented by SciPy returns the set of parameters that attempts to minimize the objective function at termination, instead of the argmin over all evaluated parameter sets. This means that, currently, optim.net_ when optim = Optimizer(net, solver='cobyla') does not return the optimized network, but the network that was last explored.

The fix I'm implementing here is to track the best parameter set and corresponding objective value over all evaluated parameter sets. In other words, the proposed fix is to store and return the parameter set corresponding to the lowest observed objective value rather than the final iterate for the COBYLA solver.

We already do this with the Bayesian optimization function we implemented in externals, which is why we don't run into the same issue with the bayesian solver.

…ed objective value rather than the final iterate (COBYLA solver)
@asoplata asoplata moved this from Backlog to In progress in HNN Workspace Turbo 9000 Feb 6, 2026
@asoplata
Copy link
Collaborator

asoplata commented Feb 6, 2026

Thanks Carolina, is this ready to go or is it still a work-in-progress?

If it's ready to go, is it okay if I push some commits in order to fix the tests breaking? We just pushed a commit to master yesterday that fixes an issue with our circleci step failing (1fb6074 ). I can add it to your branch myself if that's okay with you (along with other commits that will fix unit test breakage).

@carolinafernandezp
Copy link
Contributor Author

Thanks Carolina, is this ready to go or is it still a work-in-progress?

If it's ready to go, is it okay if I push some commits in order to fix the tests breaking? We just pushed a commit to master yesterday that fixes an issue with our circleci step failing (1fb6074 ). I can add it to your branch myself if that's okay with you (along with other commits that will fix unit test breakage).

Yes that sounds great, thank you @asoplata!

@asoplata
Copy link
Collaborator

asoplata commented Feb 9, 2026

@carolinafernandezp Is this ready for review / merge? Or is it still a work in progress?

Currently, both the script and notebook versions of our example file
`examples/workflows/plot_simulate_somato.py` fail because of an upstream
breakage in how the MNE sample data is downloaded and unpacked (see here
fatiando/pooch#518
This change fixes the issue by "capping" the Pooch version to a prior
version which does not contain the bug.
@asoplata
Copy link
Collaborator

This appears to be a WIP work in progress, since there are legitimate test failures occurring

@asoplata asoplata changed the title COBYLA solver: Track best-performing parameters during optimization [WIP] COBYLA solver: Track best-performing parameters during optimization Feb 11, 2026
@asoplata
Copy link
Collaborator

Hey @carolinafernandezp I've made a pull request to your branch on your fork here carolinafernandezp#1 that should fix the failing test, see that for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

2 participants