lenskit.splitting.LastFrac#

class lenskit.splitting.LastFrac(frac, field='timestamp')#

Bases: HoldoutMethod

Select a fraction of test rows per user/item.

Stability:
Caller (see Stability Levels).
Parameters:
  • frac (double) – the fraction of items to select for testing.

  • field (str)

fraction: float#
field: str#
__call__(items)#

Subset an item list (in the uncommon case of item-based holdouts, the item list actually holds user IDs).

Parameters:
Returns:

The list of test items.

Return type:

lenskit.data.ItemList