recpack.scenarios.splitters.FractionInteractionSplitter
- class recpack.scenarios.splitters.FractionInteractionSplitter(in_frac, seed: Optional[int] = None)
Split data randomly, such that
in_fraction
of interactions are assigned to the first return value and the remainder to the second.- Parameters
in_frac (float) – Fraction of events to end up in the first return value.
seed (int, optional) – Seed the random generator. Set this value if you require reproducible results. Defaults to None, which results in a random seed.
Methods
split
(data)Splits data randomly, such that
in_fraction
of interactions are assigned todata_in
and the remainder todata_out
.Attributes
String identifier of the splitter object, contains name and parameter values.
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 randomly, such that
in_fraction
of interactions are assigned todata_in
and the remainder todata_out
.- Parameters
data (InteractionMatrix) – Interaction matrix to be split.
- Returns
A 2-tuple containing the
data_in
anddata_out
matrices.- Return type
Tuple[InteractionMatrix, InteractionMatrix]