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

Before Change


        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):

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: 4

Non-data size: 6

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: uber/pyro
Commit Name: 2bc6db627ee80fe8f05a55394ddda962a8f25c3e
Time: 2020-02-22
Author: fritzo@uber.com
File Name: pyro/infer/renyi_elbo.py
Class Name: RenyiELBO
Method Name: loss


Project Name: uber/pyro
Commit Name: 2bc6db627ee80fe8f05a55394ddda962a8f25c3e
Time: 2020-02-22
Author: fritzo@uber.com
File Name: pyro/infer/renyi_elbo.py
Class Name: RenyiELBO
Method Name: loss_and_grads


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