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

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

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


Project Name: dirty-cat/dirty_cat
Commit Name: a1a430fa42fa58cb3ba9d93f44749319928b78c8
Time: 2018-03-14
Author: patricio.cerda@inria.fr
File Name: dirty_cat/string_distances.py
Class Name:
Method Name: ngram_similarity