streamsight.settings.PredictionDataProcessor

class streamsight.settings.PredictionDataProcessor

Bases: Processor

Injects the user ID to indicate ID for prediction.

Operates on the past and future interaction matrices to inject the user ID to be predicted by the model into the past interaction matrix. The resulting past interaction matrix will contain the user ID to be predicted which will be derived from the set of user IDs in the future interaction matrix. Timestamp of the masked interactions will be preserved as the item ID are simply masked with “-1”.

The corresponding ground truth future interactions of the actual interaction will be returned as well in a tuple when process is called.

__init__()

Methods

__init__()

process(past_interaction, future_interaction)

Injects the user ID to indicate ID for prediction.

_abc_impl = <_abc._abc_data object>
_inject_item_id(past_interaction: InteractionMatrix, future_interaction: InteractionMatrix, top_K: int = 1) Tuple[InteractionMatrix, InteractionMatrix]

Injects the item ID to indicate ID for prediction.

User ID to be predicted by the model will be indicated with item ID of “-1” as the corresponding label. The matrix with past interactions will contain the item ID to be predicted which will be derived from the set of item IDs in the future interaction matrix. Timestamp of the masked interactions will be preserved as the item ID are simply masked with “-1”.

Parameters:
Returns:

Tuple of past interaction with injected user ID to predict and ground truth future interactions of the actual interaction

Return type:

Tuple[InteractionMatrix, InteractionMatrix]

Deprecated since version 0.2.0: There is no need to inject item ID for with masked user ID.

_inject_user_id(past_interaction: InteractionMatrix, future_interaction: InteractionMatrix, top_K: int = 1) Tuple[InteractionMatrix, InteractionMatrix]

Injects the user ID to indicate ID for prediction.

User ID to be predicted by the model will be indicated with item ID of “-1” as the corresponding label. The matrix with past interactions will contain the user ID to be predicted which will be derived from the set of user IDs in the future interaction matrix. Timestamp of the masked interactions will be preserved as the item ID are simply masked with “-1”.

Parameters:
Returns:

Tuple of past interaction with injected user ID to predict and ground truth future interactions of the actual interaction

Return type:

Tuple[InteractionMatrix, InteractionMatrix]

process(past_interaction: InteractionMatrix, future_interaction: InteractionMatrix, top_K: int = 1) Tuple[InteractionMatrix, InteractionMatrix]

Injects the user ID to indicate ID for prediction.

User ID to be predicted by the model will be indicated with item ID of “-1” as the corresponding label. The matrix with past interactions will contain the user ID to be predicted which will be derived from the set of user IDs in the future interaction matrix. Timestamp of the masked interactions will be preserved as the item ID are simply masked with “-1”.

Parameters:
Returns:

Tuple of past interaction with injected user ID to predict and ground truth future interactions of the actual interaction

Return type:

Tuple[InteractionMatrix, InteractionMatrix]