class MFbpr(Recommender): ''' コンストラクタとか他の処理 ''' def buildModel(self): loss_pre = sys.float_info.max nonzeros = self.trainMatrix.nnz hr_prev = 0.0 sys.stderr.write("Run for BPR. \n") for itr in xrange(self.maxIter): start = time.time() # Each training epoch for s in xrange(nonzeros): # sample a user u = np.random.randint(self.userCount) itemList = self.trainMatrix.getrowview(u).rows[0] if len(itemL