Mercurial Hosting > traffic-intelligence
comparison trafficintelligence/tests/storage.txt @ 1200:4356065ed3ca
updated simple moving average filter and cleaned tests
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 08 Dec 2022 10:24:22 -0500 |
parents | 8734742c08c0 |
children |
comparison
equal
deleted
inserted
replaced
1199:6a6a4d5958f7 | 1200:4356065ed3ca |
---|---|
7 >>> f = openCheck('non_existant_file.txt') | 7 >>> f = openCheck('non_existant_file.txt') |
8 File non_existant_file.txt could not be opened. | 8 File non_existant_file.txt could not be opened. |
9 | 9 |
10 >>> nonexistentFilename = "nonexistent" | 10 >>> nonexistentFilename = "nonexistent" |
11 >>> loadTrajectoriesFromSqlite(nonexistentFilename, 'feature') | 11 >>> loadTrajectoriesFromSqlite(nonexistentFilename, 'feature') |
12 Impossible to load from non-existing file nonexistent | |
12 [] | 13 [] |
13 | 14 |
14 >>> o1 = MovingObject.generate(2, Point(0.,0.), Point(1.,0.), TimeInterval(0,10)) | 15 >>> o1 = MovingObject.generate(2, Point(0.,0.), Point(1.,0.), TimeInterval(0,10)) |
15 >>> o2 = MovingObject.generate(3, Point(1.,1.), Point(-0.5,-0.2), TimeInterval(0,9)) | 16 >>> o2 = MovingObject.generate(3, Point(1.,1.), Point(-0.5,-0.2), TimeInterval(0,9)) |
16 >>> saveTrajectoriesToSqlite('test.sqlite', [o1, o2], 'feature') | 17 >>> saveTrajectoriesToSqlite('test.sqlite', [o1, o2], 'feature') |
114 | 115 |
115 >>> from sklearn.mixture import GaussianMixture | 116 >>> from sklearn.mixture import GaussianMixture |
116 >>> from numpy.random import random_sample | 117 >>> from numpy.random import random_sample |
117 >>> nPoints = 50 | 118 >>> nPoints = 50 |
118 >>> points = random_sample(nPoints*2).reshape(nPoints,2) | 119 >>> points = random_sample(nPoints*2).reshape(nPoints,2) |
119 >>> gmm = GaussianMixture(4, covariance_type = 'full') | 120 >>> gmm = GaussianMixture(n_components = 4, covariance_type = 'full') |
120 >>> tmp = gmm.fit(points) | 121 >>> tmp = gmm.fit(points) |
121 >>> gmmId = 0 | 122 >>> gmmId = 0 |
122 >>> savePOIsToSqlite('pois-tmp.sqlite', gmm, 'end', gmmId) | 123 >>> savePOIsToSqlite('pois-tmp.sqlite', gmm, 'end', gmmId) |
123 >>> reloadedGmm = loadPOIsFromSqlite('pois-tmp.sqlite') | 124 >>> reloadedGmm = loadPOIsFromSqlite('pois-tmp.sqlite') |
124 >>> sum(gmm.predict(points) == reloadedGmm[gmmId].predict(points)) == nPoints | 125 >>> sum(gmm.predict(points) == reloadedGmm[gmmId].predict(points)) == nPoints |