Skip to content

Commit

Permalink
comma fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
montyvesselinov committed Nov 5, 2024
1 parent 2324f54 commit fb47ad4
Show file tree
Hide file tree
Showing 39 changed files with 91 additions and 92 deletions.
4 changes: 2 additions & 2 deletions examples/anasol/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ good_params_init_max = JLD2.load(joinpath(d, "params_init_max.jld2"), "m4")
good_targetkeys = JLD2.load(joinpath(d, "targetkeys.jld2"), "tk")

Test.@testset "Anasol" begin
# Test Mads.forward(md, all=true)
# Test Mads.forward(md; all=true)
ssr = 0.
for obskey in union(Set(keys(forward_results)), Set(keys(good_forward_results)))
ssr += (forward_results[obskey] - good_forward_results[obskey])^2
Expand Down Expand Up @@ -214,7 +214,7 @@ end

md = Mads.loadmadsfile(joinpath(workdir, "w01shortexp.mads"))
md["Restart"] = true
Mads.localsa(md, filename="w01shortexp.mads", par=Mads.getparamsinit(md, Mads.getoptparamkeys(md)))
Mads.localsa(md; filename="w01shortexp.png", par=Mads.getparamsinit(md, Mads.getoptparamkeys(md)))
if !haskey(ENV, "MADS_NO_GADFLY")
Mads.graphoff()
Mads.plotlocalsa("w01shortexp")
Expand Down
Binary file added examples/anasol/w01shortexp_eigenmatrix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/anasol/w01shortexp_eigenvalues.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/anasol/w01shortexp_jacobian.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/anasol/w01shortexp_jacobian_series.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/arctic/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ Mads.showobservations(md)

forward_model = Mads.forward(md)

calib_param, calib_information = Mads.calibrate(md, tolOF=0.01, tolOFcount=4)
calib_param, calib_information = Mads.calibrate(md; tolOF=0.01, tolOFcount=4)

Mads.plotmatches(md, calib_param, xtitle="# of observations", ytitle = "GPP",filename=mads_config["mads_problemname"]*".png")
Mads.plotmatches(md, calib_param; xtitle="# of observations", ytitle = "GPP",filename=mads_config["mads_problemname"]*".png")
2 changes: 1 addition & 1 deletion examples/bayesian_sampling/bayesian_sampling_anasol.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Mads.setparamsinit!(md, opt_param)
Mads.plotmatches(md)

Mads.madsinfo("Bayesian sampling of contaminant transport problem ...")
mcmcchains = Mads.bayessampling(md, seed=2016)
mcmcchains = Mads.bayessampling(md; seed=2016)

Mads.madsinfo("Bayesian scatter plots ...")
Mads.scatterplotsamples(md, permutedims(mcmcchains.value), rootname * "-bayes-results.svg")
Expand Down
4 changes: 2 additions & 2 deletions examples/contamination/contamination-efast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ Mads.wellon!(md, "w20a") # use well w20a
if !isdefined(Mads, :efastresult)
efast_results = Mads.efast(md; N=1000, seed=2016)
end
Mads.plotobsSAresults(md, efastresult, filter=r"w13a", filename="w13a-efast.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]", separate_files=true)
Mads.plotobsSAresults(md, efastresult, filter=r"w20a", filename="w20a-efast.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]", separate_files=true)
Mads.plotobsSAresults(md, efastresult; filter=r"w13a", filename="w13a-efast.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]", separate_files=true)
Mads.plotobsSAresults(md, efastresult; filter=r"w20a", filename="w20a-efast.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]", separate_files=true)
4 changes: 2 additions & 2 deletions examples/contamination/contamination-saltelli.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ Mads.wellon!(md, "w20a") # use well w20a
if !isdefined(Mads, :saltelliresult)
saltelli_results = Mads.saltelli(md; N=10000, seed=2016)
end
Mads.plotobsSAresults(md, saltelliresult, filter=r"w13a", filename="w13a-saltelli.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]", separate_files=true)
Mads.plotobsSAresults(md, saltelliresult, filter=r"w20a", filename="w20a-saltelli.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]", separate_files=true)
Mads.plotobsSAresults(md, saltelliresult; filter=r"w13a", filename="w13a-saltelli.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]", separate_files=true)
Mads.plotobsSAresults(md, saltelliresult; filter=r"w20a", filename="w20a-saltelli.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]", separate_files=true)
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ paramarray = hcat(map(i->collect(paramdict[i]), keys(paramdict))...)
@time predictions = Mads.forward(md, paramdict)'

Mads.madsinfo("Model predictions ...")
Mads.spaghettiplot(md, predictions, keyword="w13a-model", format="PNG")
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.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.plotobsSAresults(md, sa; format="PNG")
Mads.display("$rootname-efast-385.png")

mdsvr = deepcopy(md)
Expand Down
4 changes: 2 additions & 2 deletions examples/contamination/contamination-w03-w13-svr-efast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if !isdefined(Mads, :predictions) || size(predictions) != numberofsamples
end

Mads.madsinfo("Training set spaghetti plot ...")
Mads.spaghettiplot(md, predictions, keyword="w13a-training-set", format="PNG")
Mads.spaghettiplot(md, predictions; keyword="w13a-training-set", format="PNG")
Mads.display("$rootname-w13a-training-set-$numberofsamples-spaghetti.png")

svrpredictions = Array{Float64}(undef, 0, numberofsamples)
Expand All @@ -28,5 +28,5 @@ end
@show maximum(abs.(svrpredictions .- predictions))

Mads.madsinfo("SVR predictions ...")
Mads.spaghettiplot(md, svrpredictions, keyword="w13a-svr", format="PNG")
Mads.spaghettiplot(md, svrpredictions; keyword="w13a-svr", format="PNG")
Mads.display("$rootname-w13a-svr-$numberofsamples-spaghetti.png")
8 changes: 4 additions & 4 deletions examples/contamination/contamination-w03.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Mads
md = Mads.loadmadsfile("w03.mads") # load Mads input file into Julia Dictionary
rootname = Mads.getmadsrootname(md) # get problem rootname

Mads.plotmadsproblem(md, keyword="all_wells") # display the well locations and the initial source location
Mads.plotmadsproblem(md; keyword="all_wells") # display the well locations and the initial source location
Mads.plotmatches(md) # plot initial matches

Mads.allwellsoff!(md) # turn off all wells
Expand All @@ -24,14 +24,14 @@ wd = Mads.getwelldata(md, time=true)'

# Sensitivity analysis: spaghetti plots based on prior parameter uncertainty ranges
Mads.madsinfo("Prior spaghetti plot ...")
Mads.spaghettiplot(md, predictions, keyword="w13a_w20a-prior")
Mads.spaghettiplot(md, predictions; keyword="w13a_w20a-prior")

Mads.madsinfo("Bayesian sampling ...")
mcmcchain = Mads.bayessampling(md, seed=20151001)
mcmcchain = Mads.bayessampling(md; seed=20151001)

Mads.madsinfo("Bayesian scatter plots ...")
Mads.scatterplotsamples(md, permutedims(mcmcchain.value), rootname * "-bayes.png")

posterior_predictions = Mads.forward(md, permutedims(mcmcchain.value))
Mads.madsinfo("Posterior (Bayesian) spaghetti plot ...")
Mads.spaghettiplot(md, posterior_predictions, keyword="w13a_w20a-posterior", format="PNG")
Mads.spaghettiplot(md, posterior_predictions; keyword="w13a_w20a-posterior", format="PNG")
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ 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.plotobsSAresults(md, sa; format="PNG")
Mads.display("$rootname-efast-385.png")

mdsvr = deepcopy(md)
Expand Down
4 changes: 2 additions & 2 deletions examples/contamination/contamination-w04-w13-svr-efast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if !isdefined(Mads, :predictions) || size(predictions) != numberofsamples
end

Mads.madsinfo("Training set spaghetti plot ...")
Mads.spaghettiplot(md, predictions, keyword="w13a-training-set", format="PNG")
Mads.spaghettiplot(md, predictions; keyword="w13a-training-set", format="PNG")
Mads.display("$rootname-w13a-training-set-$numberofsamples-spaghetti.png")

svrpredictions = Array{Float64}(undef, 0, numberofsamples)
Expand All @@ -28,5 +28,5 @@ end
@show maximum(abs.(svrpredictions .- predictions))

Mads.madsinfo("SVR predictions ...")
Mads.spaghettiplot(md, svrpredictions, keyword="w13a-svr", format="PNG")
Mads.spaghettiplot(md, svrpredictions; keyword="w13a-svr", format="PNG")
Mads.display("$rootname-w13a-svr-$numberofsamples-spaghetti.png")
38 changes: 19 additions & 19 deletions examples/contamination/contamination.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Mads
using Mads: Mads

currentdir = pwd()

Expand All @@ -17,18 +17,18 @@ Mads.showallparameters(md) # show all the model parameters
Mads.showparameters(md) # show all the adjustable model parameters

# use all wells
Mads.plotmadsproblem(md, keyword="all_wells") # display the well locations and the initial source location
Mads.plotmadsproblem(md; keyword = "all_wells") # display the well locations and the initial source location

forward_predictions = Mads.forward(md) # execute forward model simulation based on initial parameter guesses

Mads.plotmatches(md, forward_predictions, xtitle = "Time [a]", ytitle = "Concentration [ppb]") # plot initial matches
Mads.plotmatches(md, forward_predictions; xtitle = "Time [a]", ytitle = "Concentration [ppb]") # plot initial matches
Mads.display("w01-match.svg")

inverse_parameters, inverse_results = Mads.calibrate(md) # perform model calibration

inverse_predictions = Mads.forward(md, inverse_parameters) # execute forward model simulation based on calibrated values

Mads.plotmatches(md, inverse_predictions, xtitle = "Time [a]", ytitle = "Concentration [ppb]") # plot calibrated matches
Mads.plotmatches(md, inverse_predictions; xtitle = "Time [a]", ytitle = "Concentration [ppb]") # plot calibrated matches
Mads.display("w01-match.svg")

# use only two wells
Expand All @@ -37,28 +37,28 @@ Mads.wellon!(md, "w13a") # use well w13a
Mads.wellon!(md, "w20a") # use well w20a
Mads.showobservations(md) # show all the observations

Mads.plotmadsproblem(md, keyword="w13a_w20a") # display the well locations and the initial source location
Mads.plotmadsproblem(md; keyword = "w13a_w20a") # display the well locations and the initial source location

forward_predictions = Mads.forward(md) # execute a forward model simulation based on the initial parameter guesses

Mads.plotmatches(md, forward_predictions, filename=rootname * "-w13a_w20a-init-match.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]") # plot initial matches
Mads.plotmatches(md, forward_predictions, filename = rootname * "-w13a_w20a-init-match.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]") # plot initial matches
Mads.display("w01-w13a_w20a-init-match.svg")

inverse_parameters, inverse_results = Mads.calibrate(md) # perform model calibration

inverse_predictions = Mads.forward(md, inverse_parameters) # execute a forward model simulation based on the calibrated values

Mads.plotmatches(md, inverse_predictions, filename=rootname * "-w13a_w20a-calib-match.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]") # plot calibrated matches
Mads.plotmatches(md, inverse_predictions; filename = rootname * "-w13a_w20a-calib-match.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]") # plot calibrated matches
Mads.display("w01-w13a_w20a-calib-match.svg")

# Sensitivity analysis: spaghetti plots based on prior parameter uncertainty ranges
Mads.madsinfo("Prior spaghetti plot ...")
paramvalues = Mads.getparamrandom(md, 100)
Mads.spaghettiplot(md, paramvalues, keyword="w13a_w20a-prior", xtitle = "Time [a]", ytitle = "Concentration [ppb]")
Mads.spaghettiplot(md, paramvalues; keyword = "w13a_w20a-prior", xtitle = "Time [a]", ytitle = "Concentration [ppb]")
Mads.display("w01-w13a_w20a-prior-100-spaghetti.svg")

Mads.madsinfo("Bayesian sampling ...")
mcmcchain = Mads.bayessampling(md, seed=20151001)
mcmcchain = Mads.bayessampling(md, seed = 20151001)

Mads.madsinfo("Bayesian scatter plots ...")
Mads.scatterplotsamples(md, permutedims(mcmcchain.value), rootname * "-bayes.png")
Expand All @@ -68,7 +68,7 @@ Mads.display(rootname * "-bayes.png")
mcmcvalues = Mads.paramarray2dict(md, permutedims(mcmcchain.value))

Mads.madsinfo("Posterior (Bayesian) spaghetti plot ...")
Mads.spaghettiplot(md, mcmcvalues, keyword="w13a_w20a-posterior", format="PNG", xtitle = "Time [a]", ytitle = "Concentration [ppb]")
Mads.spaghettiplot(md, mcmcvalues, keyword = "w13a_w20a-posterior", format = "PNG", xtitle = "Time [a]", ytitle = "Concentration [ppb]")
Mads.display("w01-w13a_w20a-posterior-1000-spaghetti.png")

# Create a new problem (example)
Expand All @@ -90,27 +90,27 @@ md_new["Sources"][1]["gauss"]["dy"]["init"] = 0 # set a point source
md_new["Sources"][1]["gauss"]["dz"]["init"] = 0 # set a point source
new_forward_predictions = Mads.forward(md_new) # execute a forward model simulation
Mads.setobservationtargets!(md_new, new_forward_predictions) # set calibration targets to match the forward model predictions
Mads.plotmatches(md_new, new_forward_predictions, filename=rootname * "-new-problem.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]")
Mads.plotmatches(md_new, new_forward_predictions; filename = rootname * "-new-problem.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]")
Mads.display("w01-new-problem.svg")
Mads.dumpyamlmadsfile(md_new, "w01-new-problem.mads") # write out a new mads input file

# Calibrate with random initial guesses
Mads.allwellsoff!(md_new) # turn off all wells
Mads.wellon!(md_new, "w13a") # use well w13a
Mads.calibraterandom(md_new, 10, seed=20151001) # calibrate 10 times with random initial guesses
Mads.calibraterandom(md_new, 10; seed = 20151001) # calibrate 10 times with random initial guesses

# Global sensitivity analysis using Saltelli's method
saltelli_results = Mads.saltelli(md; N=1000, seed=2016)
Mads.plotobsSAresults(md, saltelliresult, filter=r"w13a", filename="w13a-saltelli.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]")
saltelli_results = Mads.saltelli(md; N = 1000, seed = 2016)
Mads.plotobsSAresults(md, saltelliresult; filter = r"w13a", filename = "w13a-saltelli.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]")
Mads.display("w13a-saltelli.svg")
Mads.plotobsSAresults(md, saltelliresult, filter=r"w20a", filename="w20a-saltelli.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]")
Mads.plotobsSAresults(md, saltelliresult; filter = r"w20a", filename = "w20a-saltelli.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]")
Mads.display("w20a-saltelli.svg")

# Global sensitivity analysis using Saltelli's eFAST method
efast_results = Mads.efast(md; N=1000, seed=2016)
Mads.plotobsSAresults(md, efastresult, filter=r"w13a", filename="w13a-efast.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]")
efast_results = Mads.efast(md; N = 1000, seed = 2016)
Mads.plotobsSAresults(md, efastresult, filter = r"w13a", filename = "w13a-efast.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]")
Mads.display("w13a-efast.svg")
Mads.plotobsSAresults(md, efastresult, filter=r"w20a", filename="w20a-efast.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]")
Mads.plotobsSAresults(md, efastresult; filter = r"w20a", filename = "w20a-efast.svg", xtitle = "Time [a]", ytitle = "Concentration [ppb]")
Mads.display("w20a-efast.svg")

cd(currentdir)
cd(currentdir)
6 changes: 3 additions & 3 deletions examples/contamination/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ if !haskey(ENV, "MADS_NO_GADFLY")
Mads.plotmatches(md, inverse_predictions; display=false) # plot calibrated matches
Mads.rmfile(joinpath(workdir, "w01-w13a_w20a-match.svg"))

Mads.spaghettiplots(md, paramvalues, keyword="w13a_w20a")
Mads.spaghettiplot(md, paramvalues, keyword="w13a_w20a")
Mads.spaghettiplots(md, paramvalues; keyword="w13a_w20a")
Mads.spaghettiplot(md, paramvalues; keyword="w13a_w20a")
s = splitdir(rootname)
for filesinadir in Mads.searchdir(Regex(string(s[2], "-w13a_w20a", "[.]*", "spaghetti.svg")), path=s[1])
Mads.rmfile(filesinadir, path=s[1])
Expand All @@ -89,7 +89,7 @@ if !haskey(ENV, "MADS_NO_GADFLY")
sa_results = Mads.saltelli(md; N=5, seed=2015)
Mads.plotwellSAresults(md, sa_results)
Mads.plotobsSAresults(md, sa_results)
Mads.plotobsSAresults(md, sa_results, separate_files=true)
Mads.plotobsSAresults(md, sa_results; separate_files=true)
Mads.rmfile(joinpath(workdir, "w01-w13a_w20a-saltelli-5-main_effect.svg"))
Mads.rmfile(joinpath(workdir, "w01-w13a_w20a-saltelli-5-total_effect.svg"))
Mads.rmfile(joinpath(workdir, "w01-w13a_w20a-saltelli-5-variance.svg"))
Expand Down
2 changes: 1 addition & 1 deletion examples/contamination/w01short.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ numberofsamples = 10
paramvalues=Mads.getparamrandom(md, numberofsamples)
Mads.allwellsoff!(md)
Mads.wellon!(md, "w1a")
Mads.spaghettiplots(md, paramvalues, keyword="w1a")
Mads.spaghettiplots(md, paramvalues; keyword="w1a")

# solve the inverse problem
result = Mads.calibrate(md; show_trace=true)
Expand Down
2 changes: 1 addition & 1 deletion examples/external_execution/exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import Mads
Mads.madsinfo("TEST Saltelli sensitivity analysis:")
md = Mads.loadmadsfile("exec.mads")
results = Mads.saltelli(md; N=100)
results = Mads.saltelliparallel(md, N=50, 2)
results = Mads.saltelliparallel(md, 2; N=50)
Mads.printSAresults(md, results)
4 changes: 2 additions & 2 deletions examples/model_analysis/emcee.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Mads.mkdir("emcee_results")

Mads.setobsweights!(md, 10)
chain, llhoods = Mads.emceesampling(md; numwalkers=100, nsteps=1000000, burnin=100000, thinning=100, seed=2016, sigma=0.01)
Mads.scatterplotsamples(md, chain', joinpath("emcee_results", "emcee_scatter.png"))
Mads.scatterplotsamples(md, chain'; joinpath("emcee_results", "emcee_scatter.png"))
o = Mads.forward(md, chain')
Mads.spaghettiplot(md, o, filename=joinpath("emcee_results", "emcee_spaghetti.png"))
Mads.spaghettiplot(md, o; filename=joinpath("emcee_results", "emcee_spaghetti.png"))
6 changes: 3 additions & 3 deletions examples/model_analysis/sensitivity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Mads.mkdir("sensitivity_results")

n = 100
@info("Calibration using $n random initial guesses for model parameters")
calib_random_results = Mads.calibraterandom(md, n, all=true, seed=2016, save_results=false)
calib_random_results = Mads.calibraterandom(md, n; all=true, seed=2016, save_results=false)
pnames = collect(keys(r[1,3]))
calib_random_estimates = hcat(map(i->collect(values(calib_random_results[i,3])), 1:n)...)
np = length(pnames)
Expand All @@ -30,10 +30,10 @@ end
@info("Local sensitivity analysis for the 3 different global optima")
for i = 1:3
Mads.setparamsinit!(md, r[v[i],3])
Mads.localsa(md, filename="sensitivity_results/sensitivity_local_$(optnames[i]).png", datafiles=false)
Mads.localsa(md; filename="sensitivity_results/sensitivity_local_$(optnames[i]).png", datafiles=false)
end
Mads.setparamsinit!(md, pinit)

@info("Global sensitivity analysis")
efast_results = Mads.efast(md; N=1000, seed=2016)
Mads.plotobsSAresults(md, efastresult, filename="sensitivity_results/sensitivity_global.png", xtitle = "x", ytitle = "y")
Mads.plotobsSAresults(md, efastresult; filename="sensitivity_results/sensitivity_global.png", xtitle = "x", ytitle = "y")
4 changes: 2 additions & 2 deletions examples/model_analysis/svr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ 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.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.spaghettiplot(md, svrpredictions; keyword="w13a-svr", format="PNG")
Mads.display("$rootname-w13a-svr-$numberofsamples-spaghetti.png")

sa = Mads.efast(md)
Expand Down
6 changes: 3 additions & 3 deletions examples/model_analysis/uncertainty.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ display(s_var)
# JLD2.save("uncertainty_results/variance-important-sampling.jld2", "goodoprime", goodoprime)

@info("Spaghetti plot of posterior predictions")
Mads.spaghettiplot(md, o, filename="uncertainty_results/spaghetti-$(problem).png")
Mads.spaghettiplot(md, o; filename="uncertainty_results/spaghetti-$(problem).png")

@info("Spaghetti plot of posterior predictions using importance sampling")
Mads.spaghettiplot(md, goodoprime', filename="uncertainty_results/spaghetti-$(problem)-importance-sampling.png")
Mads.spaghettiplot(md, goodoprime'; filename="uncertainty_results/spaghetti-$(problem)-importance-sampling.png")
Mads.display("uncertainty_results/spaghetti-$(problem)-importance-sampling.png")

@info("Histogram of `o5` predictions")
Expand All @@ -68,7 +68,7 @@ Gadfly.draw(Gadfly.PNG("uncertainty_results/histogram-$(problem)-importance-samp
Mads.setparamsinit!(md, p)
mcmcchain = Mads.bayessampling(md; nsteps=10000, burnin=1000, thinning=1, seed=2016)
ob = Mads.forward(md, mcmcchain.value)
Mads.spaghettiplot(md, ob, filename="uncertainty_results/spaghetti-$(problem)-bayes.png")
Mads.spaghettiplot(md, ob; filename="uncertainty_results/spaghetti-$(problem)-bayes.png")
Mads.display("uncertainty_results/spaghetti-$(problem)-bayes.png")

@info("Histogram of `o5` predictions using Bayesian analysis")
Expand Down
Loading

0 comments on commit fb47ad4

Please sign in to comment.