pyglmnet.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:pyglmnet 作者: glm-tools 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号