Skip to content

Commit

Permalink
remove TF tests from ML20M
Browse files Browse the repository at this point in the history
  • Loading branch information
mdekstrand committed Nov 11, 2023
1 parent cb9c4ce commit 5c27c4f
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions tests/test_ml20m.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,12 @@
import logging
from pathlib import Path

import pandas as pd
import numpy as np

from lenskit.datasets import MovieLens
from lenskit import crossfold as xf
from lenskit.metrics import predict as pm
from lenskit import batch
from lenskit.algorithms import Recommender
from lenskit.algorithms.basic import Popular
from lenskit.algorithms.als import BiasedMF
from lenskit.algorithms import item_knn as knn

try:
import lenskit_tf
except:
lenskit_tf = None
from lenskit.util import Stopwatch
from lenskit.util import test as lktu

import pytest
from pytest import approx
Expand Down Expand Up @@ -76,27 +64,3 @@ def test_als_isolate(ml20m, rng):
assert len(preds) == len(pairs)
finally:
ares.close()


@pytest.mark.realdata
@pytest.mark.slow
@pytest.mark.skip
@pytest.mark.skipif(
lenskit_tf is None or not lenskit_tf.TF_AVAILABLE, reason="TensorFlow not available"
)
def test_tf_isvd(ml20m):
algo = lenskit_tf.IntegratedBiasMF(20)

def eval(train, test):
_log.info("running training")
algo.fit(train)
_log.info("testing %d users", test.user.nunique())
return batch.predict(algo, test)

folds = xf.sample_users(ml20m, 2, 5000, xf.SampleFrac(0.2))
preds = pd.concat(eval(train, test) for (train, test) in folds)
mae = pm.mae(preds.prediction, preds.rating)
assert mae == approx(0.60, abs=0.025)

user_rmse = preds.groupby("user").apply(lambda df: pm.rmse(df.prediction, df.rating))
assert user_rmse.mean() == approx(0.92, abs=0.05)

0 comments on commit 5c27c4f

Please sign in to comment.