[ot-users] Collection of the marginals distribution

LEBRUN Régis regis.lebrun at eads.net
Wed Jan 8 15:17:08 CET 2014


Hi,

In your code, the kernelSmoothedCDF_Freq is a Graph instance, ie a 
graphical object that has nothing to do with a probabilistic model (ie a 
Distribution object). There is no hope to be able to convert a Graph 
into a Distribution as you try when you write collectionMarginals[0] = 
Distribution(kernelSmoothedCDF_Freq)

In fact, the distribution you are looking at is precisely 
kernelSmoothedDist, so you just have to write:

collectionMarginals[0] = kernelSmoothedDist

If you use a very old version of OpenTURNS, you may have to explicitely 
cast kernelSmoothedDist into a Distribution:
collectionMarginals[0] = Distribution(kernelSmoothedDist)

Hope it helps

Regards,

Régis

Le 08/01/2014 14:18, ndiaye a écrit :
>   Hello,
>   I have a question on Open turns since i'm a new user of this code and
> about uncertainty quantification study.
>
>   Indeed, I want to create a collection of the marginals distribution from
>   my numerical sample of data that i know from experiments.
>   The thing is I drew the CDF of my samples using kernel smoothing and
> now i
>   want to create the collection of the marginals distribution linked
>   (because i want to create the input random vector after that).
>   More precisely I have :
>   My sample file:
>
>   Sample1 = NumericalSample.ImportFromCSVFile("frequence.csv")
>
>   My CDF drawing :
>   kernel = KernelSmoothing()
>   kernelSmoothedDist = kernel.build(Sample1,True)
>   print  "kernel bandwidth=" , kernel.getBandwidth()
>   myBandwith3 = kernel.computeMixedBandwidth(Sample1)
>   kernelSmoothedDist = kernel.build(Sample1, myBandwith3)
>   kernelSmoothedCDF_Freq = kernelSmoothedDist.drawCDF()
>   empiricalCDF =
>
> VisualTest.DrawEmpiricalCDF(Sample1,Sample1.getMin()[0],Sample1.getMax()[0])
>
>   drawableEmpiricalCDF = empiricalCDF.getDrawable(0)
>   drawableEmpiricalCDF.setColor('black')
>   kernelSmoothedCDF_Freq.add(drawableEmpiricalCDF)
>   kernelSmoothedCDF_Freq.draw("Freq_smoothedCDF-Freq_EmpiricalCDF")
>
>   And my marginal collection:
>
>   collectionMarginals = DistributionCollection(#)
>   collectionMarginals[0] = Distribution(kernelSmoothedCDF_Freq)
>
>   I want to use it to create my inputrandom vector but it doesn't work.
>
>   Do you have some suggestions?
>   Thank you.
>




More information about the users mailing list