lenskit.splitting.SampleFrac#
- class lenskit.splitting.SampleFrac(frac, rng=None)#
Bases:
HoldoutMethodRandomly select a fraction of test rows per user/item.
- Stability:
- Caller (see Stability Levels).
- Parameters:
frac (float) – The fraction items to select for testing.
rng (lenskit.random.RNGInput) – The random number generator or seed (see Random Seeds).
- __call__(items)#
Subset an item list (in the uncommon case of item-based holdouts, the item list actually holds user IDs).
- Parameters:
udf – The item list from which holdout items should be selected.
items (lenskit.data.ItemList)
- Returns:
The list of test items.
- Return type: