SciML / Surrogates.jl

Surrogate modeling and optimization for scientific machine learning (SciML)
https://docs.sciml.ai/Surrogates/stable/
Other
336 stars 69 forks source link

SVMSurrogate assumes input size to be (1,2) #89

Closed jibaneza closed 4 years ago

jibaneza commented 4 years ago

I get a reshape error when evaluation the generated model because the code assumes the size of the input variables to be (1,2) in line 35 of SVMSurrogate.jl


function (svmsurr::SVMSurrogate)(val)
    return LIBSVM.predict(svmsurr.model,reshape(collect(val),1,2))[1]
end
ChrisRackauckas commented 4 years ago

Yeah, that would do it. It shouldn't be hardcoding it to that. @ludoro what's the issue here? Should it really just be doing val'?

ludoro commented 4 years ago

Nice catch @jibaneza, thanks a lot. The problem with val' is that the library LIBSVM I am calling gives weird problems with adjoints, so I need to "build" the right array manually to be able to use that. That should now be fixed with #90

ChrisRackauckas commented 4 years ago

Fixed by https://github.com/JuliaDiffEq/Surrogates.jl/pull/90