diff --git a/examples/svr/svr.jl b/examples/svr/svr.jl index 32332837..5aaa0573 120000 --- a/examples/svr/svr.jl +++ b/examples/svr/svr.jl @@ -1,44 +1 @@ -import Mads - -@info("Support Vector Regression (SVR) analysis") - -Random.seed!(2017) - -md = Mads.loadmadsfile(joinpath("..", "models", "internal-polynomial-model", "internal-polynomial.mads")) -rootname = Mads.getmadsrootname(md) -svrexec, svrread, svrsave, svrclean = Mads.makesvrmodel(md, 100) - -numberofsamples = 100 -paramdict = Mads.getparamrandom(md, numberofsamples) -paramarray = hcat(map(i->collect(paramdict[i]), keys(paramdict))...) -predictions = Mads.forward(md, paramdict)' - -Mads.madsinfo("Model predictions ...") -Mads.spaghettiplot(md, predictions, keyword="w13a-model", format="PNG") -Mads.display("$rootname-w13a-model-$numberofsamples-spaghetti.png") - -@time svrpredictions = svrexec(paramarray) -@info("SVR discrepancy $(maximum(abs.(svrpredictions .- predictions)))") - -Mads.madsinfo("SVR predictions ...") -Mads.spaghettiplot(md, svrpredictions, keyword="w13a-svr", format="PNG") -Mads.display("$rootname-w13a-svr-$numberofsamples-spaghetti.png") - -sa = Mads.efast(md) -Mads.plotobsSAresults(md, sa, format="PNG") -Mads.display("$rootname-efast-385.png") - -mdsvr = deepcopy(md) -mdsvr["Julia model"] = svrexec -mdsvr["Filename"] = "$rootname-svr.mads" - -sasvr = Mads.efast(mdsvr) -Mads.plotobsSAresults(mdsvr, sasvr, format="PNG") -Mads.display("$rootname-svr-efast-385.png") - -svrsave() -svrclean() -svrread() -svrclean() - -Mads.rmdir("svrmodels") \ No newline at end of file +runtests.jl \ No newline at end of file diff --git a/src/Mads.jl b/src/Mads.jl index 1fea201c..afeae819 100644 --- a/src/Mads.jl +++ b/src/Mads.jl @@ -31,11 +31,13 @@ import Ipopt function julia_main()::Cint if length(ARGS) > 0 filename = ARGS[1] + @info("Loading information from $(filename) ...") + md = Mads.loadmadsfile(filename) + @info("Executing calibration ...") + Mads.calibrate(md) else - @warn "Arguments should be provided on the command line!" + @warn("Arguments should be provided on the command line!") end - md = Mads.loadmadsfile(filename) - Mads.calibrate(md) return 0 end