fd76e96ce1a9718be1ae141c5f3cabddf48ca85f,pymc3/distributions/transforms.py,StickBreaking,forward,#StickBreaking#Any#,446

Before Change


        x0 = x[:-1]
        s = tt.extra_ops.cumsum(x0[::-1], 0)[::-1] + x[-1]
        z = x0 / s
        Km1 = x.shape[0] - 1
        k = tt.arange(Km1)[(slice(None),) + (None,) * (x.ndim - 1)]
        eq_share = logit(1.0 / (Km1 + 1 - k).astype(str(x_.dtype)))
        y = logit(z) - eq_share
        return floatX(y.T)

    def forward_val(self, x_, point=None):

After Change


    def forward(self, x_):
        x = x_.T
        n = x.shape[0]
        lx = tt.log(x)
        shift = tt.sum(lx, 0, keepdims=True) / n
        y = lx[:-1] - shift
        return floatX(y.T)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: pymc-devs/pymc3
Commit Name: fd76e96ce1a9718be1ae141c5f3cabddf48ca85f
Time: 2020-09-27
Author: dominik.otto@izi.fraunhofer.de
File Name: pymc3/distributions/transforms.py
Class Name: StickBreaking
Method Name: forward


Project Name: pymc-devs/pymc3
Commit Name: 8bd963500d490db3d7ed15bed06af3d439b90006
Time: 2015-06-18
Author: jsalvatier@gmail.com
File Name: pymc3/distributions/transforms.py
Class Name: SimplexTransform
Method Name: jacobian_det


Project Name: pymc-devs/pymc3
Commit Name: 8bd963500d490db3d7ed15bed06af3d439b90006
Time: 2015-06-18
Author: jsalvatier@gmail.com
File Name: pymc3/distributions/transforms.py
Class Name: SimplexTransform
Method Name: backward