8e958d70fa54c0b249f7e6de27fd57cbaa7563d4,algorithm/rating/SlopeOne.py,SlopeOne,predict,#SlopeOne#Any#Any#,29

Before Change




    def predict(self,u,i):
        itemDict = {}
        // check if the user existed in trainSet or not
        if self.dao.containsUser(u):
            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]

After Change


            sum = 0
            freqSum = 0
            itemRated,ratings = self.dao.userRated(u)
            for item,rating in zip(itemRated,ratings):
                diff = self.diffAverage[i][item]
                count = self.freq[i][item]
                sum += (rating + diff) * count
                freqSum += count
            try:
                pred = float(sum)/freqSum
            except ZeroDivisionError:
                pred = self.dao.userMeans[u]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 8

Instances


Project Name: Coder-Yu/RecQ
Commit Name: 8e958d70fa54c0b249f7e6de27fd57cbaa7563d4
Time: 2016-11-13
Author: fqq0429@gmail.com
File Name: algorithm/rating/SlopeOne.py
Class Name: SlopeOne
Method Name: predict


Project Name: automl/auto-sklearn
Commit Name: b8b9b6d34d35671fb8651f40503d51fc72477128
Time: 2019-03-13
Author: ahn1340@hotmail.com
File Name: scripts/2015_nips_paper/run_with_metalearning.py
Class Name:
Method Name: main


Project Name: has2k1/plotnine
Commit Name: 3c4c60ef5dce4695ebe29f2680058310daef77b9
Time: 2015-04-20
Author: has2k1@gmail.com
File Name: ggplot/layer.py
Class Name: layer
Method Name: compute_aesthetics


Project Name: automl/auto-sklearn
Commit Name: 145105e5dd84ca537b3eb5893fbe309edc497655
Time: 2019-02-21
Author: ahn1340@hotmail.com
File Name: scripts/2015_nips_paper/run_with_metalearning.py
Class Name:
Method Name: main