recpack.scenarios.splitters.UserInteractionTimeSplitter

class recpack.scenarios.splitters.UserInteractionTimeSplitter(t: float)

Split users based on the time of their most recent interactions.

Interactions of users whose last interaction occurred before t are assigned to the first return value. Interactions of all the other users are assigned to the second return value.

A user can only occur in one of both sets.

Parameters

t (int) – Timestamp to split on in seconds since epoch.

Methods

split(data)

Splits users based on the time of their most recent interactions.

Attributes

identifier

String identifier of the splitter object, contains name and parameter values.

name

The name of the splitter.

property identifier

String identifier of the splitter object, contains name and parameter values.

property name

The name of the splitter.

split(data: recpack.matrix.interaction_matrix.InteractionMatrix) Tuple[recpack.matrix.interaction_matrix.InteractionMatrix, recpack.matrix.interaction_matrix.InteractionMatrix]

Splits users based on the time of their most recent interactions.

Parameters

data (InteractionMatrix) – Interaction matrix to be split. Must contain timestamps.

Returns

A 2-tuple containing the data_in and data_out matrices.

Return type

Tuple[InteractionMatrix, InteractionMatrix]