recpack.scenarios.splitters.StrongGeneralizationSplitter

class recpack.scenarios.splitters.StrongGeneralizationSplitter(in_frac=0.7, seed=None, error_margin=0.01)

Randomly splits the users into two sets so that interactions for a user will always occur only in one split.

Parameters
  • in_frac (float, optional) – The fraction of interactions that are assigned to the first value in the output tuple. Defaults to 0.7.

  • seed (int, optional) – Seed the random generator. Set this value if you require reproducible results.

  • error_margin (float, optional) – The allowed error between in_frac and the actual split fraction. Defaults to 0.01.

Methods

split(data)

Randomly splits the users into two sets so that

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)
Randomly splits the users into two sets so that

interactions for a user will always occur only in one split.

Parameters

data (InteractionMatrix) – Interaction matrix to be split.

Returns

A 2-tuple containing the data_in and data_out matrices.

Return type

Tuple[InteractionMatrix, InteractionMatrix]