code: def evaluate_rules(self):
  		
  
  		outputs = defaultdict(list)
  		total_rules = len(self._rules)
  		for rule in self._rules:
  			res = rule.evaluate(self._variables)
  			outputs[res['term']].append([res['weight'], res['output']])
  
  		return_values = {}
  		for k,v in outputs.items():
  			num = sum(map(lambda (x,y): x*y, v))
  			den = sum([i for i,j in v])
  			if den==0: return_values[k] = 0
  			else: return_values[k] = num/den
  
  		return return_values
docs: Perform Sugeno inference.