Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
normalize a counter by dividing each value by the sum of all values

        def normalize(counter):
   """
   normalize a counter by dividing each value by the sum of all values
   """
   counter = Counter(counter)
   normalizedCounter = Counter()
   total = float(counter.totalCount())
   for key in counter.keys():
       value = counter[key]
       normalizedCounter[key] = value / total
   return normalizedCounter
        


src/s/p/splitta-HEAD/sbd.py   splitta(Download)
                probs[label] *= self.feats[key]
 
        probs = sbd_util.normalize(probs)
        return probs[1]