-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/madsjulia/Mads.jl
- Loading branch information
Showing
2 changed files
with
6 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") | ||
runtests.jl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters