model.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:movie-recommendation-using-RBM 作者: pinkeshbadjatiya 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号