lenskit.testing.ScorerTests#

class lenskit.testing.ScorerTests#

Bases: TrainingTests

Common tests for scorer components. Many of these just test that the component runs, not that it produces correct output.

component: ClassVar[type[lenskit.pipeline.Component]]#
can_score: ClassVar[Literal['some', 'known', 'all']] = 'known'#

What can this scorer score?

expected_rmse: ClassVar[float | tuple[float, float] | object | None] = None#

Asserts RMSE either less than the provided expected value or between two values as tuple.

expected_ndcg: ClassVar[float | tuple[float, float] | object | None] = None#

Asserts nDCG either greater than the provided expected value or between two values as tuple.

invoke_scorer(pipe, **kwargs)#
Parameters:

pipe (lenskit.pipeline.Pipeline)

Return type:

lenskit.data.ItemList

verify_models_equivalent(orig, copy)#

Verify that two models are equivalent.

test_score_known(rng, ml_ds, trained_pipeline)#
Parameters:
test_pickle_roundrip(rng, ml_ds, trained_pipeline, trained_model)#
Parameters:
test_score_unknown_user(rng, ml_ds, trained_pipeline)#

score with an unknown user ID

Parameters:
test_score_unknown_item(rng, ml_ds, trained_pipeline)#

score with one target item unknown

Parameters:
test_score_empty_query(rng, ml_ds, trained_pipeline)#

score with an empty query

Parameters:
test_score_query_history(rng, ml_ds, trained_pipeline)#

score when query has user ID and history

Parameters:
test_score_query_history_only(rng, ml_ds, trained_pipeline)#

score when query only has history

Parameters:
test_score_empty_items(rng, ml_ds, trained_pipeline)#

score an empty list of items

Parameters:
test_train_score_items_missing_data(rng, ml_ds)#

train and score when some entities are missing data

Parameters:
test_train_recommend(rng, ml_ds, trained_topn_pipeline)#

Test that a full train-recommend pipeline works.

Parameters:
test_ray_recommend(rng, ml_ds, trained_topn_pipeline)#

Ensure pipeline can be used via Ray.

Parameters:
test_run_with_doubles(ml_ratings)#
Parameters:

ml_ratings (pandas.DataFrame)

test_batch_prediction_accuracy(rng, ml_100k)#
Parameters:
test_batch_top_n_accuracy(rng, ml_100k)#
Parameters: