lenskit.batch.TestRequestAdapter#
- class lenskit.batch.TestRequestAdapter(lists, *, items_as='test')#
Bases:
collections.abc.Iterable[BatchRecRequest],collections.abc.SizedWrapper for an item list collection that interprets it as a collection of test requests. Iterating over this collection will yield the requests in the same order they are in the underlying item list collection.
The
user_idandquery_idkey fields, if present are used to construct the recommendation queries. If there is noquery_idfield, then the entire key is used as a query ID. The item lists themselves are interpreted as directed by theitems_asoption:testItems are used as test items (e.g., the items for which to predict ratings), but not candidates.
candidatesItems are used as candidate lists.
bothItems are used as both test items and candidates.
NoneItems are excluded.
See also
- Parameters:
lists (lenskit.data.ItemListCollection) – The item list collection.
items_as (Literal['test', 'candidates', 'both'] | None) – Where to put the item lists in the request.
- Warns:
DataWarning – If the item list collection cannot be used to construct usable requests.
- Stability:
- Caller (see Stability Levels).
- __len__()#
- __iter__()#
- Return type: