Skip to content
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

Docs for NeuralSurrogate #305

Open
jdossgollin opened this issue Nov 11, 2021 · 1 comment
Open

Docs for NeuralSurrogate #305

jdossgollin opened this issue Nov 11, 2021 · 1 comment

Comments

@jdossgollin
Copy link

Three issues with the NeuralSurrogate docs

First, loading the recommended packages yields a warning

julia> using Plots

julia> using Surrogates

julia> using Flux
┌ Warning: Package Surrogates does not have Flux in its dependencies:
│ - If you have Surrogates checked out for development and have
│   added Flux as a dependency but haven't updated your primary
│   environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with Surrogates
└ Loading Flux into Surrogates from project dependency, future warnings for Surrogates are suppressed.

This seems OK but it would be helpful to have a heads up for users.

Next, an error.
Following along, there is no lb or ub:

julia> neural = NeuralSurrogate(x, y, lb, ub, model = model1, n_echos = 10)
ERROR: UndefVarError: lb not defined
Stacktrace:
 [1] top-level scope

Next if I make up some numbers, there is a typo

lb, ub = -10, 10
surrogate_optimize(schaffer, SRBF(), lower_bound, upper_bound, neura, SobolSample(), maxiters=20, num_new_samples=10)
ERROR: UndefVarError: neura not defined
Stacktrace:
 [1] top-level scope

but even if I fix the typo I get an issue

neural = NeuralSurrogate(x, y, lb, ub, model = model1, n_echos = 10)
surrogate_optimize(schaffer, SRBF(), lower_bound, upper_bound, neural, SobolSample(), maxiters=20, num_new_samples=10)
ERROR: InexactError: Int64(3.8564731213645262)
Stacktrace:
 [1] Int64
   @ ./float.jl:723 [inlined]
 [2] convert
   @ ./number.jl:7 [inlined]
 [3] setindex!(A::Vector{Int64}, x::Float64, i1::Int64)
   @ Base ./array.jl:839
 [4] surrogate_optimize(obj::typeof(schaffer), ::SRBF, lb::Vector{Float64}, ub::Vector{Float64}, surr::NeuralSurrogate{UnitRange{Int64}, UnitRange{Int64}, Chain{Tuple{Dense{typeof(σ), Matrix{Float32}, Vector{Float32}}, Dense{typeof(σ), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Surrogates.var"#237#241"{Chain{Tuple{Dense{typeof(σ), Matrix{Float32}, Vector{Float32}}, Dense{typeof(σ), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}}, Descent, Zygote.Params, Int64, Int64, Int64}, sample_type::SobolSample; maxiters::Int64, num_new_samples::Int64)
   @ Surrogates ~/.julia/packages/Surrogates/lWGHe/src/Optimization.jl:117
 [5] top-level scope
@ChrisRackauckas
Copy link
Member

Interesting, the test seems to be fine though? https://github.com/SciML/Surrogates.jl/blob/master/test/neuralSurrogate.jl

vikram-s-narayan referenced this issue in vikram-s-narayan/Surrogates.jl Jan 23, 2022
ChrisRackauckas added a commit that referenced this issue Jan 23, 2022
Fixes Issue - Docs for NeuralSurrogate #305
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants