Mercurial > hg > nsaunier > traffic-intelligence
comparison python/ml.py @ 636:3058e00887bc
removed all issues because of tests with None, using is instead of == or !=
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Tue, 24 Mar 2015 18:11:28 +0100 |
| parents | 39de5c532559 |
| children | 15e244d2a1b5 |
comparison
equal
deleted
inserted
replaced
| 635:6ae68383071e | 636:3058e00887bc |
|---|---|
| 69 from random import shuffle | 69 from random import shuffle |
| 70 from copy import copy, deepcopy | 70 from copy import copy, deepcopy |
| 71 localdata = copy(data) # shallow copy to avoid modifying data | 71 localdata = copy(data) # shallow copy to avoid modifying data |
| 72 if shuffleData: | 72 if shuffleData: |
| 73 shuffle(localdata) | 73 shuffle(localdata) |
| 74 if initialCentroids == None: | 74 if initialCentroids is None: |
| 75 centroids = [Centroid(localdata[0])] | 75 centroids = [Centroid(localdata[0])] |
| 76 else: | 76 else: |
| 77 centroids = deepcopy(initialCentroids) | 77 centroids = deepcopy(initialCentroids) |
| 78 for instance in localdata[1:]: | 78 for instance in localdata[1:]: |
| 79 i = 0 | 79 i = 0 |
