lenskit.batch.TestRequestAdapter ================================ .. py:class:: lenskit.batch.TestRequestAdapter(lists, *, items_as = 'test') :canonical: lenskit.batch._queries.TestRequestAdapter Bases: :py:obj:`collections.abc.Iterable`\ [\ :py:obj:`BatchRecRequest`\ ], :py:obj:`collections.abc.Sized` Wrapper 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_id`` and ``query_id`` key fields, if present are used to construct the recommendation queries. If there is no ``query_id`` field, then the entire key is used as a query ID. The item lists themselves are interpreted as directed by the ``items_as`` option: ``test`` Items are used as test items (e.g., the items for which to predict ratings), but **not** candidates. ``candidates`` Items are used as candidate lists. ``both`` Items are used as both test items and candidates. ``None`` Items are excluded. .. seealso:: :ref:`batch-queries`, :class:`~lenskit.batch.BatchRecRequest` :param lists: The item list collection. :param items_as: 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 .. py:attribute:: lists :type: lenskit.data.ItemListCollection .. py:attribute:: item_use :type: Literal['test', 'candidates', 'both'] | None .. py:method:: __len__() .. py:method:: __iter__()