Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case invals are empty when using importInVars #9

Closed
MariovdBerg opened this issue Mar 1, 2024 · 3 comments
Closed

Case invals are empty when using importInVars #9

MariovdBerg opened this issue Mar 1, 2024 · 3 comments

Comments

@MariovdBerg
Copy link

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

@scottshambaugh
Copy link
Owner

scottshambaugh commented Mar 1, 2024

Cases not being populated is definitely a bug, thanks!

For sensitivity analysis however, it operates in percentile space for the input variables, and this information is not known when loading from file since that only loads values and the input distribution is not known. See:

X = np.zeros((sim.ncases, sim.ninvars))
Y = np.zeros((sim.ncases, 1))
for i, varname in enumerate(sim.invars):
X[:, i] = sim.invars[varname].pcts
Y[:, 0] = sim.outvars[outvarname].nums
return X, Y

For today if you know your input distributions (hopefully you do!), then you could manually set sim.invars['Var1'].pcts by calculating those percentiles from the CDF of your distribution. For the future, I think there should be an option to do this automatically when loading from file, so I'll take a stab at implementing that on Sunday. Keeping this issue open for now until that's in.

@MariovdBerg
Copy link
Author

Aha, I didn't know it was operating in the percentile space. That might just solve it for me, I will test it (I do know the distributions!).

To automatically do this from file, options I'm thinking of simply have a secondary file that contains the dist and distkwargs? Or have something similar to a nummap as an optional argument to map this?

@scottshambaugh
Copy link
Owner

scottshambaugh commented Mar 4, 2024

Hi @MariovdBerg, this should be working now with v0.12.0! Cases are populated properly now.

And now when you import invars you can pass in a list of dists and distskwargs to specify those and automatically repopulate the percentiles and distribution info. Additionally, I fixed passing in nummaps when importing invars and outvars, so you should be able to handle number to value conversions better now. Let me know if you run into any more issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants