recpack.scenarios.splitters.UserSplitter

class recpack.scenarios.splitters.UserSplitter(users_in: Union[Set[int], List[int]], users_out: Union[Set[int], List[int]])

Split data by the user identifiers of the interactions.

Users in users_in are assigned to the first return value, users in users_out are assigned to the second return value.

Parameters
  • users_in (Union[Set[int], List[int]]) – Users for whom the events are assigned to the in_matrix

  • users_out (Union[Set[int], List[int]]) – Users for whom the events are assigned to the out_matrix

Methods

split(data)

Splits data by the user identifiers of the 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 data by the user identifiers of the interactions.

Parameters

data (InteractionMatrix) – Interaction matrix to be split.

Returns

A 2-tuple: the first value contains the interactions of users_in, the second the interactions of users_out.

Return type

Tuple[InteractionMatrix, InteractionMatrix]