def train_negative_sampling(self, u_nid, train_pos_unid_inid_map, test_pos_unid_inid_map, neg_unid_inid_map, data):
    '\n        Unliked popular movie negative sampling:\n        :param u_nid:\n        :param train_pos_unid_inid_map:\n        :param test_pos_unid_inid_map:\n        :param neg_unid_inid_map:\n        :param data:\n        :return:\n        '
    num_pos_samples = len(train_pos_unid_inid_map[u_nid])
    negative_inids = (test_pos_unid_inid_map[u_nid] + neg_unid_inid_map[u_nid])
    nid_occs = np.array([data.item_nid_occs[0][nid] for nid in negative_inids])
    nid_occs = (nid_occs / np.sum(nid_occs))
    negative_inids = rd.choices(population=negative_inids, weights=nid_occs, k=(num_pos_samples * 5))
    return negative_inids
Unliked popular movie negative sampling:
:param u_nid:
:param train_pos_unid_inid_map:
:param test_pos_unid_inid_map:
:param neg_unid_inid_map:
:param data:
:return:
def train_negative_sampling(self, u_nid, train_pos_unid_inid_map, test_pos_unid_inid_map, neg_unid_inid_map, data):
    '\n        Unliked popular movie negative sampling:\n        :param u_nid:\n        :param train_pos_unid_inid_map:\n        :param test_pos_unid_inid_map:\n        :param neg_unid_inid_map:\n        :param data:\n        :return:\n        '
    num_pos_samples = len(train_pos_unid_inid_map[u_nid])
    negative_inids = (test_pos_unid_inid_map[u_nid] + neg_unid_inid_map[u_nid])
    nid_occs = np.array([data.item_nid_occs[0][nid] for nid in negative_inids])
    nid_occs = (nid_occs / np.sum(nid_occs))
    negative_inids = rd.choices(population=negative_inids, weights=nid_occs, k=(num_pos_samples * 5))
    return negative_inids