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

PCE with TruncNormal input variables cannot be used for uncertainty quantification and sensitivity analysis #354

Open
luyipin123 opened this issue Aug 17, 2021 · 5 comments
Labels

Comments

@luyipin123
Copy link

When TruncNormal is selected as the distribution and fitting PCE, we perform chaospy.E(approx, distribution) or chaospy.Std(approx, distribution). Finally the errors are as follow:

Traceback (most recent call last):
File "D:\Anaconda\lib\site-packages\chaospy\distributions\baseclass\distribution.py", line 618, in mom
out = [self._get_mom(kdata) for kdata in K.T]
File "D:\Anaconda\lib\site-packages\chaospy\distributions\baseclass\distribution.py", line 618, in
out = [self._get_mom(kdata) for kdata in K.T]
File "D:\Anaconda\lib\site-packages\chaospy\distributions\baseclass\distribution.py", line 641, in _get_mom
ret_val = float(self._mom(kdata, **parameters))
File "D:\Anaconda\lib\site-packages\chaospy\distributions\operators\joint.py", line 161, in _mom
output *= self._owners[unique_idx][1]._get_mom(kloc[index == unique_idx])
File "D:\Anaconda\lib\site-packages\chaospy\distributions\baseclass\distribution.py", line 641, in _get_mom
ret_val = float(self._mom(kdata, **parameters))
File "D:\Anaconda\lib\site-packages\chaospy\distributions\baseclass\shift_scale.py", line 109, in _mom
for key, coeff in zip(poly.exponents, poly.coefficients)])
File "D:\Anaconda\lib\site-packages\chaospy\distributions\baseclass\shift_scale.py", line 109, in
for key, coeff in zip(poly.exponents, poly.coefficients)])
File "D:\Anaconda\lib\site-packages\chaospy\distributions\baseclass\distribution.py", line 641, in _get_mom
ret_val = float(self._mom(kdata, **parameters))
File "D:\Anaconda\lib\site-packages\chaospy\distributions\baseclass\simple.py", line 110, in _mom
"%s: does not support analytical raw moments." % self)
chaospy.UnsupportedFeature: trunc_normal(lower=0, upper=1, mu=0, sigma=1): does not support analytical raw moments.

During handling of the above exception, another exception occurred:

@luyipin123 luyipin123 added the bug label Aug 17, 2021
@jonathf
Copy link
Owner

jonathf commented Aug 17, 2021

Do you mind reporting stats on your run. In particular:

  • python --version
  • python -c "import chaospy as cp; print(cp.__version__)"
  • python -c "import numpoly as nu; print(nu.__version__)"
  • python -c "import numpy as np; print(np.__version__)"

@luyipin123
Copy link
Author

luyipin123 commented Aug 17, 2021 via email

@jonathf
Copy link
Owner

jonathf commented Aug 18, 2021

I am unable to replicate the issue on my local machine.

To weed out a small list of subtle problems, do you mind doing the following.
I don't use windows (which I assume you do from the error output), so I appologies in advance for any mistake in the recipy.

Anyways:

  • Make a completly new folder and copy the test_run.py script into it.
  • From your shell (cmd.exe or Powershell) move into the new folder
  • Make virtual env: python -m venv venv
  • Make sure pip works: venv/bin/python -m ensurepip --upgrade
  • Install chaospy: venv/bin/python -m pip install chaospy
  • Run script: venv/bin/python test_run.py

Let me know how it goes and if it solves the problem or not.

@luyipin123
Copy link
Author

luyipin123 commented Aug 19, 2021 via email

@jonathf
Copy link
Owner

jonathf commented Aug 19, 2021

Very weird.

Can you post the new trace stack? It shouldn't be exactly the same. The paths at least should point to a new files.

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

No branches or pull requests

2 participants