def get_interaction_table(self, user_id, item_id, y):
    'Get interaction_table that is used for fetching user-item interaction label in LS regularization.\n\n        Args:\n            user_id(torch.Tensor): the user id in user-item interactions, shape: [n_interactions, 1]\n            item_id(torch.Tensor): the item id in user-item interactions, shape: [n_interactions, 1]\n            y(torch.Tensor): the label in user-item interactions, shape: [n_interactions, 1]\n\n        Returns:\n            tuple:\n                - interaction_table(dict): key: user_id * 10^offset + item_id; value: y_{user_id, item_id}\n                - offset(int): The offset that is used for calculating the key(index) in interaction_table\n        '
    offset = len(str(self.n_entities))
    offset = (10 ** offset)
    keys = ((user_id * offset) + item_id)
    keys = keys.int().cpu().numpy().tolist()
    values = y.float().cpu().numpy().tolist()
    interaction_table = dict(zip(keys, values))
    return (interaction_table, offset)
Get interaction_table that is used for fetching user-item interaction label in LS regularization.

Args:
    user_id(torch.Tensor): the user id in user-item interactions, shape: [n_interactions, 1]
    item_id(torch.Tensor): the item id in user-item interactions, shape: [n_interactions, 1]
    y(torch.Tensor): the label in user-item interactions, shape: [n_interactions, 1]

Returns:
    tuple:
        - interaction_table(dict): key: user_id * 10^offset + item_id; value: y_{user_id, item_id}
        - offset(int): The offset that is used for calculating the key(index) in interaction_table
def get_interaction_table(self, user_id, item_id, y):
    'Get interaction_table that is used for fetching user-item interaction label in LS regularization.\n\n        Args:\n            user_id(torch.Tensor): the user id in user-item interactions, shape: [n_interactions, 1]\n            item_id(torch.Tensor): the item id in user-item interactions, shape: [n_interactions, 1]\n            y(torch.Tensor): the label in user-item interactions, shape: [n_interactions, 1]\n\n        Returns:\n            tuple:\n                - interaction_table(dict): key: user_id * 10^offset + item_id; value: y_{user_id, item_id}\n                - offset(int): The offset that is used for calculating the key(index) in interaction_table\n        '
    offset = len(str(self.n_entities))
    offset = (10 ** offset)
    keys = ((user_id * offset) + item_id)
    keys = keys.int().cpu().numpy().tolist()
    values = y.float().cpu().numpy().tolist()
    interaction_table = dict(zip(keys, values))
    return (interaction_table, offset)