Mercurial > hg > nsaunier > traffic-intelligence
comparison python/ml.py @ 914:f228fd649644
corrected bugs in learn-pois.py
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 28 Jun 2017 23:43:52 -0400 |
| parents | 1cd878812529 |
| children | 13434f5017dd |
comparison
equal
deleted
inserted
replaced
| 913:1cd878812529 | 914:f228fd649644 |
|---|---|
| 272 if fig is None: | 272 if fig is None: |
| 273 fig = plt.figure() | 273 fig = plt.figure() |
| 274 tmpDataset = dataset/nUnitsPerPixel | 274 tmpDataset = dataset/nUnitsPerPixel |
| 275 for i in xrange(model.n_components): | 275 for i in xrange(model.n_components): |
| 276 mean = model.means_[i]/nUnitsPerPixel | 276 mean = model.means_[i]/nUnitsPerPixel |
| 277 covariance = model.covars_[i]/nUnitsPerPixel | 277 covariance = model.covariances_[i]/nUnitsPerPixel |
| 278 if dataset is not None: | 278 if dataset is not None: |
| 279 plt.scatter(tmpDataset[labels == i, 0], tmpDataset[labels == i, 1], .8, color=colors[i]) | 279 plt.scatter(tmpDataset[labels == i, 0], tmpDataset[labels == i, 1], .8, color=colors[i]) |
| 280 plt.annotate(str(i), xy=(mean[0]+1, mean[1]+1)) | 280 plt.annotate(str(i), xy=(mean[0]+1, mean[1]+1)) |
| 281 | 281 |
| 282 # Plot an ellipse to show the Gaussian component | 282 # Plot an ellipse to show the Gaussian component |
