Пример #1
0
def test_FTRL_learns():
    # test that this model learns something
    y_pred = ftrl_before.predict_proba(X)
    ll_before = logloss(y, y_pred)

    y_pred = ftrl_after.predict_proba(X)
    ll_after = logloss(y, y_pred)

    assert ll_before > ll_after
Пример #2
0
def test_FTRL_learns():
    # test that this model learns something
    y_pred = ftrl_before.predict_proba(X)
    ll_before = logloss(y, y_pred)

    y_pred = ftrl_after.predict_proba(X)
    ll_after = logloss(y, y_pred)

    assert ll_before > ll_after
Пример #3
0
def test_models_same_predictions():
    # for lambda1, lambda2 = 0, OGDLR and FTRLprox should generate the
    # same result. The same goes if hashing is used (except for the
    # rare case of hash collisions. A neural net does not necessarily
    # predict exactly the same outcome.
    y_f = ftrl_after.predict_proba(X)
    y_o = ogdlr_after.predict_proba(X)
    y_h = hash_after.predict_proba(X)
    assert np.allclose(y_f, y_o, atol=1e-15)
    assert np.allclose(y_f, y_h, atol=1e-15)
Пример #4
0
def test_models_same_predictions():
    # for lambda1, lambda2 = 0, OGDLR and FTRLprox should generate the
    # same result. The same goes if hashing is used (except for the
    # rare case of hash collisions. A neural net does not necessarily
    # predict exactly the same outcome.
    y_f = ftrl_after.predict_proba(X)
    y_o = ogdlr_after.predict_proba(X)
    y_h = hash_after.predict_proba(X)
    assert np.allclose(y_f, y_o, atol=1e-15)
    assert np.allclose(y_f, y_h, atol=1e-15)