Mercurial Hosting > traffic-intelligence
diff python/ml.py @ 913:1cd878812529
work in progress
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 28 Jun 2017 17:57:06 -0400 |
parents | b297525b2cbf |
children | f228fd649644 |
line wrap: on
line diff
--- a/python/ml.py Wed Jun 28 16:51:17 2017 -0400 +++ b/python/ml.py Wed Jun 28 17:57:06 2017 -0400 @@ -266,12 +266,11 @@ print('Mean overall similarity: {}'.format((similarities[cluster][:,cluster].sum()+n)/(n*(n-1)))) # Gaussian Mixture Models -def plotGMMClusters(model, dataset = None, fig = None, colors = utils.colors, nUnitsPerPixel = 1., alpha = 0.3): +def plotGMMClusters(model, labels, dataset = None, fig = None, colors = utils.colors, nUnitsPerPixel = 1., alpha = 0.3): '''plot the ellipse corresponding to the Gaussians and the predicted classes of the instances in the dataset''' if fig is None: fig = plt.figure() - labels = model.predict(dataset) tmpDataset = dataset/nUnitsPerPixel for i in xrange(model.n_components): mean = model.means_[i]/nUnitsPerPixel @@ -289,4 +288,3 @@ ell.set_clip_box(fig.bbox) ell.set_alpha(alpha) fig.axes[0].add_artist(ell) - return labels