def _mu(distr, z, eta):
"""The non-linearity (inverse link)."""
if distr in ['softplus', 'gamma']:
mu = np.log1p(np.exp(z))
elif distr == 'poisson':
mu = z.copy()
intercept = (1 - eta) * np.exp(eta)
mu[z > eta] = z[z > eta] * np.exp(eta) + intercept
mu[z <= eta] = np.exp(z[z <= eta])
elif distr == 'gaussian':
mu = z
elif distr == 'binomial':
mu = expit(z)
elif distr == 'probit':
mu = norm.cdf(z)
return mu
评论列表
文章目录