Build() public method

public Build ( string listname, int qsize, int symsize ) : void
listname string
qsize int
symsize int
return void
Esempio n. 1
0
File: Main.cs Progetto: vfaby/natix
 public void TestLSH_Audio()
 {
     var name = "hamming-files.list.audio.bin";
     var source = "hamming-files.list";
     AudioSpace db0 = null;
     if (!File.Exists (name)) {
         db0 = new AudioSpace();
         db0.Build(source, 30, 3);
         SpaceGenericIO.Save (name, db0, false);
     }
     var db = SpaceGenericIO.Load (name, false);
     if (db0 != null) {
         this.AssertEqualityDB (db0, db);
         db0 = null;
     }
     this.TestLSC_H8(db, name, "queries-hamming");
 }
Esempio n. 2
0
        public static void testLSHV(string listname, string qlist, int Q, int S)
        {
            int porcen=0;
            int numconsult=0;
            Console.WriteLine("<-- Building LSH Multiple Tables -->");
            string indexName = string.Format("Index.LSC.Prueba.xml");
            HammingMLSC I;
            if (!File.Exists(indexName)) {
                I = new HammingMLSC();
                I.SeqBuilder = SequenceBuilders.GetSeqXLB_SArray64 (16);
                if (! (File.Exists(listname + ".header"))) {
                    var A = new AudioSpace();
                    A.Build(listname, 30*3, 3);
                }
                I.Build(indexName,"audio-space",listname,20,1);
            }
            I = IndexLoader.Load(indexName) as HammingMLSC;

            Console.WriteLine("<-- Searching first object -->");
            var aspace = (AudioSpace)I.MainSpace;
            Chronos tiempo = new Chronos();

            foreach (var qname in (new QueryStream(qlist)).Iterate()) {
                numconsult++;
                Console.WriteLine ("<<<--- Inizializing query --->>>");
                tiempo.Start();
                var R = SearchAudio (qname, aspace,I);
                tiempo.End();

                if(R.Count>0){
                    porcen++;
                }
                Console.WriteLine ("qname: {0}",qname.QRaw);
                tiempo.PrintStats("****Tiempo de consulta****");

                var qext = BinaryHammingSpace.ParseAndLoadFromFile(qname.QRaw,false);

                foreach ( var p in R){
                    Console.WriteLine ("docid: {0}, dist: {1}, name: {2}",p.docid, p.dist, aspace.GetNameFromDocId(p.docid));
                    var audio = aspace.GetAudio(p.docid);
                    var distanciaHamming = BinaryHammingSpace.DistMinHamming(audio,qext,aspace.SymbolSize);
                    Console.WriteLine ("***********DocId:  {0}, Distancia BinaryHamming: {1}***************",p.docid, distanciaHamming);
                    Console.WriteLine ("***********Error: {0}%",distanciaHamming/(qext.Count/aspace.SymbolSize * 24)*100);
                }
                Console.WriteLine ("<<<--- Finalizing query --->>>");
            }

            Console.WriteLine("Porcentaje de respuesta: {0}%",porcen*100/numconsult);
        }