Skip to content

Commit fe21b59

Browse files
committed
drop binpickle test
1 parent 0cedb9a commit fe21b59

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

tests/test_als_explicit.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
from lenskit import util
1818
from lenskit.algorithms import als
1919

20-
try:
21-
import binpickle
22-
except ImportError:
23-
binpickle = None
24-
2520
_log = logging.getLogger(__name__)
2621

2722
simple_df = pd.DataFrame(
@@ -248,39 +243,6 @@ def test_als_save_load():
248243
assert len(preds) == 50
249244

250245

251-
@mark.skipif(not binpickle, reason="binpickle not available")
252-
def test_als_binpickle(tmp_path):
253-
"Test saving ALS with BinPickle"
254-
255-
original = als.BiasedMF(20, iterations=5)
256-
ratings = lktu.ml_test.ratings
257-
original.fit(ratings)
258-
259-
assert original.bias.mean_ == approx(ratings.rating.mean())
260-
261-
file = tmp_path / "als.bpk"
262-
binpickle.dump(original, file)
263-
264-
with binpickle.BinPickleFile(file) as bpf:
265-
# the pickle data should be small
266-
_log.info("serialized to %d pickle bytes", bpf.entries[-1].dec_length)
267-
assert bpf.entries[-1].dec_length < 2048
268-
269-
algo = bpf.load()
270-
271-
assert algo.bias.mean_ == original.bias.mean_
272-
assert np.all(algo.bias.user_offsets_ == original.bias.user_offsets_)
273-
assert np.all(algo.bias.item_offsets_ == original.bias.item_offsets_)
274-
assert np.all(algo.user_features_ == original.user_features_)
275-
assert np.all(algo.item_features_ == original.item_features_)
276-
assert np.all(algo.item_index_ == original.item_index_)
277-
assert np.all(algo.user_index_ == original.user_index_)
278-
279-
# make sure it still works
280-
preds = algo.predict_for_user(10, np.arange(0, 50, dtype="i8"))
281-
assert len(preds) == 50
282-
283-
284246
@mark.slow
285247
@mark.eval
286248
@mark.skipif(not lktu.ml100k.available, reason="ML100K data not present")

0 commit comments

Comments
 (0)