-
Notifications
You must be signed in to change notification settings - Fork 87
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
Error in moments with more than 10 variables #397
Comments
So this seems to be a bug in import numpoly
q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20 = numpoly.variable(21)
poly1 = numpoly.polynomial([q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20])
x1 = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0]
print(numpoly.call(poly1, x1)) gives the following for the so the variables are sorted by the first digit of the number of the name; which is therefore the reason for the bug once one has more than 10 variables in the PCE. Numpoly version is 1.2.3. Found this relevant pull-request: jonathf/numpoly#89 |
That is a good catch. Thanks for looking into the matter. Yeah, #89 addresses the issue. Unfortunatly I completely forgot about the PR and it has grown a bit stale. |
Thanks @jonathf for the fast response! Yes, everything works as expected now. |
Glad to hear. Closing. |
I'm running sensitivity analysis studies and recently switched to a larger number of variables, namely 11. Started getting extremely weird results (such as mean value being outside the min/max range of my model evaluations). Managed to pinpoint this down to my use of Uniform distributions on an interval other than [0,1]. This is also dependent on where the differently distributed variable is placed.
I've attached a minimal code below that reproduces this error: it uses a dummy model that always outputs a constant value, so the mean should be the same. The number of variables is changed from 2 to 12, all of them are taken to be Uniform on the interval [0,1] and a single variable is replaced by a variable that's distributed uniformly on [-1,1].
The code loops over the number of variables and the position of this differently distributed variable and outputs the position and number of variables if the computed mean is not in agreement with the constant function output. Error occurs both for sparse and non-sparse grids.
I did some testing, and as far as the generated expansions, weights, and model evaluation points go, everything seems OK to me. Seems like something goes awry in the quadrature fitting process. Any suggestions on how to fix this (or whether I'm doing something wrong) most welcome!
Code to reproduce the error:
The output I get is:
The text was updated successfully, but these errors were encountered: