## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
Paulinakindermann
@Paulinakindermann

Hi,

Another question. I am trying to create the event whose probability I want to estimate, using ot.CompositeRandomVector(model,vector). I saw some examples using ot.SymbolicFunction for the model. However, my function is quite elaborate and also contains some variables without distributions, so I am looking for an easier way to define the model. I am trying to achieve this by defining the model as a regular python function:

def Z_GEKB(Hm0,h,Tmm10,crest_height,alpha): Rc = crest_height - h #freeboard br = math.tan(alpha) / math.sqrt( (Hm0*2*np.pi) / (g*(Tmm10)**2) ) q = math.sqrt(g * (Hm0)**3) * ( (0.023/math.sqrt(math.tan(alpha))) * br * math.exp(-(2.7 * (Rc / (br*Hm0)))**(1.3)) ) return math.log10(m_c * q_c) - math.log10(m_a * q)

vect = ot.RandomVector(jointdist) out = ot.CompositeRandomVector(Z_GEKB,vect)

But then I get the error as sent above.

6 replies
christelle-git
@christelle-git
Hi everyone,
is it possible to get the confidence level with the FunctionalChaosSobolIndices method ?
5 replies
josephmure
@josephmure

OpenTURNS now has a forum!

This forum will allow us to discuss OpenTURNS in a more structured way, with threads dedicated to specific use cases, methods, or issues. More importantly, it will allow us to preserve discussions that would be lost on Gitter.

As a bonus feature, the forum supports LaTeX. This should make mathematical discussions easier.

Julien Schueller
@jschueller
christelle-git
@christelle-git
Hi, I've tried the box_behnken function to build a DOE and I notice that the output is formatted as float32, whereas with lhs method it is formatted as float64. As a consequence, when I try to dump it in json format I have an error that I tackle by converting box_behnken output with np.float64.
Is there a reason why this output method is in float32 instead of float64 ? Thanks
3 replies
naybnet
@Naybnet

Hello all ! Wonderful to see that openturns has a chat !

I am using the python module as a dependency of my analysis tool and I noticed migrating from version 1.12 to 1.15 that now Openturns requires X11-related dependencies (libX11, libSM in particular). As I want to package my tool using docker and do not need GUI related functionalities is there a way to use this library without those requirements ?

5 replies
fdeheeger
@fdeheeger

@jschueller
Hello Sir, do you have a snippets somewhere to define quickly a ComposedDistribution...
I keep falling back to me wanting to define it this way:

domain = ot.ComposedDistribution({'R1': ot.Uniform(0.001,0.050),
'R2': ot.Uniform(0.001, 0.060),
'C10': ot.Uniform(0.02, 0.50)},
)

Any advice to quickly define names ?

Cédric Durantin
@cdurantin
Hello,
I observed differences between openturns KrigingAlgorithm and DiceKriging (R) for trend coefficient estimation when covariance model is fixed. Is there any way to set the trend coefficient in the KrigingAlgorithm class ? I could then complete my comparison between the two softwares.
Those coefficients are called beta in your documentation (https://openturns.github.io/openturns/latest/theory/meta_modeling/kriging.html#kriging). Once the regression basis is selected and the covariance model set, I should not observe differences with DiceKriging.
3 replies
Merlin Keller
Hi to all! Is there an openturns module or class that supports functional outlier detection?
4 replies
Aurore Dupre
@aur_dup_gitlab
Hi all,
I have a problem using KrigingAlgorithm trying to reproduce the following example: https://openturns.github.io/openturns/master/auto_meta_modeling/kriging_metamodel/plot_kriging.html
I have an input design (x1 ~ N(0,1) and x2 ~ N(0,1)) and an output design (cos(x1 + x2)), I build the meta model using algo = ot.KrigingAlgorithm(inputDesign, outputDesign, covarianceModel, basis) where covarianceModel and basis are the same than in the example.
However when I try to retrieve the marginals using : algo.BuildDistribution(inputDesign) I have the following error: AttributeError: type object 'object' has no attribute 'getattr'
Note that it works if I use the FunctionalChaosAlgorithm.
8 replies
ChahrazedAmr
@ChahrazedAmr
Hello everyone, i am trying to reproduce this example https://openturns.github.io/openturns/latest/auto_reliability_sensitivity/design_of_experiments/plot_design_of_experiments.html?highlight=lhs but i am having this error "PlotDesign() missing 2 required positional arguments: 'Nx' and 'Ny'". Any help with that? Thanks
4 replies
Hello. I'm trying to find the algorithm for computing rectangular probabilities in multivariate discrete distributions presented in: Lebrun. “Efficient Time/Space Algorithm to Compute Rectangular Probabilities of Multinomial, Multivariate Hypergeometric and Multivariate Pólya Distributions.” Stat. Comput. 23, no. 5 (2013): 615–23. https://doi.org/10.1007/s11222-012-9334-8.
3 replies
mohamed-808
@mohamed-808
please how can i couple between plaxis and openturns ?
4 replies
Ludovico
@cottoncini
Hi everyone!
I'm trying to build a GaussProductExperiment with a composed distribution in which at least one of the marginals has size n=2, but the values for the corresponding components in the generated points are always +-nan. Is this expected behaviour?
Please find a sample script below, with two different marginals of size 2 and a third one, of size 3, which gives the expected components; I'm using version 1.16. Thank you in advance.
import openturns as ot
d1 = ot.UserDefined(ot.Sample([[10], [20]]))
d2 = ot.Bernoulli()
d3 = ot.UserDefined(ot.Sample([[10], [100], [1000]]))
dc = ot.ComposedDistribution([d1, d2, d3])
print(ot.GaussProductExperiment(dc, [2, 2, 3]).generate())
     [ X0   X1   X2   ]
0 : [  nan  nan   10 ]
1 : [ -nan  nan   10 ]
2 : [  nan -nan   10 ]
3 : [ -nan -nan   10 ]
4 : [  nan  nan  100 ]
5 : [ -nan  nan  100 ]
6 : [  nan -nan  100 ]
7 : [ -nan -nan  100 ]
8 : [  nan  nan 1000 ]
9 : [ -nan  nan 1000 ]
10 : [  nan -nan 1000 ]
11 : [ -nan -nan 1000 ]
8 replies
mohamed-808
@mohamed-808
please i want to perform a Reliability analysis using "form", but i want to use a data from another program "plaxis" instead of usecases from openturns library
2 replies
Michael Baudin
@mbaudin47

Hi!
How to set the figure size with Viewer's options? I used the example from the doc, but the figure_kwargsoption has not effect:

import openturns as ot
import openturns.viewer as otv
n = ot.Normal()
graph = n.drawPDF()
view = otv.View(graph, figure_kwargs = {"figsize": (400, 400)})

This should create a gigantic figure. The option seems to be ignored.

4 replies
JPelamatti
@JPelamatti
Hello. Quick question, I have noticed that the getVariance() and getStandardDeviation() methods for a ot.Sample object return respectively an ot.Point and a 1x1 ot.TriangularMatrix, whereas according to the documentation both methods are (logically) supposed to return a point. Is that normal? Example below:
2 replies
Michael Baudin
@mbaudin47

Hello ! Here is a script which creates a covariance matrix:

import openturns as ot
m = ot.SymmetricMatrix(3)
m[0, 0] = 1.0e-02
m[1, 1] = 1.0e-02
m[2, 2] = 1.0e-02
m[0, 1] = 7.0e-04
ot.CovarianceMatrix(m)

but generates: TypeError: InvalidArgumentException : The matrix is not symmetric, which cannot be true. More curious, the bug disappears when I insert print(m) just before the creation of the covariance matrix.
This sounds like a memory leak, isn'it ?

4 replies
Kieran Delamotte
@KieranDelamotte
@mbaudin47
I think there might be a missing checkSymmetry() somewhere instead. The print you add after your definition must trigger it and then the m matrix is correct for the CovarianceMatrix ctor.
Michael Baudin
@mbaudin47
Thank you Kieran. I created the issue at: openturns/openturns#1787 to find a bugfix.
orttak
@orttak
Hi, Can I save "openturns.metamodel.KrigingAlgorithm", "openturns.metamodel.KrigingResult" or "openturns.func.Function" for future processing? I create model to estimate weather condition at specific point and I want to save this model and use it.
2 replies
JPelamatti
@JPelamatti
Hello everyone, is there a method allowing to retrieve the GP model resulting from the use of EfficientGlobalOptimization? i.e., a KrigingResult object with the same parameters as the one provided to the optimization algorithm, but trained and conditioned with respect to both the initial data set and the infilled samples?
Because I couldn't find any easy way to do so, and if it is indeed the case, I think that a ot.EfficientGlobalOptimization.getUpdatedKrigingResult() could be a useful addition to the class
2 replies
NicolasDelepine
@NicolasDelepine
Hi everyone, I have an other question regarding composed distribution (cf. my question of mars 2020). I would like to use a Bayes distribution (2D : parameters U_TI) in a composed distribution 5D ([U_TI,Hs,T,Dir]). I have an error because I mix 2D and 1D distribution. Is there a way to create a such distribution ? Many thanks in advance
10 replies
NicolasDelepine
@NicolasDelepine
Hi everyone, I have an other question regarding vonMises distribution. I would like to fit data with a such distribution. But I can't. For others distributions, I have already used ot.LogNormalFactory().build(data) or ot.WeibullFactory().build(data2), but it seems that the option is not available for vonMises.
7 replies
JPelamatti
@JPelamatti
Hello! Quick question, is there a way to extract and set the diagonal values of an ot.SquareMatrix object? I'm thinking about methods that would look something like getDiagonal() and setDiagonal(), which unfortunately do not exist (expect for the HMatrix class if I'm correct)
nico nic
@nico6744_gitlab
Hi, I would like to use MCMC functionality. Do you have a simple example to illustrate it ? Many thanks in advance
nico nic
@nico6744_gitlab

@nico6744_gitlab def make_model(x):
a = pymc.Exponential('a', beta=x, value=0.5)

@pymc.deterministic
def b(a=a):
return 100-a

@pymc.stochastic
def c(value=.5, a=a, b=b):
return (value-a)**2/b

return locals()

M = pymc.MCMC(make_model(3))

nico nic
@nico6744_gitlab
I would like to use an equivalent functionality as 'py.MCMC' (below, which is a deprecated python code), but i wonder if i can implement a refinement criteria in ot.MCMC.
4 replies
Michael Baudin
@mbaudin47

Hello!
I just updated the project we use for PRACE training to OT1.16, but face an error because OpenTURNS cannot find ipopt:
https://app.circleci.com/pipelines/github/mbaudin47/hpcuqtraining/90/workflows/f3e2f47f-2cb9-4e79-bb50-f3b5e2b8a16f/jobs/93

import openturns as ot
[...]
ImportError: libipopt.so.3: cannot open shared object file: No such file or directory

Do you have an advice? @jschueller: I saw that you maintained the ipopt conda package: you may see it more clearly than I.

3 replies
Simmeene
@Simmeene

Hello everyone!
I'm writing my M.sc theses on uncertainty propagation and sensitivity analysis for a hydraulic model (finite element model). Totally new to both python and OT, but I've managed to do some things that I think will be useful.
Because the hydraulic model i'm running is quite heavy I'm planning on doing some sort of polynomial chaos expansion. I emailed the professor Bruno Sudret as well, and he recommended using sparse polynomial expansion.
1 . Do you all agree with this or would you recommend another method?

I'm using the "Sobol’ sensitivity indices from chaos" eg. borehole example together with "Polynomial chaos is sensitive to the degree" when making my setup.

I've managed to get good results with the examples. I've changed the sampling to sobol sequences, getting reasonable results for sobol indices, but when I look at the validation techniques in the examples they are based on creating new samples and doing additional model runs which I don't want. I've read a bit about Leave one out method but can't find any examples that use it for PCE.
2 . Could that be an idea or are there other alternatives?

Any help or advice would be much appreciated!
Best regards //Simon

4 replies
vchabri
@vchabri
Hi everyone!
Quick question about the ot.Sample object and its associated .sort() method. Is there any option to get a sorted sample in descending order instead of ascending one?
I could'nt find such an option in the documentation, but maybe I'm wrong.
Thanks a lot.
4 replies
efekhari27
@efekhari27

Hi everyone,

I was wondering why the KrigingResults class doesn't provide an access to the Kriging variance function. The method getConditionalMarginalVariance() allows to compute the Kriging variance on various points but getting the function object could be interesting to use it for optimization purposes (as much as we get the predictor function using the getMetaModel() method). Of course, this is not or real lack since a Python function can easily wrap getConditionalMarginalVariance().

Best,
Elias

2 replies
Hi again,
I was wondering if multiple cpus can be allocated to a SymbolicFunction(). It might sound useless since the main advantage of this analytical function is to be very quick. However, to get a reference value of a complicated toy-case, a large Monte Carlo simulation is often performed (order of 10^9). In this case, having a parallel SymbolicFunction() would save some time.
Best, Elias
5 replies
efekhari27
@efekhari27
Sorry I have a third question,
I tried the SimulatedAnneling() algorithm to optimize a LHS Design of Experiment based on a Normal distribution. I first used the L2-centered discrepancy (SpaceFillingC2()) as criterion and wanted to try using the minimum distance between the DoE points (SpaceFillingMinDist()). By simply replacing SpaceFillingC2() by SpaceFillingMinDist(), I get a bad DoE since the SimulatedAnneling() is a mimization problem while the SpaceFillingMinDist() criterion needs to be maximized. Is there a way to use the SpaceFillingMinDist() with SimulatedAnneling()?
Best, Elias
10 replies
JPelamatti
@JPelamatti
Hello everyone,
While playing a bit around with the PythonFunction class, I noticed that a user defined gradient function can only be provided by the user in the object constructor under the form of a standard python function, as this cannot be done later on with the setGradient accessor. Indeed, setGradient only seems to accept as input a GradientImplementation object, which I think can only be obtained through a getGradient accessor or by relying on finite difference gradients.
Do you think that modifying the setGradient accessor so that it can accept a standard python function could be a useful and coherent enhancement of the class?
Example:
def mySimulator(x):
y0 = 1. - x[0] * x[1]
y = [y0]
return y

dy0dx0 = 0.123
dy0dx1 = 0.321

# Defining the gradient in the constructor
# Output: [[ 0.123 ] [ 0.321 ]]

# Defining the gradient after the construction
f = ot.PythonFunction(2,1,mySimulator)
#output: TypeError: Object passed as argument is not convertible to a Gradient
3 replies
Irene Anello
Hi everyone,
I have to do sensitivity analysis of a defined by cases function.
The function is f = sqrt(2rDd) if d \in (0,2] and f = 2sqrt(D*r) if d>2.
I would like to use SymbolicFunction but I think it is impossibile. Do you know a way to define a function like this to perform sensitivity analysis?
Sorry for my English and thank you in advance :)
2 replies
Konstantin Kuznetsov
@kikuznetsov
Hello. I want to create a metamodel based on Code_Saturne calculations, in order to carry out uncertanty propagation. Do you have any detailed example how to get access to vtk fields from openTURNS or how to couple Code_Saturne and openTURNS. I found that it is possible to couple by YACS but it is not clear for me. Thanks!
8 replies
tom-max-lawson
@tom-max-lawson
Hello, I need to generate n different Kriging metamodels, and I am trying to run the hyperparameter optimisations for each Kriging model individually in its own process using the Python multiprocessing library. However, this is actually several times slower.
Has anyone here tried to run openturns optimisation in parallel processes? Is there anything I should know?
2 replies
Name cannot be blank

Hello all,
I am trying to find a system event but I got this error when I tried to find the union of events.

File "C:\ProgramData\Anaconda3\lib\site-packages\openturns\metamodel.py", line 9967, in init
_metamodel.UnionEvent_swiginit(self, _metamodel.new_UnionEvent(*args))

my threshold events are openturns.metamodel.ThresholdEvent which are defined like this

class=ThresholdEventImplementation antecedent=class=CompositeRandomVector function=class=Function name=Unnamed implementation=class=FunctionImplementation name=Unnamed description=[x0,x1,x2,y0] evaluationImplementation=class=QuadraticEvaluation name=Unnamed..

Any help would be very much appreciated. Thank you!

8 replies
Leejuhyoung
@Leejuhyoung
Hell all, I must need Openturns version 1.6. but i can't find it. How can i find it? Also I'm using Jupiter notebook .
3 replies
vchabri
@vchabri

Hi all,
I am doing kriging with OpenTURNS. All my inputs are assumed to be independent. Let assume I can split my input vector X into three vectors (X1, X2, X3).

• For X1, I define a productCovarianceModel of Matern covariance functions (covarianceKrigingModel = ot.MaternModel([1.0] * nb_exp, 3./2.)), with nb_exp the number of explanatory variables in X1 ;
• For X2, I would like to define a one-dimensional Matern covariance function parameterized by a single parameter (for all the components of X2). With this single parameter, the idea is to simplify the hyperparameters' optimization ;
• For X3, I model it with an homoscedastic nugget effect.

My question is the following: how is it possible to define such a covariance function for X2, with a single parameter for all the components of X2 ?

Don't hesitate to tell me if it's clear enough. I assume it's not

2 replies
Aurore Parrot
@amparrot_gitlab
Hi everyone, is it possible to fit a LogNormal distribution on a sample forcing the gamma parameter to zero ? I use LogNormalFactory() to fit the distribution but I don't want this aditional location parameter. Thank you by advance for your help.
3 replies
Akhilnandh
@Akhilnandh
Hello everyone,
11 replies
I am a researcher working on fitting distribution models ( a combination of both discrete and continuous distribution models ) to predict demand for inventory system. I find Open turns to be very useful. particularly, when selecting between different models. I came across the following test, which I am trying to use. https://openturns.github.io/openturns/1.16/user_manual/_generated/openturns.FittingTest_BestModelAIC.html#openturns.FittingTest_BestModelAIC
However, in this link, it is mentioned that the method returns the best model as per BIC
best_modelDistribution
The best distribution for the sample according to Bayesian information criterion. This may raise a warning if the best model does not perform well.
I implemented both BestModelBIC and BestModelAIC on a dataset and found them to be similar. I'd like to know if AIC is computed on the basis of BIC in this method or it is a typo
vchabri
@vchabri
Hi there!
I'm trying to install OpenTURNS 1.17 on a MacOS (macOS Catalina) and I get some trouble following this page:
https://openturns.github.io/openturns/latest/install.html
Is there any specific command or things to get this work?
Thanks a lot.
12 replies
Akhilnandh
@Akhilnandh
Hi there ! I was wondering if for model selection on the basis of distributions, after fitting a distribution, we can just take a sample and calculate the RMSE and MAE with the actual values. Is there any particular reason we go for goodness of fit tests and statistics rather than simple error metric