06e423b08766d831d903cf4422d2c46735dd7821,data/rating.py,RatingDAO,__computeItemMean,#RatingDAO#,112

Before Change



    def __computeItemMean(self):
        for c in self.item:
            n = self.col(c) > 0
            mean = 0
            if not self.containsItem(c):  // no data about current user in training set
                pass
            else:
                sum = float(self.col(c)[0].sum())
                try:
                    mean = sum / n[0].sum()
                except ZeroDivisionError:
                    mean = 0
            self.itemMeans[c] = mean

    def getUserId(self,u):
        if self.user.has_key(u):
            return self.user[u]

After Change



    def __computeItemMean(self):
        for c in self.item:
            self.itemMeans[c] = sum(self.trainSet_i[c].values()) / float(len(self.trainSet_i[c]))

    def getUserId(self,u):
        if self.user.has_key(u):
            return self.user[u]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: Coder-Yu/RecQ
Commit Name: 06e423b08766d831d903cf4422d2c46735dd7821
Time: 2017-06-09
Author: yuyu2223@163.com
File Name: data/rating.py
Class Name: RatingDAO
Method Name: __computeItemMean


Project Name: CSAILVision/semantic-segmentation-pytorch
Commit Name: 6324799d51a451995a91b76306eae40ccd11f55e
Time: 2018-03-27
Author: jasonhsiao97@gmail.com
File Name: utils.py
Class Name:
Method Name: accuracy


Project Name: Coder-Yu/RecQ
Commit Name: 06e423b08766d831d903cf4422d2c46735dd7821
Time: 2017-06-09
Author: yuyu2223@163.com
File Name: data/rating.py
Class Name: RatingDAO
Method Name: __computeUserMean