コード例 #1
0
ファイル: lfm.py プロジェクト: 13256701918/recommend
def model_train_process():

    train_data = read.get_train_data("../data/ratings.txt")
    user_vec, item_vec = lfm_train(train_data, 50, 0.01, 0.1, 50)

    recom_result = give_recom_result(user_vec, item_vec, '24')
    ana_recom_result(train_data, '24', recom_result)
コード例 #2
0
def model_train_process():
    train_data = read.get_train_data("../data/ratings.txt")
    user_vector, item_vector = lfm_train(train_data, 50, 0.01, 0.1, 50)
    # print (user_vector[20])
    # print (item_vector['157'])
    for userid in user_vector:
        recom_result = (get_recomend_result(user_vector, item_vector, userid))
コード例 #3
0
ファイル: lfm.py プロジェクト: atm1992/LFM
def model_train_process():
    """test lfm model train"""
    userId = '24'
    train_data = read.get_train_data("../data/ratings.csv")
    user_vec, item_vec = lfm_train(train_data, 10, 0.02, 0.2, 20)
    recom_result = get_recom_result(user_vec, item_vec, userId)
    analysis_recom_result(train_data, userId, recom_result)
コード例 #4
0
def model_train_process():
    """
    test lfm model train
    :return:
    """
    train_data = read.get_train_data("../data/ratings.txt")
    user_vec, item_vec = lfm_train(train_data, 50, 0.01, 0.1, 50)
コード例 #5
0
ファイル: lfm.py プロジェクト: white-source/rec
def model_train_process():
    """
    test lfm model train
    """
    train_data=read.get_train_data("../data/ratings.txt")
    user_vec, item_vec = lfm_train(train_data, 50, 0.01, 0.1, 50)
    for userid in user_vec:
        recom_result = give_recom_result(user_vec, item_vec, userid)
コード例 #6
0
ファイル: lfm.py プロジェクト: ZGFrank/it-community
def model_train_process():
    train_data = read.get_train_data(read.get_rating_data())
    user_vec, article_vec = lfm_train(train_data, 50, 0.01, 0.1, 50)
    # print(user_vec["1"])
    # recom_result = give_recom_result(user_vec, article_vec, '24')
    # print(recom_result)
    for user_id in user_vec:
        threading.Thread(target=give_recom_result, args=(user_vec, article_vec, user_id)).start()
コード例 #7
0
def model_train_process():
    """
    test lfm model train
    :return:
    """
    train_data = read.get_train_data("../data/ratings.csv")
    user_vec, item_vec = lfm_train(train_data, 50, 0.01, 0.1, 50)
    recom_result = give_recom_result(user_vec, item_vec, '24')
    ana_recom_result(train_data, '24', recom_result)
コード例 #8
0
def model_train_process():
    train_data = read.get_train_data(
        os.path.dirname(
            os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) +
        "\\recommender\\data\\ml-latest-small\\ratings.csv")
    user_vec, item_vec = lfm_train(train_data, 50, 0.01, 0.1, 50)

    recom_list = give_recommender(user_vec, item_vec, '24')
    ana_recom_result(train_data, "24", recom_list)
コード例 #9
0
def model_train_process():
    """
    test lfm model train
    """
    train_data = read.get_train_data("../data/ratings.dat")
    user_vec, item_vec = lfm_train(train_data, 50, 0.01, 0.1, 50)
    recom_result = give_recom_result(user_vec, item_vec, '10')
    # print(user_vec["1"])
    # print(item_vec["2762"])
    # print(give_recom_result(user_vec, item_vec, '10'))
    ana_recom_result(train_data, '10', recom_result)
コード例 #10
0
def model_train_process():
	# 训练数据
	train_data = get_train_data("../data/ml-latest-small/ratings.csv")
	user_vec,item_vec = lfm(train_data, F = 50 , alpha = 0.01, beta = 0.1, step = 50)
	print('user_vec:',len(user_vec),user_vec['1'])
	print('item_vec:',len(item_vec),item_vec['1'])
	
	recom_list = get_recom_result(user_vec, item_vec, userid = '24')
	
	# 算法预测效果和用户真实评分记录对比
	ana_recom_result(train_data, '24', recom_list)
コード例 #11
0
def model_train_process():
    """
    test lfm model train
    :return:
    """
    train_data = read.get_train_data("../data/myratings.txt")
    user_vec, item_vec = lfm_train(train_data, 50, 0.01, 0.1, 50)

    recom_result = give_recom_result(user_vec, item_vec, "1")
    print(recom_result)

    ana_recom_result(train_data, "1", recom_result)
コード例 #12
0
ファイル: LFM.py プロジェクト: Tokyo113/LFM
def model_train_process():
    """
    test lfm model train
    """
    train_data = read.get_train_data("../data/ratings.dat")
    user_vec, item_vec = lfm_train(train_data,
                                   F=50,
                                   alpha=0.01,
                                   beta=0.1,
                                   step=50)
    print(user_vec["1"])
    print(item_vec["2455"])
コード例 #13
0
def model_train_process():
    """
    test lfm model train
    :return:
    """
    # train_data = read.get_train_data("../data/ml-1m/ratings.txt")
    train_data = read.get_train_data("../data/ratings.txt")
    user_vec, item_vec = lfm_train(train_data, 50, 0.01, 0.1, 50)
    recom_list = give_recom_result(user_vec, item_vec, '4')
    print(recom_list)
    ana_recom_result(train_data, '4', recom_list)

    return user_vec, item_vec
コード例 #14
0
def model_train_process():
    """
    test lfm model train
    """
    train_data = read.get_train_data("../data/split/rat_train.txt")
    user_vec, item_vec = lfm_train(train_data, 50, 0.01, 0.1, 50)
    # print(user_vec["1"])
    # print(item_vec["50"])

    # 基于一个用户的推荐
    # recom_result = give_recom_result(user_vec,item_vec,'1')
    # ana_recom_result(train_data,'1',recom_result)

    # 基于所有用户的推荐
    for userid in user_vec:
        recom_result = give_recom_result(user_vec, item_vec, userid)

        # 在此处定义一个数据结构(字典)中存储【userid,[itemid1,itemid2]】

        ana_recom_result(train_data, userid, recom_result)
コード例 #15
0
def model_train_process():
    train_data=read.get_train_data('../data/ratings.txt')
    user_vec,item_vec=lfm_train(train_data,50,0.01,0.1,50)
    for userid in user_vec:
        recom_result=give_recom_result(user_vec,item_vec,userid)
        ana_recom_result(train_data,userid,recom_result)