MCPcopy
hub / github.com/NicolasHug/Surprise / test_user_based_field

Function test_user_based_field

tests/test_sim_options.py:45–55  ·  view source on GitHub ↗

Ensure that the user_based field is taken into account (only) when needed.

(u1_ml100k, pkf)

Source from the content-addressed store, hash-verified

43
44
45def test_user_based_field(u1_ml100k, pkf):
46 """Ensure that the user_based field is taken into account (only) when
47 needed."""
48
49 algorithms = (KNNBasic, KNNWithMeans, KNNBaseline)
50 for klass in algorithms:
51 algo = klass(sim_options={"user_based": True})
52 rmses_user_based = cross_validate(algo, u1_ml100k, ["rmse"], pkf)["test_rmse"]
53 algo = klass(sim_options={"user_based": False})
54 rmses_item_based = cross_validate(algo, u1_ml100k, ["rmse"], pkf)["test_rmse"]
55 assert rmses_user_based != rmses_item_based
56
57
58def test_shrinkage_field(u1_ml100k, pkf):

Callers

nothing calls this directly

Calls 1

cross_validateFunction · 0.90

Tested by

no test coverage detected