Mercurial Hosting > traffic-intelligence
comparison python/ml.py @ 738:2472b4d59aea dev
small function
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 14 Aug 2015 17:45:45 -0400 |
parents | 0e875a7f5759 |
children | 1f2b2d1f4fbf |
comparison
equal
deleted
inserted
replaced
737:fb60b54e1041 | 738:2472b4d59aea |
---|---|
174 if assign: | 174 if assign: |
175 prototypeIndices.remove(smallestClusterIndex) | 175 prototypeIndices.remove(smallestClusterIndex) |
176 indices.append(smallestClusterIndex) | 176 indices.append(smallestClusterIndex) |
177 | 177 |
178 return prototypeIndices, labels | 178 return prototypeIndices, labels |
179 | |
180 def computeClusterSizes(labels, prototypeIndices, outlierIndex = -1): | |
181 clusterSizes = {i: sum(np.array(labels) == i) for i in prototypeIndices} | |
182 clusterSizes['outlier'] = sum(np.array(labels) == -1) | |
183 return clusterSizes |