lenskit.splitting.crossfold_users#

lenskit.splitting.crossfold_users(data, partitions, method, *, test_only=False, rng=None)#

Partition a dataset user-by-user for user-based cross-validation.

Stability:
Caller (see Stability Levels).
Parameters:
  • data (Dataset) – The dataset to partition.

  • partitions (int) – The number of partitions to produce.

  • method (HoldoutMethod) – The method for selecting test rows for each user.

  • test_only (bool) – If True, returns splits with only testing data.

  • rng (TypeAliasForwardRef('lenskit.random.RNGInput') | None) – The random number generator or seed (see Random Seeds).

Return type:

Iterator[TTSplit]

Returns

The train-test pairs.