inpaint.py 文件源码

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

项目:vampyre 作者: GAMPTeam 项目源码 文件源码
def logistic_var():
    """
    Finds a variance to match probit and logistic regression.

    Finds a variance :math:`\\tau_w` such that,

        :math:`p=P(W < z) \\approx \\frac{1}{1+e^{-z}},`

    where :math:`W \\sim {\\mathcal N}(0,\\tau_w)`.
    """
    z = np.linspace(-5,5,1000)      # z points to test
    p1 = 1/(1+np.exp(-z))           # target probability
    var_test = np.linspace(2,3,1000)
    err = []
    for v in var_test:
        p2 = 0.5*(1+scipy.special.erf(z/np.sqrt(v*2)))
        err.append(np.mean((p1-p2)**2))

    i = np.argmin(err)
    wvar = var_test[i]
    return wvar
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号