eb9b33646872a2565dae65b17e9cb908e886386a,algorithm/rating/SlopeOne.py,SlopeOne,predict,#SlopeOne#,30

Before Change




    def predict(self,u,i):
        for u in self.dao.testSet_u.keys():
            if SymmetricMatrix.contains(u) == True://should use another interface
                itemList = self.dao.row(u)>0
                for item in self.dao.testSet_u[u].keys():
                    pass
            else:
                for item in self.dao.testSet_u[u].keys():
                    pred = self.dao.itemMeans[item]

After Change




    def predict(self,u,i):
        itemDict = {}
        // check if the user existed in trainSet or not
        if self.dao.containsUser(u) == True:
            for item in self.dao.row(u).valuse():
                if item.values() > 0:
                    itemDict[item] = item.values()
                else:
                    continue
            Sum = 0
            freqSum = 0
            for item2 in itemDict.keys():
                Sum = Sum + ((itemDict[item2] + self.diffAverage[u][item2]) * self.freq[u][item2])
                freqSum = freqSum + self.freq[u][item2]
            pred = Sum/freqSum

        else:
            pred = self.dao.itemMeans[u]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: Coder-Yu/RecQ
Commit Name: eb9b33646872a2565dae65b17e9cb908e886386a
Time: 2016-11-12
Author: 156698920@qq.com
File Name: algorithm/rating/SlopeOne.py
Class Name: SlopeOne
Method Name: predict


Project Name: openai/gym
Commit Name: 9a7f9129892390247cfbcacdc12ab4157371af37
Time: 2019-10-18
Author: 1315874+dniku@users.noreply.github.com
File Name: setup.py
Class Name:
Method Name:


Project Name: CamDavidsonPilon/lifelines
Commit Name: b46c893e2c0f9cd505b597c2ff215a0df04b6050
Time: 2020-05-19
Author: cam.davidson.pilon@gmail.com
File Name: lifelines/fitters/npmle.py
Class Name:
Method Name: log_likelihood