lenskit.splitting.SampleFrac#

class lenskit.splitting.SampleFrac(frac, rng=None)#

Bases: HoldoutMethod

Randomly select a fraction of test rows per user/item.

Stability:
Caller (see Stability Levels).
Parameters:
fraction: float#
rng: numpy.random.Generator#
__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