diff 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
line wrap: on
line diff
--- a/python/tests/storage.txt	Tue May 31 17:07:23 2016 -0400
+++ b/python/tests/storage.txt	Thu Jun 09 15:36:21 2016 -0400
@@ -75,3 +75,18 @@
 '# asdlfjasdlkj0'
 >>> readline(strio, '%#')
 'sadlkfjsdlakjf'
+
+>>> from sklearn.mixture import GMM
+>>> from numpy.random import random_sample
+>>> nPoints = 50
+>>> points = random_sample(nPoints*2).reshape(nPoints,2)
+>>> gmm = GMM(4, covariance_type = 'full')
+>>> tmp = gmm.fit(points)
+>>> id = 0
+>>> savePOIs('pois-tmp.sqlite', gmm, 'end', id)
+>>> reloadedGmm = loadPOIs('pois-tmp.sqlite')
+>>> sum(gmm.predict(points) == reloadedGmm[id].predict(points)) == nPoints
+True
+>>> reloadedGmm[id].gmmTypes[0] == 'end'
+True
+>>> remove('pois-tmp.sqlite')