当前位置: 首页 > 工具软件 > MyMediaLite > 使用案例 >

python prediction_使用python进行推荐MyMediaLite

夏奕
2023-12-01

1.下载IronPython,使得能够在.net平台跑python项目,目前只支持python2.7

2.下载MyMediaLite.dll

https://github.com/zenogantner/MyMediaLite

import clr

clr.AddReference("MyMediaLite.dll")

from MyMediaLite import *

load the data

train_data = IO.ItemData.Read("u1.base")

test_data = IO.ItemData.Read("u1.test")

set up the recommender

recommender = ItemRecommendation.UserKNN() # don't forget ()

recommender.K = 20

recommender.Feedback = train_data

recommender.Train()

measure the accuracy on the test data set

print Eval.Items.Evaluate(recommender, test_data, train_data)

make a prediction for a certain user and item

print recommender.Predict(1, 1)

 类似资料: