Mercurial > hg > nsaunier > traffic-intelligence
comparison python/events.py @ 436:b64ff7fe7b45
corrected clustering bug (in indicator assignment)
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 08 Jan 2014 02:56:12 -0500 |
| parents | fb3654a9127d |
| children | cd342a774806 |
comparison
equal
deleted
inserted
replaced
| 435:17185fe77316 | 436:b64ff7fe7b45 |
|---|---|
| 184 # assignment | 184 # assignment |
| 185 labels = [-1]*similarityMatrix.shape[0] | 185 labels = [-1]*similarityMatrix.shape[0] |
| 186 indices = [i for i in range(similarityMatrix.shape[0]) if i not in prototypeIndices] | 186 indices = [i for i in range(similarityMatrix.shape[0]) if i not in prototypeIndices] |
| 187 for i in prototypeIndices: | 187 for i in prototypeIndices: |
| 188 labels[i] = i | 188 labels[i] = i |
| 189 for i in indices[1:]: | 189 for i in indices: |
| 190 prototypeIndex = similarityMatrix[i][prototypeIndices].argmax() | 190 prototypeIndex = similarityMatrix[i][prototypeIndices].argmax() |
| 191 labels[i] = prototypeIndices[prototypeIndex] | 191 labels[i] = prototypeIndices[prototypeIndex] |
| 192 | 192 |
| 193 return prototypeIndices, labels | 193 return prototypeIndices, labels |
| 194 | 194 |
