[demo] Use kmeans instead of kdtree (for testing)
authorSimon Chabot <simon.chabot@logilab.fr>
Thu, 08 Nov 2012 13:25:20 +0100
changeset 95 8a13d62cd8ff
parent 94 12123af1815e
child 96 0a63b9d4024e
[demo] Use kmeans instead of kdtree (for testing)
demo.py
--- a/demo.py	Thu Nov 08 13:24:41 2012 +0100
+++ b/demo.py	Thu Nov 08 13:25:20 2012 +0100
@@ -91,8 +91,9 @@
     alignset = parsefile(path.join(DEMODIR, 'demo', 'frenchbnf'), indexes=[0, 2, (14, 12)],
                          nbmax=30000)
 
-    neighbors = findneighbours(alignset, targetset, indexes=(2, 2),
-                               mode='kdtree', threshold=0.1)
+    print "Finding neighbours"
+    neighbours = findneighbours(alignset, targetset, indexes=(2, 2),
+                               mode='kmeans', threshold=0.1)
 
     # Let's define the treatements to apply on the location's name
     tr_name = { 'normalization': [lambda x: str(x),#Some names are casted to
@@ -105,7 +106,7 @@
               }
 
     print "Start computation"
-    for ind, nei in enumerate(neighbors):
+    for ind, nei in enumerate(neighbours):
         m, b = align([alignset[ind][:2]],      # The dataset to align
               [targetset[i][:2] for i in nei], # The target dataset
               [tr_name],