streamsight.settings.NPastInteractionTimestampSplitter
- class streamsight.settings.NPastInteractionTimestampSplitter(t, t_upper: int | None = None, n_seq_data: int = 1, include_all_past_data: bool = False)
Bases:
TimestampSplitter
Splits with n past interactions based on a timestamp.
Splits the data into unlabeled and ground truth data based on a timestamp. Historical data contains last n_seq_data interactions before the timestamp t and the future interaction contains interactions after the timestamp t.
Attribute definition
past_interaction
: List of unlabeled data. Interval is [0, t).future_interaction
: Data used for training the model. Interval is [t, t+t_upper) or [t,inf].n_seq_data
: Number of last interactions to provide as data for model to make prediction. These interactions are past interactions from before the timestamp t.
- param t:
Timestamp to split on in seconds since epoch.
- type t:
int
- param t_upper:
Seconds past t. Upper bound on the timestamp of interactions. Defaults to None (infinity).
- type t_upper:
int, optional
- param n_seq_data:
Number of last interactions to provide as data for model to make prediction.
- type n_seq_data:
int, optional
- param include_all_past_data:
If True, include all past data in the past_interaction.
- type include_all_past_data:
bool, optional
- return:
A 2-tuple containing the past_interaction and future_interaction matrices.
- rtype:
Tuple[InteractionMatrix, InteractionMatrix]
- __init__(t, t_upper: int | None = None, n_seq_data: int = 1, include_all_past_data: bool = False)
Methods
__init__
(t[, t_upper, n_seq_data, ...])split
(data)Splits data such that the following definition holds:
Attributes
String identifier of the splitter object, contains name and parameter values.
The name of the splitter.
- _abc_impl = <_abc._abc_data object>
- property identifier
String identifier of the splitter object, contains name and parameter values.
- property name
The name of the splitter.
- split(data: InteractionMatrix) Tuple[InteractionMatrix, InteractionMatrix]
Splits data such that the following definition holds:
past_interaction
: List of unlabeled data. Interval is [0, t).future_interaction
: Data used for training the model. Interval is [t, t+t_upper) or [t,inf].
- Parameters:
data (InteractionMatrix) – Interaction matrix to be split. Must contain timestamps.
- Returns:
A 2-tuple containing the past_interaction and future_interaction matrices.
- Return type:
Tuple[InteractionMatrix, InteractionMatrix]
- update_split_point(t: int)