math_to_code.py 文件源码

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

项目:STA141C 作者: clarkfitzg 项目源码 文件源码
def f(w, lamb):
    """
    Eq. (2) in problem 2

    Non-vectorized, slow
    """
    total = 0
    nrows = X.shape[0]
    for i in range(nrows):
        current = 1 + np.exp(-y[i] * X[i, ].dot(w))
        total += np.log(current)
    total += (lamb / 2) * w.dot(w)
    return total
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号