예제 #1
0
def test__predict__good__disjoint_drop():
    """test the predict() method on disjoint validation pairs with the cold_start='drop' option"""

    model = RankFM(factors=2)
    model.fit(intx_train_pd_int)
    scores = model.predict(intx_valid_disjoint, cold_start='drop')

    shape = scores.shape == (5, )
    dtype = scores.dtype == np.float32
    nmiss = np.sum(np.isnan(scores).astype(np.int32)) == 0
    assert shape and dtype and nmiss
예제 #2
0
def test__predict__good__train():
    """test the predict() method on the training inputs"""

    model = RankFM(factors=2)
    model.fit(intx_train_pd_int)
    scores = model.predict(intx_train_pd_int)

    shape = scores.shape == (9, )
    dtype = scores.dtype == np.float32
    nmiss = np.sum(np.isnan(scores).astype(np.int32)) == 0
    assert shape and dtype and nmiss