File: t_MetaModelAlgorithm_std.py

package info (click to toggle)
openturns 1.24-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 66,204 kB
  • sloc: cpp: 256,662; python: 63,381; ansic: 4,414; javascript: 406; sh: 180; xml: 164; yacc: 123; makefile: 98; lex: 55
file content (34 lines) | stat: -rwxr-xr-x 942 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import openturns as ot
from math import pi

ot.TESTPREAMBLE()
ot.Log.Show(0)
ot.PlatformInfo.SetNumericalPrecision(3)


dim = 2
R = ot.CorrelationMatrix(2)
R[0, 1] = 0.5
src = [
    ot.JointDistribution([ot.Uniform(-pi, pi)] * dim),
    ot.JointDistribution([ot.Normal(4.0, 2.0)] * dim),
    ot.JointDistribution([ot.Gamma()] * dim),
    ot.JointDistribution([ot.Gamma(1.5, 2.5, -0.5)] * dim),
    ot.JointDistribution([ot.Arcsine(5.2, 11.6)] * dim),
    ot.Normal([3.0] * dim, [2.0] * dim, R),
]

for sd in src:
    sample = sd.getSample(2000)
    d = ot.MetaModelAlgorithm.BuildDistribution(sample)
    print(d)

sample = ot.Sample(
    [[0], [142.857], [285.714], [428.571], [571.429], [714.286], [857.143], [1000.0]]
)
distribution = ot.MetaModelAlgorithm.BuildDistribution(sample)
print(distribution)
print("distribution (HTML)")
print(distribution._repr_html_())
print("distribution (Markdown)")
print(distribution.__repr_markdown__())