Comments (5)
I really like the quality of the documentation,
I am genuinely surprised 🤣
You can use a callback to store the u
s and pass it to the solve
call -
ustore = []
function my_storing_callback(state, l)
push!(ustore, state.u)
return false
end
from optimization.jl.
I am genuinely surprised 🤣
Yeah, I actually found the things that I'd been looking for, so 👍 (except the one above)
Thank you! Ok, this is actually the way I am doing it right now... maybe this is something for a feature request (e.g. adding u_latest
to the result struct) or does this feel like an exotic requirement?
from optimization.jl.
Since some solvers already store this in their results I haven't seen a reason to do this and increase the memory usage even more for the results (and you as the user can do it with the callback)
from optimization.jl.
If some solvers already store this, then you just use the same reference and there's no extra memory cost?
from optimization.jl.
I have another example where this is very common: Stochastic batching when optimizing ML models... without the option to pick the latest
instead of the best
minimizer, the optimization will return the minimizer of the best batch element loss - which might be a completely outdated parameter set ...
Also: The callback gets called one last time for the best element after optimization finished, so with the code above:
ustore = []
function my_storing_callback(state, l)
push!(ustore, copy(state.u)) # copy required because inplace modification of `state.u`
return false
end
ustore[end] # the best value
ustore[end-1] # actually the latest value during optimization
I didn't check the implementation, but wouldn't it be possible to let a keyword decide if either the state best
or latest
gets stored without additional memory required?
Thanks!
from optimization.jl.
Related Issues (20)
- Include `searchdirection` in `OptimizationState` HOT 2
- The `callback` appears to be called for linesearch iterations HOT 1
- `PolyOpt` only accept functions without any extra inputs HOT 1
- US spelling preferred? HOT 1
- Augmented Lagrangian HOT 5
- Multithreading support for Optimizers like BBO
- Is there currently a feasible way to use NamedTuple or ComponentArray as x0 for Optimization.jl HOT 1
- Callback signature doesn't match with the docs for PRIMA HOT 1
- Optimization.LBFGS() can not compute the gradient HOT 5
- BBO always returns retcode Failure HOT 1
- ERROR: UndefVarError: `NoAD` not defined HOT 5
- callback-generated stopping criteria no longer work in OptimizationNLopt HOT 9
- BFGS fails with user-supplied derivative and bounds (regression in v3.25.0, v3.25.1)
- OptimizationOptimJL.Optim.BFGS() missing tests for user-supplied derivatives (grad), upper/lower bounds, and the combination
- Reopen issue 755 : OptimizationOptimJL.Optim.BFGS() missing tests for user-supplied derivatives (grad), upper/lower bounds, and the combination
- FORCED_STOP from OptimizationNLopt callback returns best point PRIOR to callback, making it unuseful for custom stopping criteria. Is that intended? HOT 2
- Update `OptimizationPRIMA` `[compat]` for `PRIMA` to `0.2.0` HOT 1
- OptimizationOptimJL fails to precompile HOT 2
- Disassociate batching from the `data` arg to `solve` and remove `data`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from optimization.jl.