math_to_code.py 文件源码

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

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

    Vectorized (no explicit loops), fast
    """
    yxTw = y * X.dot(w)
    firstpart = np.log(1 + np.exp(-yxTw))
    total = firstpart.sum()
    total += (lamb / 2) * w.dot(w)
    return total
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号