Skip to content

Commit

Permalink
fix batch_predict ML100K
Browse files Browse the repository at this point in the history
  • Loading branch information
mdekstrand committed Jul 25, 2024
1 parent ffb121c commit ccde1f3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lenskit/tests/test_batch_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,14 @@ def test_predict_include_rating(mlb: MLB):
assert all(preds.rating.values == urv.loc[preds.index, :].rating.values)


@pytest.mark.skipif(not lktu.ml100k.available, reason="ML-100K required")
@pytest.mark.eval
@pytest.mark.parametrize("ncpus", [None, 1, 2])
def test_bias_batch_predict(ncpus):
def test_bias_batch_predict(ml_100k, ncpus):
import lenskit.crossfold as xf
import lenskit.metrics.predict as pm
from lenskit import batch
from lenskit.algorithms import bias

ratings = lktu.ml100k.ratings

algo = bias.Bias(damping=5)

def eval(train, test):
Expand All @@ -143,7 +140,7 @@ def eval(train, test):
return recs

preds = pd.concat(
(eval(train, test) for (train, test) in xf.partition_users(ratings, 5, xf.SampleFrac(0.2)))
(eval(train, test) for (train, test) in xf.partition_users(ml_100k, 5, xf.SampleFrac(0.2)))
)

_log.info("analyzing predictions")
Expand Down

0 comments on commit ccde1f3

Please sign in to comment.