def predictor(self, movie_id, user_id):
w = self.getW(user_movies[user_id])
#making predictions part Vq not given
data = copy.deepcopy(self.data[user_id])
probs = np.ones(5)
mx, index = -1, 0
for i in range(5):
calc = 1.0
for j in range(self.F):
temp = np.tensordot(data, self.getW(user_movies[user_id])[j]) + self.featureBias[j]
temp = 1.0 + np.exp(temp)
calc *= temp
probs[i] = calc
if mx < probs[i]:
index = i
mx = probs[i]
return index
model.py 文件源码
python
阅读 33
收藏 0
点赞 0
评论 0
评论列表
文章目录