Examples of NearestNeighborSearcher


Examples of org.fastlsh.query.NearestNeighborSearcher

        IndexReader idxReader = new IndexReader(output);
        idxReader.initializeSignatures();
        PermutationIndexWriter permWriter = new PermutationIndexWriter(output, idxReader.signatures, options);
        permWriter.createIndex();
        idxReader = null;
        NearestNeighborSearcher searcher = new NearestNeighborSearcher(output);
        int beamWidth = 10;
        double minScore = .7;
        long [] targetIds = new long []{1,2,3,4,5,6,7,8,9};

        Comparator<Neighbor> comparator = new Neighbor.DissimilarityComparator();
        ScoreThreshold thresh = new L2Threshold(minScore);
        for(long id : targetIds)
        {
            Neighbor [] sims = searcher.getScoredNeighbors(id, beamWidth, options.numPermutations, -1, comparator, thresh);
            Assert.assertTrue(containsId(id, sims));
        }

        IndexUtils.delete(new File(input));
    }
View Full Code Here

Examples of org.fastlsh.query.NearestNeighborSearcher

        IndexReader idxReader = new IndexReader(output);
        idxReader.initializeSignatures();
        PermutationIndexWriter permWriter = new PermutationIndexWriter(output, idxReader.signatures, options);
        permWriter.createIndex();
        idxReader = null;
        NearestNeighborSearcher searcher = new NearestNeighborSearcher(output);
        int beamWidth = 10;
        double minSimilarity = 0.2;
        long [] targetIds = new long []{1,2,3,4,5,6,7,8,9};

        Comparator<Neighbor> comparator = new Neighbor.SimilarityComparator();
        ScoreThreshold thresh = new CosineSimilarityThreshold(minSimilarity);
        TLongObjectHashMap<Neighbor []> allSims = new TLongObjectHashMap<Neighbor []>();
        for(long id : targetIds)
        {
            Neighbor [] sims = searcher.getScoredNeighbors(id, beamWidth, options.numPermutations, Integer.MAX_VALUE, comparator, thresh);
            if(sims != null) allSims.put(id, sims);
            Assert.assertTrue(containsId(id, sims));
        }

//        IndexUtils.delete(new File(input));
View Full Code Here

Examples of org.fastlsh.query.NearestNeighborSearcher

        IndexReader idxReader = new IndexReader(output);
        idxReader.initializeSignatures();
        PermutationIndexWriter permWriter = new PermutationIndexWriter(output, idxReader.signatures, options);
        permWriter.createIndex();
        idxReader = null;
        NearestNeighborSearcher searcher = new NearestNeighborSearcher(output);
        int beamWidth = 10;
        double maxDistance = 100;
        long [] targetIds = new long []{1,2,3,4,5,6,7,8,9};

        Comparator<Neighbor> comparator = new Neighbor.DissimilarityComparator();
        ScoreThreshold thresh = new L2Threshold(maxDistance);
        TLongObjectHashMap<Neighbor []> allSims = new TLongObjectHashMap<Neighbor []>();
        for(long id : targetIds)
        {
            Neighbor [] sims = searcher.getScoredNeighbors(id, beamWidth, options.numPermutations, 20, comparator, thresh);
            if(sims != null) allSims.put(id, sims);
            Assert.assertTrue(containsId(id, sims));
        }

//        IndexUtils.delete(new File(input));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.