test_polynomial_network.py 文件源码

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

项目:polylearn 作者: scikit-learn-contrib 项目源码 文件源码
def test_random_starts():
    # not as strong a test as the direct case!
    # using training error here, and a higher threshold.
    # We observe the lifted solver reaches rather diff. solutions.
    degree = 3
    noisy_y = _lifted_predict(U[:degree], X)
    noisy_y += 5. * rng.randn(noisy_y.shape[0])

    common_settings = dict(degree=degree, n_components=n_components,
                           beta=0.01, tol=0.01)
    scores = []
    for k in range(5):
        est = PolynomialNetworkRegressor(random_state=k, **common_settings)
        y_pred = est.fit(X, noisy_y).predict(X)
        scores.append(mean_squared_error(noisy_y, y_pred))

    assert_less_equal(np.std(scores), 1e-4)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号