Beispiel #1
0
 def computeMetrics(self):
     scores = [agent.score for agent in self.agent_set]
     self.mean = u.mean(scores)
     self.std = u.popStdDev(scores)
     self.minscore = min(scores)
     self.medscore = u.median(scores)
     self.maxscore =max(scores)
     agents_sorted = sorted(self.agent_set, key=lambda agent:agent.score)
     self.minscoreHfraction = agents_sorted[0].getHFraction()
     self.maxscoreHfraction = agents_sorted[-1].getHFraction()
     self.medscoreHfraction = agents_sorted[int(len(self.agent_set)/2)].getHFraction()
     hfractions = [agent.getHFraction() for agent in self.agent_set]
     self.medHfraction = u.median(hfractions)
     self.avgHfraction = u.mean(hfractions)
     self.minHfraction = min(hfractions)
     self.maxHfraction = max(hfractions)
     self.sumHfractions = sum(hfractions)
     dhfractions = [abs(hfractions[i] - self.oldHfractions[i]) for i in range(len(hfractions))]
     self.sumdH = sum(dhfractions)
 def adult_med_life(self):
     return  U.median(self.theWorld.adult_ages_at_death)
 def med_life(self):
     return U.median(self.theWorld.ages_at_death)
 def adult_med_life(self):
     return U.median(self.theWorld.adult_ages_at_death)
 def med_life(self):
     return U.median(self.theWorld.ages_at_death)
 def computeWealthMetrics(self):
     self.median_storage.append(U.median(self.hh_food_stored))
     self.avg_food_stored.append(U.mean(self.hh_food_stored))
 def computeWealthMetrics(self):
     self.median_storage.append(U.median(self.hh_food_stored))
     self.avg_food_stored.append(U.mean(self.hh_food_stored))