Mercurial > hg > nsaunier > traffic-intelligence
comparison scripts/learn-poi.py @ 998:933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Sun, 27 May 2018 23:22:48 -0400 |
| parents | c030f735c594 |
| children | cc5cb04b04b0 |
comparison
equal
deleted
inserted
replaced
| 997:4f3387a242a1 | 998:933670761a57 |
|---|---|
| 1 #! /usr/bin/env python | 1 #! /usr/bin/env python3 |
| 2 | 2 |
| 3 import argparse | 3 import argparse |
| 4 | 4 |
| 5 import numpy as np | 5 import numpy as np |
| 6 from sklearn import mixture | 6 from sklearn import mixture |
| 76 gmmId += 1 | 76 gmmId += 1 |
| 77 | 77 |
| 78 if args.assign: | 78 if args.assign: |
| 79 storage.savePOIAssignments(args.databaseFilename, objects) | 79 storage.savePOIAssignments(args.databaseFilename, objects) |
| 80 if args.displayPaths: | 80 if args.displayPaths: |
| 81 for i in xrange(args.nOriginClusters): | 81 for i in range(args.nOriginClusters): |
| 82 for j in xrange(args.nDestinationClusters): | 82 for j in range(args.nDestinationClusters): |
| 83 odObjects = [o for o in objects if o.od[0] == i and o.od[1] == j] | 83 odObjects = [o for o in objects if o.od[0] == i and o.od[1] == j] |
| 84 if len(odObjects) > 0: | 84 if len(odObjects) > 0: |
| 85 fig = plt.figure() | 85 fig = plt.figure() |
| 86 ax = fig.add_subplot(111) | 86 ax = fig.add_subplot(111) |
| 87 ml.plotGMM(models['beginning'].means_[i], models['beginning'].covariances_[i], i, fig, 'b') | 87 ml.plotGMM(models['beginning'].means_[i], models['beginning'].covariances_[i], i, fig, 'b') |
