Random sampling of sorted numbers within range

You might find some previous discussion helpful here:

TL;dr:

tr = pm.transforms
Order = tr.Ordered()
Logodd = tr.LogOdds()
chain_tran = tr.Chain([Logodd, Order])

n = 5
with pm.Model() as m0:
    x = pm.Uniform("x", 0.0, 1.0, shape=n, transform=chain_tran,
                   testval=np.linspace(.1, .9, n))  # test value need to be ordered
    trace = pm.sample()
1 Like