コード例 #1
0
def ana_recom_result(train_data, userid, recom_list):
    """
    传入训练数据,用户id,推荐列表
    :param train_data: 展现用户对之前哪些电影感兴趣
    :param userid: 待分析用户
    :param recom_list:
    :return: 无返回,分析函数
    """
    item_info = read.get_item_info("../../data/movies/movies.csv")
    for data_instance in train_data:
        temp_userid, itemid, lable = data_instance
        if temp_userid == userid and lable == 1:  # 查看用户喜欢的item
            print(item_info[itemid])
    print("recommend result")
    for zuhe in recom_list:
        print(item_info[zuhe[0]])
コード例 #2
0
def ana_recom_result(train_data, userid, recom_list):
    """
    debug recom result for userid
    Args:
        train_data: train data for lfm model
        userid:fix userid
        recom_list: recom result by lfm
    """
    item_info = read.get_item_info("../data/movies.txt")
    for data_instance in train_data:
        tmp_userid, itemid, label = data_instance
        if tmp_userid == userid and label == 1:
            print(item_info[itemid])
    print("recom result")
    for zuhe in recom_list:
        print(item_info[zuhe[0]])