コード例 #1
0
ファイル: transforms.py プロジェクト: zeyaddeeb/pymc3
 def forward_val(self, x_, point=None):
     x = x_.T
     # reverse cumsum
     x0 = x[:-1]
     s = np.cumsum(x0[::-1], 0)[::-1] + x[-1]
     z = x0 / s
     Km1 = x.shape[0] - 1
     k = np.arange(Km1)[(slice(None), ) + (None, ) * (x.ndim - 1)]
     eq_share = nplogit(1. / (Km1 + 1 - k).astype(str(x_.dtype)))
     y = nplogit(z) - eq_share
     return floatX(y.T)
コード例 #2
0
ファイル: transforms.py プロジェクト: aloctavodia/pymc3
 def forward_val(self, x_, point=None):
     x = x_.T
     # reverse cumsum
     x0 = x[:-1]
     s = np.cumsum(x0[::-1], 0)[::-1] + x[-1]
     z = x0 / s
     Km1 = x.shape[0] - 1
     k = np.arange(Km1)[(slice(None),) + (None,) * (x.ndim - 1)]
     eq_share = nplogit(1. / (Km1 + 1 - k).astype(str(x_.dtype)))
     y = nplogit(z) - eq_share
     return floatX(y.T)
コード例 #3
0
 def backward_val(self, y_):
     y = y_.T
     Km1 = y.shape[0]
     k = np.arange(Km1)[(slice(None), ) + (None, ) * (y.ndim - 1)]
     eq_share = nplogit(1.0 / (Km1 + 1 - k).astype(str(y_.dtype)))
     z = expit(y + eq_share)
     yl = np.concatenate([z, np.ones(y[:1].shape)])
     yu = np.concatenate([np.ones(y[:1].shape), 1 - z])
     S = np.cumprod(yu, 0)
     x = S * yl
     return floatX(x.T)
コード例 #4
0
 def forward_val(self, x, point=None):
     return nplogit(x)
コード例 #5
0
ファイル: transforms.py プロジェクト: aloctavodia/pymc3
 def forward_val(self, x, point=None):
     return nplogit(x)