(self)
Do statistical analysis of population and set 'statted' to True
Do statistical analysis of population and set 'statted' to True
Do statistical analysis of population and set statted to True
def statistics(self):
      """ Do statistical analysis of population and set 'statted' to True """
      if self.statted:
         return
      logging.debug("Running statistical calculations")
      raw_sum = 0

      len_pop = len(self)
      for ind in xrange(len_pop):
         raw_sum += self[ind].score

      self.stats["rawMax"] = max(self, key=key_raw_score).score
      self.stats["rawMin"] = min(self, key=key_raw_score).score
      self.stats["rawAve"] = raw_sum / float(len_pop)

      tmpvar = 0.0
      for ind in xrange(len_pop):
         s = self[ind].score - self.stats["rawAve"]
         s *= s
         tmpvar += s

      tmpvar /= float((len(self) - 1))
      try:
         self.stats["rawDev"] = math_sqrt(tmpvar)
      except:
         self.stats["rawDev"] = 0.0

      self.stats["rawVar"] = tmpvar

      self.statted = True
def statistics ( self ) : if self . statted : return logging . debug ( "Running statistical calculations" ) raw_sum = 0 len_pop = len ( self ) for ind in xrange ( len_pop ) : raw_sum += self [ ind ] . score self . stats [ "rawMax" ] = max ( self , key = key_raw_score ) . score self . stats [ "rawMin" ] = min ( self , key = key_raw_score ) . score self . stats [ "rawAve" ] = raw_sum / float ( len_pop ) tmpvar = 0.0 for ind in xrange ( len_pop ) : s = self [ ind ] . score - self . stats [ "rawAve" ] s *= s tmpvar += s tmpvar /= float ( ( len ( self ) - 1 ) ) try : self . stats [ "rawDev" ] = math_sqrt ( tmpvar ) except : self . stats [ "rawDev" ] = 0.0 self . stats [ "rawVar" ] = tmpvar self . statted = True