Пример #1
0
def test_mcrank_set_estimator_params():
    gb = GradientBoostingClassifier(n_estimators=5,
                                    loss="deviance",
                                    random_state=0)
    mc = McRank(gb)
    mc.set_params(estimator__n_estimators=10)
    assert_equal(gb.n_estimators, 10)
Пример #2
0
def test_mcrank():
    gb = GradientBoostingClassifier(n_estimators=10,
                                    loss="deviance",
                                    random_state=0)
    mc = McRank(gb)
    mc.fit(X, y)
    assert_almost_equal(mc.score(X, y), 48.08, 2)
Пример #3
0
def test_mcrank_set_estimator_params():
    gb = GradientBoostingClassifier(n_estimators=5,
                                    loss="deviance",
                                    random_state=0)
    mc = McRank(gb)
    mc.set_params(estimator__n_estimators=10)
    assert_equal(gb.n_estimators, 10)
Пример #4
0
def test_mcrank():
    gb = GradientBoostingClassifier(n_estimators=10,
                                    loss="deviance",
                                    random_state=0)
    mc = McRank(gb)
    mc.fit(X, y)
    assert_almost_equal(mc.score(X, y), 48.08, 2)
Пример #5
0
def test_mcrank_warm_start():
    gb = GradientBoostingClassifier(n_estimators=5,
                                    loss="deviance",
                                    warm_start=True,
                                    random_state=0)
    mc = McRank(gb)
    mc.fit(X, y)
    assert_almost_equal(mc.score(X, y), 56.06, 1)

    mc.set_params(estimator__n_estimators=10)
    mc.fit(X, y)
    assert_almost_equal(mc.score(X, y), 48.08, 2)
Пример #6
0
def test_mcrank_warm_start():
    gb = GradientBoostingClassifier(n_estimators=5,
                                    loss="deviance",
                                    warm_start=True,
                                    random_state=0)
    mc = McRank(gb)
    mc.fit(X, y)
    assert_almost_equal(mc.score(X, y), 56.06, 1)

    mc.set_params(estimator__n_estimators=10)
    mc.fit(X, y)
    assert_almost_equal(mc.score(X, y), 48.08, 2)