Mercurial > hg > nsaunier > traffic-intelligence
comparison python/tests/storage.txt @ 805:180b6b0231c0
added saving/loading points of interests
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Thu, 09 Jun 2016 15:36:21 -0400 |
| parents | 1b22d81ef5ff |
| children | 119c4efe6398 |
comparison
equal
deleted
inserted
replaced
| 801:c5f98916297e | 805:180b6b0231c0 |
|---|---|
| 73 >>> strio = StringIO('# asdlfjasdlkj0\nsadlkfjsdlakjf') | 73 >>> strio = StringIO('# asdlfjasdlkj0\nsadlkfjsdlakjf') |
| 74 >>> readline(strio, '%*$') | 74 >>> readline(strio, '%*$') |
| 75 '# asdlfjasdlkj0' | 75 '# asdlfjasdlkj0' |
| 76 >>> readline(strio, '%#') | 76 >>> readline(strio, '%#') |
| 77 'sadlkfjsdlakjf' | 77 'sadlkfjsdlakjf' |
| 78 | |
| 79 >>> from sklearn.mixture import GMM | |
| 80 >>> from numpy.random import random_sample | |
| 81 >>> nPoints = 50 | |
| 82 >>> points = random_sample(nPoints*2).reshape(nPoints,2) | |
| 83 >>> gmm = GMM(4, covariance_type = 'full') | |
| 84 >>> tmp = gmm.fit(points) | |
| 85 >>> id = 0 | |
| 86 >>> savePOIs('pois-tmp.sqlite', gmm, 'end', id) | |
| 87 >>> reloadedGmm = loadPOIs('pois-tmp.sqlite') | |
| 88 >>> sum(gmm.predict(points) == reloadedGmm[id].predict(points)) == nPoints | |
| 89 True | |
| 90 >>> reloadedGmm[id].gmmTypes[0] == 'end' | |
| 91 True | |
| 92 >>> remove('pois-tmp.sqlite') |
