Skip to content
Snippets Groups Projects
Commit 69435702 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Added more unit tests

parent 112a753a
No related branches found
No related tags found
No related merge requests found
...@@ -75,7 +75,6 @@ def test_KMeansMachine(): ...@@ -75,7 +75,6 @@ def test_KMeansMachine():
def test_KMeansMachine2(): def test_KMeansMachine2():
print "Computing"
kmeans = bob.learn.misc.KMeansMachine(2,2) kmeans = bob.learn.misc.KMeansMachine(2,2)
kmeans.means = numpy.array([[1.2,1.3],[0.2,-0.3]]) kmeans.means = numpy.array([[1.2,1.3],[0.2,-0.3]])
...@@ -86,16 +85,14 @@ def test_KMeansMachine2(): ...@@ -86,16 +85,14 @@ def test_KMeansMachine2():
[0.3,0.2], [0.3,0.2],
[0.2,0] [0.2,0]
]) ])
print "Computing"
variances, weights = kmeans.get_variances_and_weights_for_each_cluster(data) variances, weights = kmeans.get_variances_and_weights_for_each_cluster(data)
print "Computed"
variances_result = numpy.array([[ 0.01,1.], variances_result = numpy.array([[ 0.01,1.],
[ 0.01555556 ,0.00888889]]) [ 0.01555556, 0.00888889]])
weights_result = numpy.array([ 0.4, 0.6]) weights_result = numpy.array([ 0.4, 0.6])
assert True assert equals(weights_result,weights, 1e-3)
assert equals(variances_result,variances,1e-3)
#assert weights_result == weights
#assert variances_result == variances
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment