1   package net.obsearch.index.knngraph;
2   
3   import java.util.ArrayList;
4   
5   import net.obsearch.example.OBSlice;
6   import net.obsearch.example.OBSliceFactory;
7   import net.obsearch.index.knngraph.impl.KnnGraphShort;
8   import net.obsearch.index.utils.IndexSmokeTUtil;
9   import net.obsearch.index.utils.IndexSmokeTUtilApprox;
10  import net.obsearch.pivots.AcceptAll;
11  import net.obsearch.pivots.bustos.impl.IncrementalBustosNavarroChavezShort;
12  import net.obsearch.pivots.dummy.IncrementalDummyPivotSelector;
13  
14  import net.obsearch.storage.bdb.BDBFactoryJe;
15  import net.obsearch.storage.bdb.Utils;
16  
17  import org.junit.Test;
18  
19  
20  public class TestKnnGraph {
21  	
22  	@Test
23  	public void testPrimeTree() throws Exception {
24          
25  	      //IncrementalKMeansPPPivotSelectorShort<OBSlice> sel = new IncrementalKMeansPPPivotSelectorShort<OBSlice>(new AcceptAll());
26  	       IncrementalDummyPivotSelector<OBSlice> sel = new IncrementalDummyPivotSelector<OBSlice> ();
27  	       //
28  	       
29  	       //IncrementalBustosNavarroChavezShort<OBSlice> sel = new IncrementalBustosNavarroChavezShort<OBSlice>(new AcceptAll(),
30  	        //        100, 100);
31  	        //IncrementalFixedPivotSelector sel = new IncrementalFixedPivotSelector();
32  	       BDBFactoryJe fact = Utils.getFactoryJe();
33  	        //BDBFactoryDb fact = Utils.getFactoryDb();
34  	        //OBLFactory fact = Utils.getFactoryL();
35  
36  	        KnnGraphShort<OBSlice> knn = new KnnGraphShort<OBSlice>(OBSlice.class, sel, 32, 40, (short)500, 30);
37  	        // k = 25, 10 seeds. Increasing k improves things a lot!
38  	        // 2.4 for range 3 (1 / 1000)
39  	        // 4 for  range 20
40  	        knn.setT(3.0f);
41  	        knn.init(fact);
42  	        knn.setSeeds(30);
43  	        IndexSmokeTUtilApprox<OBSlice> t = new IndexSmokeTUtilApprox<OBSlice>(new OBSliceFactory());
44  	        t.tIndex(knn);
45  
46  	        //logger.info("Boxes per search: " + d.totalBoxAccess/ d.queryCount);
47  	        //logger.info("Query count: " + d.queryCount);
48  	        //logger.info("Total boxes: " +d.searchedBoxesTotal);        
49  	        //logger.info("Smap records: " + d.smapRecordsCompared);
50  	        //logger.info("Distance computations: " + d.distanceComputations);
51  	        
52  	        // best 15 1.4 20 seeds
53  	        
54  	        
55  	        
56  	        
57  	    }
58  
59  }