Skip to content

Commit

Permalink
fix predict doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
mdekstrand committed Jul 23, 2024
1 parent aa81a36 commit 70e2f5d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lenskit/lenskit/batch/_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ def predict(algo, pairs, *, n_jobs=None, **kwargs):
To use this function, provide a pre-fit algorithm:
.. doctest-skip::
>>> from lenskit.algorithms.bias import Bias
>>> from lenskit.metrics.predict import rmse
>>> from lenskit import datasets
>>> from lenskit.data import from_interactions_df
>>> ratings = datasets.MovieLens('data/ml-latest-small').ratings
>>> bias = Bias()
>>> bias.fit(ratings[:-1000])
>>> bias.fit(from_interactions_df(ratings[:-1000]))
<lenskit.algorithms.bias.Bias object at ...>
>>> preds = predict(bias, ratings[-1000:])
>>> preds.head()
Expand All @@ -58,7 +57,7 @@ def predict(algo, pairs, *, n_jobs=None, **kwargs):
99007 664 8636 4.0 1393891175 3.846268
99008 664 8641 4.5 1393890852 3.710635
>>> rmse(preds['prediction'], preds['rating'])
0.8326992222...
0.832699...
Args:
algo(lenskit.algorithms.Predictor):
Expand Down

0 comments on commit 70e2f5d

Please sign in to comment.