Esempio n. 1
0
def test_ogdlr_with_hash_learns():
    # test that this model learns something
    y_pred = hash_before.predict_proba(X)
    ll_before = logloss(y, y_pred)

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

    assert ll_before > ll_after
Esempio n. 2
0
def test_ogdlr_with_hash_learns():
    # test that this model learns something
    y_pred = hash_before.predict_proba(X)
    ll_before = logloss(y, y_pred)

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

    assert ll_before > ll_after
Esempio n. 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)
Esempio n. 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)