def use_standard_user_rating(self, item_list=[]):
		"""没有评分暂时用None表示,与0区别"""
		all_user = self.get_all_users()
		if item_list==[]:
			item_list = self.get_all_items()
			self.user_rating_std = True

		for x in item_list:
			input_list = []
			for u in all_user:
				if self.user_rating[u].has_key(x):
					input_list.append(self.user_rating[u][x])
				else:
					input_list.append(None)

			normal_value = convert_values_normalization(input_list)
			#            update value
			for i in len(normal_value):
				self.user_rating[all_user[i]][x] = normal_value[i] or None
Beispiel #2
0
    def use_standard_user_rating(self, item_list=[]):
        """
        在标准化的data里,0和没有评分很难区分。
        没有评分暂时用None表示
        """
#        get standard value
        all_user = self.get_all_users()
        for x in item_list:
            input_list = []
            for u in all_user:
                if not self.user_rating[u].has_key(x):
                    input_list.append(None)
                else:
                    input_list.append(self.user_rating[u][x])
            normal_value = convert_values_normalization(input_list)
#            update value
            for i in len(normal_value):
                if normal_value[i] != None:
                    self.user_rating[all_user[i]][x] = normal_value[i]

        print "Use standard user rating."