ditel
2014-05-17 16:38:25 +08:00
Recommend函数:
def Recommend(user,train,W):
--- rank = dict()
--- interacted_items = train[user]
--- for v , wuv in sort(W[u].items,key = itemgetter(1),reverse = True)[0:k]:
--- --- for i ,rvi in train[v].items:
--- --- --- if i in interacted_items:
--- --- --- --- continue
--- --- --- rank[i] += wuv * rvi
--- return rank
-----------------------------------------------------------------
PS:像for v , wuv in sort这样的表达的什么啊?