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.))
评论列表
文章目录