Create a mixture of PDFsΒΆ

In this basic example we are going to build a linear combination of probability density functions.

In [1]:
from __future__ import print_function
import openturns as ot
In [2]:
# create a collection of distribution, and associated weights
collDist = [ot.Triangular(1.0, 2.0, 4.0), ot.Normal(-1.0, 1.0), ot.Uniform(5.0, 6.0)]
weight = [0.4, 1.0, 0.2]
In [3]:
# create the mixture
distribution = ot.Mixture(collDist, weight)
print(distribution)
Mixture((w = 0.25, d = Triangular(a = 1, m = 2, b = 4)), (w = 0.625, d = Normal(mu = -1, sigma = 1)), (w = 0.125, d = Uniform(a = 5, b = 6)))
In [4]:
# draw PDF
distribution.drawPDF()
Out[4]:
../../_images/examples_probabilistic_modeling_mixture_distribution_5_0.svg