Mercurial > hg > nsaunier > traffic-intelligence
comparison python/tests/storage.txt @ 871:6db83beb5350
work in progress to update gaussian mixtures
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Fri, 03 Feb 2017 16:26:18 -0500 |
| parents | 119c4efe6398 |
| children | c70adaeeddf5 |
comparison
equal
deleted
inserted
replaced
| 870:1535251a1f40 | 871:6db83beb5350 |
|---|---|
| 84 >>> readline(strio, '%*$') | 84 >>> readline(strio, '%*$') |
| 85 '# asdlfjasdlkj0' | 85 '# asdlfjasdlkj0' |
| 86 >>> readline(strio, '%#') | 86 >>> readline(strio, '%#') |
| 87 'sadlkfjsdlakjf' | 87 'sadlkfjsdlakjf' |
| 88 | 88 |
| 89 >>> from sklearn.mixture import GMM | 89 >>> from sklearn.mixture import GaussianMixture |
| 90 >>> from numpy.random import random_sample | 90 >>> from numpy.random import random_sample |
| 91 >>> nPoints = 50 | 91 >>> nPoints = 50 |
| 92 >>> points = random_sample(nPoints*2).reshape(nPoints,2) | 92 >>> points = random_sample(nPoints*2).reshape(nPoints,2) |
| 93 >>> gmm = GMM(4, covariance_type = 'full') | 93 >>> gmm = GaussianMixture(4, covariance_type = 'full') |
| 94 >>> tmp = gmm.fit(points) | 94 >>> tmp = gmm.fit(points) |
| 95 >>> id = 0 | 95 >>> id = 0 |
| 96 >>> savePOIs('pois-tmp.sqlite', gmm, 'end', id) | 96 >>> savePOIs('pois-tmp.sqlite', gmm, 'end', id) |
| 97 >>> reloadedGmm = loadPOIs('pois-tmp.sqlite') | 97 >>> reloadedGmm = loadPOIs('pois-tmp.sqlite') |
| 98 >>> sum(gmm.predict(points) == reloadedGmm[id].predict(points)) == nPoints | 98 >>> sum(gmm.predict(points) == reloadedGmm[id].predict(points)) == nPoints |
