streamsight.evaluators.UserItemBaseStatus

class streamsight.evaluators.UserItemBaseStatus

Bases: object

Unknown and known user/item base.

This class is used to store the status of the user and item base. The class stores the known and unknown user and item set. The class also provides methods to update the known and unknown user and item set.

__init__() None

Methods

__init__()

Attributes

global_item_ids

Set of global item ids.

global_shape

Global shape of the user-item interaction matrix.

global_user_ids

Set of global user ids.

known_item

known_shape

Known shape of the user-item interaction matrix.

known_user

unknown_item

unknown_user

_reset_unknown_user_item_base()

Clears the unknown user and item set.

This method clears the unknown user and item set. This method should be called after the Phase 3 when the data release is done.

_update_known_user_item_base(data: InteractionMatrix)

Updates the known user and item set with the data.

Parameters:

data (InteractionMatrix) – Data to update the known user and item set with.

_update_unknown_user_item_base(data: InteractionMatrix)
property global_item_ids

Set of global item ids.

Returns the set of global item ids. The global item ids are the union of known and unknown item ids.

Returns:

Set of global item ids.

Return type:

set

property global_shape: Tuple[int, int]

Global shape of the user-item interaction matrix.

This is the shape of the user-item interaction matrix considering all the users and items that has been possibly exposed. The global shape considers the fact that an unknown user/item can be exposed during the prediction stage when an unknown user/item id is requested for prediction on the algorithm.

Returns:

Tuple of (|user|, |item|)

Return type:

Tuple[int, int]

property global_user_ids: set

Set of global user ids.

Returns the set of global user ids. The global user ids are the union of known and unknown user ids.

Returns:

Set of global user ids.

Return type:

set

known_item = {}
property known_shape: Tuple[int, int]

Known shape of the user-item interaction matrix.

This is the shape of the released user/item interaction matrix to the algorithm. This shape follows from assumption in the dataset that ID increment in the order of time.

Returns:

Tuple of (|user|, |item|)

Return type:

Tuple[int, int]

known_user = {}
unknown_item = {}
unknown_user = {}