Uncertainty in consequence models - joramh, April 14, 2022 #297
Replies: 8 comments
-
Hi Andrés, Thanks for reaching out; I appreciate your feedback and questions on the new version of Pelicun!
Adam
|
Beta Was this translation helpful? Give feedback.
-
Hey Adam, Thanks a lot for getting back to me. I've updated now to the 3.1b4 version. Best,
|
Beta Was this translation helpful? Give feedback.
-
Hey Adam, Apologies if you're super busy, but do you think you could give me more information about this please?
|
Beta Was this translation helpful? Give feedback.
-
Hi Andres, I'm sorry for the delay. I'll get back to you with a detailed description tomorrow. Adam
|
Beta Was this translation helpful? Give feedback.
-
Thanks Adam. I really appreciate your help!
|
Beta Was this translation helpful? Give feedback.
-
Hi Andres, Apologies for the late response. I decided to make a few enhancements in Pelicun to streamline the process of adding a new distribution type. I've just released v3.1.b6 and also updated the Example notebook on DesignSafe with a lot of additional details and explanation on how Pelicun 3 works. I encourage you to take a look here: https://www.designsafe-ci.org/data/browser/public/designsafe.storage.published/PRJ-3411v5 Read on if you are still interested in adding the skew normal distribution. First, you'll need to have the source code available locally. I also recommend linking this version of pelicun to your active Python on the local system to make testing easier. I am not sure how familiar you are with the steps to do this, so let me give you a few tips - please don't hesitate to ask me if you need more information:
That's it, that's how you can extend pelicun and share your work with the community. Now, let's see how you would go about adding a new distribution. You'll only need to make changes in the uq module to do this. See the latest version of the script here for reference: https://github.com/NHERI-SimCenter/pelicun/blob/develop/pelicun/uq.py . Note that if the uq module gets updated by the time you are reading this, you can always click on history in the top right and go back to today's version so that the line numbers I give below will point to the right location. Sampling an N dimensional multivariate distribution in Pelicun follows the logic below (see generate_sample method starting at line 1465):
Adding a new distribution only affects the last step of the above (as long as you don't want to have some special, non-Gaussian copula function also included - let me know if you do). Below is a list of locations where you'd need to make edits:
That's it. At this point you have the skew normal distribution implemented and you can sample it by creating a RandomVariable object, adding it to a RandomVariableRegistry and then calling the generate_sample() method of that registry. This is done all over the model module: https://github.com/NHERI-SimCenter/pelicun/blob/develop/pelicun/model.py For example, take a look at the generate_cmp_sample() method starting at line 1165. The _create_cmp_RVs() creates the RandomVariable objects and the registry (line 1139) and then at line 1180 we sample the registry. Notice that RandomVariable objects are created by feeding the family and parameters of the distribution to the uq module automatically. Using the previous cmp example, take a look at line 1150 in the model module. As long as you feed in the correct name for the family and valid parameters, your new distribution should work immediately without making any changes to the model.py . The only exception to this is the LossModel - currently, only normal and lognormal random variables are supported for probabilistic loss calculation. Let me know if you want to include the skewed normal there and I can help you set that up. I hope you'll find the above helpful. Please let me know if you're working on this and don't hesitate to ask questions here if you run into any issues.
|
Beta Was this translation helpful? Give feedback.
-
Hello Adam, Apologies for the late response. Thanks a lot for taking the time to answer my question, this is definitely going to help me a lot.
|
Beta Was this translation helpful? Give feedback.
-
Hi Andrés, Sounds good! Don't hesitate to reach out if you have any questions or run into issues. Adam
|
Beta Was this translation helpful? Give feedback.
-
Hello Adam,
Thanks a lot for the new updates and versions of Pelicun (specially the tutorial), it has been really helpful. I’ve been working on the tutorial you posted on youtube for a while now and I have a couple of questions regarding the definition of uncertainties.
1.- How can I specify uncertainty in the consequence models? I tried doing this by specifying a family and a Theta 1 value in the collapse/replacement consequences (additional_consequences dataframe in the tutorial), but when I do this, I notice that I still get a deterministic value for all the collapse/replacement realizations. In addition, some of the default FEMA P-58 components have already uncertainty defined and when the analysis is run, all the consequences (replacement costs) are still deterministic. Do you have any recommendations? I’m probably missing something here...
2.- It is mentioned in the tutorial that Pelicun supports many distributions. Does it support skew normal distribution as well? If so, how can I define it? My initial thought was to have Theta_0, Theta_1 and Theta_2 that represents shape, loc and scale of my distribution but I don’t know if this is possible.
Any help will be greatly appreciated! Thanks a lot!
Best,
Andrés Ramos.
Beta Was this translation helpful? Give feedback.
All reactions