[ot-users] Custom distribution in FORM

Phil Fernandes phil.fernandes at enbridge.com
Fri Nov 10 18:42:11 CET 2017


Hello,

I am attempting to use a custom continuous probability distribution for a probability of failure calculation via FORM, but when I try to create a ComposedDistribution with my custom dist, the program fails with
NotImplementedError: Wrong number or type of arguments for overloaded function 'new_ComposedDistribution'.

The custom dist is defined as

class JohnsonSU(ot.PythonDistribution):
    def __init__(self, gamma=1, xi=0, delta=0.5, lam=1):
        super(JohnsonSU, self).__init__(1)
        if np.any(delta <= 0):
            raise ValueError('Delta must be >0.')
        if np.any(lam <= 0):
            raise ValueError('Lambda must be >0.')

        self.gamma = gamma  # shape 1
        self.xi = xi    # location
        self.delta = delta  # shape 2, >0
        self.lam = lam  # scale, >0
        self.scipy_dist = st.johnsonsu(self.gamma, self.delta, loc=self.xi, scale=self.lam)

    def computeCDF(self, x):
        return self.scipy_dist.cdf(x)

    def computePDF(self, x):
        return self.scipy_dist.pdf(x)

    def computeQuantile(self, p):
        return self.scipy_dist.ppf(p)

    def getMean(self):
        return self.scipy_dist.mean()

    def getStandardDeviation(self):
        return self.scipy_dist.std()


Are there additional functions that must be defined in order for the PythonDistribution to be compatible with existing OpenTurns Distributions? Or, is there a straightforward way that I could add arbitrary distributions to the OpenTurns source code?

Many thanks!

Phil Fernandes   P.Eng, MASc
Engineer, Reliability Assessment
-

ENBRIDGE PIPELINES INC.
TEL: 780-420-8210  |  FAX: 780-420-5234
7045 Enbridge Centre, 10175 101 Street NW, Edmonton, AB, T5J 0H3

www.enbridge.com<http://www.enbridge.com/>
Integrity. Safety. Respect.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openturns.org/pipermail/users/attachments/20171110/7cc5be66/attachment.html>


More information about the users mailing list