SciML / Optimization.jl

Mathematical Optimization in Julia. Local, global, gradient-based and derivative-free. Linear, Quadratic, Convex, Mixed-Integer, and Nonlinear Optimization in one simple, fast, and differentiable interface.
https://docs.sciml.ai/Optimization/stable/
MIT License
720 stars 79 forks source link

Add visualization tooling / plot recipes #80

Open dangirsh opened 3 years ago

dangirsh commented 3 years ago

FluxOptTools allows visualizing loss when using Optim.jl. There's also some integration between Optim and TensorBoardLogger. Neither of these integrations can be directly used when using GalacticOptim in place of Optim. It seems like a first step would be add similar integrations / recipes for GalacticOptim.

As a first pass, I got TensorBoardLogger to plot loss with the following callback:

function make_tb_cb(name="")
    logger = TBLogger(logdir, tb_overwrite)
    function callback(p, l)
        with_logger(logger) do
            @info "$(name)" loss=l
        end
        return false
    end
    return callback
end

maxiters=100
GalacticOptim.solve(prob, Optim.BFGS(); cb=make_tb_cb("BFGS-$(maxiters)"), maxiters=maxiters)
dangirsh commented 3 years ago

Related: