test_penalties.py 文件源码

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

项目:pyGAM 作者: dswah 项目源码 文件源码
def test_single_spline_penalty():
    """
    check that feature functions with only 1 basis are penalized correctly

    derivative penalty should be 0.
    l2 should penalty be 1.
    monotonic_ and convexity_ should be 0.
    """
    coef = np.array(1.)
    assert(np.alltrue(derivative(1, coef).A == 0.))
    assert(np.alltrue(l2(1, coef).A == 1.))
    assert(np.alltrue(monotonic_inc(1, coef).A == 0.))
    assert(np.alltrue(monotonic_dec(1, coef).A == 0.))
    assert(np.alltrue(convex(1, coef).A == 0.))
    assert(np.alltrue(concave(1, coef).A == 0.))
    assert(np.alltrue(circular(1, coef).A == 0.))
    assert(np.alltrue(none(1, coef).A == 0.))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号