scottshambaugh / monaco Goto Github PK
View Code? Open in Web Editor NEWQuantify uncertainty and sensitivities in your computer models with an industry-grade Monte Carlo library.
License: MIT License
Quantify uncertainty and sensitivities in your computer models with an industry-grade Monte Carlo library.
License: MIT License
When I try plotting the sensitivities after a run, it throws an error 'fig.set_layout_engine('tight') does not exist. I do not have the same problem with e.g. plot_cov_corr().
Hi Scott,
Thank you for your work ! I find the library very handy to use and result oriented.
I face an issue when a sample case simulation fails. Even if one case fails, the simulation crashes. The failure happens in the genOutVars function from the Sim class. When it tries to add the OutVar value of the failed case to the outvals list, it finds no key or value to add since this case failed.
Is there a way to just ignore the failing case and output all the other ones ?
I can't identify if the failure comes from monaco or from my model. I tried to narrow the distribution range of the input variables of my model but nothing changed.
Thank you for your answer,
Matt
Hello there,
I tried to run the simulator to check if this package is working or not, but I encountered an error like in the title when I tried to run the mc.Sim(...) in template file. When I omitted the singlethreaded argument, the error is gone and the program could run. I already checked init and mc_sim file, but I couldn't find anything wrong in there. I hope you can find and fix the problem. Thank you.
Hi,
I'm trying to run an analysis on a set of input and output data (.csv-files). I'm probably overlooking something, but when I try to do a multi_plot the InVar somehow have no distribution. When checking the cases, I found that they had no InVars and only OutVars.
How do I properly load InVars if I don't want to run an actual simulation? I'm working in Jupyter Notebook, see snippet below.
I've attached the csv files I use:
test_invars.csv
test_outvars.csv
import monaco as mc
def template_preprocess(case):
# This is where I think I'm doing something wrong
variables = {
'In1' : case.invals['Var1'].val,
'In2' : case.invals['Var2'].val,
'In3' : case.invals['Var3'].val,
'In4' : case.invals['Var4'].val,
'In5' : case.invals['Var5'].val,
'In6' : case.invals['Var6'].val,
'In7' : case.invals['Var7'].val,
'In8' : case.invals['Var8'].val,
'In9' : case.invals['Var9'].val,
'In10' : case.invals['Var10'].val,
'In11' : case.invals['Var11'].val,
'In12' : case.invals['Var12'].val,
'In13' : case.invals['Var13'].val,
'In14' : case.invals['Var14'].val,
'In15' : case.invals['Var15'].val,
'In16' : case.invals['Var16'].val,
'In17' : case.invals['Var17'].val,
'In18' : case.invals['Var18'].val,
'In19' : case.invals['Var19'].val,
'In20' : case.invals['Var20'].val,
'In21' : case.invals['Var21'].val,
'In22' : case.invals['Var22'].val,
'In23' : case.invals['Var23'].val,
'In24' : case.invals['Var24'].val
}
return variables
def template_run(variables):
# We do nothing with the input so we just return the variables
return variables
def template_postprocess(case, variables):
# Don't actually have any output so simply add OutVals only
case.addOutVal(name='Out1', val=case.outvals['Out1'].val)
case.addOutVal(name='Out2', val=case.outvals['Out2'].val)
case.addOutVal(name='Out3', val=case.outvals['Out3'].val)
fcns = {'preprocess' : template_preprocess,
'run' : template_run,
'postprocess': template_postprocess}
ndraws = 128
sim = mc.Sim(name='Test', ndraws=ndraws, fcns=fcns,
firstcaseismedian=False,
singlethreaded=True,
savecasedata=False, savesimdata=False,
verbose=True, debug=False)
sim.importInVars("test_invars.csv")
sim.importOutVars("test_outvars.csv")
plot_invar = sim.invars['Var18']
plot_outvar = sim.outvars['Out1']
fig, axs = mc.multi_plot([plot_invar, plot_outvar], rug_plot=True, cov_plot=True)
The plot I get is below. The invars exist because they can be plotted.
I've encountered underflow errors in dvars.sensitivity.py
, line 273 (np.linalg.det(R)
). This error is most likely more related to my model than the library, but switching to scipy.linalg.det(R) solved this in my case (25 inputvars, 1 main outputvar).
From scipy.linalg.det documentation:
Even the input array is single precision (float32 or complex64), the result will be returned in double precision (float64 or complex128) to prevent overflows.
Possible solution is to set these cells to 0 if encountered, but this may introduce singular matrices.
Hi Scott,
As a follow up on Issue #8, the imported InVars are not added to the cases. Running any sensitivity analysis results in nothing.
Kind regards,
Mario
I'm trying to down-scope the total variables I plot in mc_sim.plot(), because I have a lot of inputs that make the plot un-usable. When adding the value scalarvars to provide this list no change in output occurs. Reading the source code it appears that scalarvars is not actually used. There is an if statement that checks for if None, but the output of that function does not go into the multi_plot function. In multi_plot call of mc_sim.plot it specifies x_vals are pulled from self.list and ignore any potential input from scalarvars.
I would also recommend in fix that scalarvars be a two parts list [[plot_invars], [plot_outvars]]. THus allowing user to downselect either category independently.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.