lenskit.splitting.split#

Functions

dict_from_df(df)

Convert a dictionary mapping user IDs to item lists into a data frame.

dict_to_df(data)

Convert a dictionary mapping user IDs to item lists into a data frame.

Classes

TTSplit(train, test)

A train-test pair from splitting.

class lenskit.splitting.split.TTSplit(train, test)#

Bases: NamedTuple

A train-test pair from splitting.

Parameters:
train: Dataset#

The training data.

test: dict[int | str | bytes, ItemList]#

The test data.

property test_size: int#

Get the number of test pairs.

property test_df: DataFrame#

Get the test data as a data frame.

property train_df: DataFrame#

Get the training data as a data frame.

lenskit.splitting.split.dict_to_df(data)#

Convert a dictionary mapping user IDs to item lists into a data frame.

Parameters:

data (dict[int | str | bytes, ItemList])

Return type:

DataFrame

lenskit.splitting.split.dict_from_df(df)#

Convert a dictionary mapping user IDs to item lists into a data frame.

Parameters:

df (DataFrame)

Return type:

dict[int | str | bytes, ItemList]