BMF是笔者根据PMF(http://papers.nips.cc/paper/3208-probabilistic-matrix-factorization.pdf)和BPMF(https://www.cs.toronto.edu/~rsalakhu/papers/bpmf.pdf)论文思路,自主构建的模型,主要思路是建立MF的概率模型,然后用贝叶斯推断方法(变分)来求解。参考代码如下:
# -*- Encoding:UTF-8 -*-
'''
@author: Jason.F
@data: 2019.07.22
@function: Implementing BMF(Bayesian Matrix Factorization) By VI
Dataset: Movielen Dataset(ml-1m)
Evaluating: hitradio,ndcg
'''
import sys
import time
import logging
import pymc3 as pm
import numpy as np
import pandas as pd
import theano
import theano.tensor as t
import heapq
import math
def getTraindata():
data = []
filePath = '/data/fjsdata/ctKngBase/ml/ml-1m.train.rating&#