STOR-i / GaussianProcesses.jl

A Julia package for Gaussian Processes
https://stor-i.github.io/GaussianProcesses.jl/latest/
Other
308 stars 53 forks source link

optimize! MethodError #217

Closed Jordi- closed 2 years ago

Jordi- commented 2 years ago

Hello. I'm using GaussianProcess v0.12.4 and Optim v1.6.2.

I've a SoR GP defined as: GP_SoR = GaussianProcesses.SoR(Xtr, Xu, ytr, MeanConst(mean(ytr)), kernel, log(sy)) When I try to optimize the hyperparameters like this GaussianProcesses.optimize!(GP_SoR; method=ConjugateGradient()) or using , instead of ; GaussianProcesses.optimize!(GP_SoR, method=ConjugateGradient()) both forms raise the same error:

MethodError: no method matching optimize(::OnceDifferentiable{Float64, Vector{Float64}, Vector{Float64}}, ::Vector{Float64}, ::LBFGS{Nothing, LineSearches.InitialStatic{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}, Optim.var"#19#21"}, ::Optim.Options{Float64, Nothing}; method=ConjugateGradient{Float64, Nothing, Optim.var"#30#32", LineSearches.InitialHagerZhang{Float64}, LineSearches.HagerZhang{Float64, Base.RefValue{Bool}}}(0.4, nothing, Optim.var"#30#32"(), LineSearches.InitialHagerZhang{Float64} ... Closest candidates are: optimize(::D, ::Tx, ::M, ::Optim.Options{T, TCallback}) where {D<:NLSolversBase.AbstractObjective, M<:Optim.AbstractOptimizer, Tx<:AbstractArray, T, TCallback} at ~/.julia/packages/Optim/wFOeG/src/multivariate/optimize/optimize.jl:32 got unsupported keyword argument "method" optimize(::D, ::Tx, ::M, ::Optim.Options{T, TCallback}, ::Any) where {D<:NLSolversBase.AbstractObjective, M<:Optim.AbstractOptimizer, Tx<:AbstractArray, T, TCallback} at ~/.julia/packages/Optim/wFOeG/src/multivariate/optimize/optimize.jl:32 got unsupported keyword argument "method" optimize(::Any, ::AbstractArray, ::Optim.AbstractOptimizer, ::Optim.Options; inplace, autodiff) at ~/.julia/packages/Optim/wFOeG/src/multivariate/optimize/interface.jl:138 got unsupported keyword argument "method"

Seems it does not like the 'method=' argument. In fact it works if I don't try to specify the method, that is GaussianProcesses.optimize!(GP_SoR) but in my case it didn't converge, so I wanted to try another methods.

Any ideas?

Jordi- commented 2 years ago

Sorry for that, all my fault. The solution is just to use it right as GaussianProcesses.optimize!(GP_SoR, ConjugateGradient()) Closing the issue. Apologies.