lenskit.splitting.crossfold_users#
- lenskit.splitting.crossfold_users(data, partitions, method, *, test_only=False, rng=None)#
Partition a frame of ratings or other data into train-test partitions user-by-user. This function does not care what kind of data is in data, so long as it is a Pandas DataFrame (or equivalent) and has a user column.
- Parameters:
data (Dataset) – a data frame containing ratings or other data you wish 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 (RNGInput | None) – The random number generator or seed (see Random Seeds).
- Return type:
Iterator[TTSplit]
- Returns
The train-test pairs.