@@ 796-823 (lines=28) @@ | ||
793 | logging.getLogger().info(result) |
|
794 | assert len(result[0]) == 0 |
|
795 | ||
796 | def test_search_distance_superstructure_flat_index_B(self, connect, superstructure_collection): |
|
797 | ''' |
|
798 | target: search ip_collection, and check the result: distance |
|
799 | method: compare the return distance value with value computed with SUPER |
|
800 | expected: the return distance equals to the computed value |
|
801 | ''' |
|
802 | # from scipy.spatial import distance |
|
803 | top_k = 3 |
|
804 | nprobe = 512 |
|
805 | int_vectors, vectors, ids = self.init_binary_data(connect, superstructure_collection, nb=2) |
|
806 | index_type = IndexType.FLAT |
|
807 | index_param = { |
|
808 | "nlist": 16384 |
|
809 | } |
|
810 | connect.create_index(superstructure_collection, index_type, index_param) |
|
811 | logging.getLogger().info(connect.get_collection_info(superstructure_collection)) |
|
812 | logging.getLogger().info(connect.get_index_info(superstructure_collection)) |
|
813 | query_int_vectors, query_vecs = gen_binary_super_vectors(int_vectors, 2) |
|
814 | search_param = get_search_param(index_type) |
|
815 | status, result = connect.search(superstructure_collection, top_k, query_vecs, params=search_param) |
|
816 | logging.getLogger().info(status) |
|
817 | logging.getLogger().info(result) |
|
818 | assert len(result[0]) == 2 |
|
819 | assert len(result[1]) == 2 |
|
820 | assert result[0][0].id in ids |
|
821 | assert result[0][0].distance <= epsilon |
|
822 | assert result[1][0].id in ids |
|
823 | assert result[1][0].distance <= epsilon |
|
824 | ||
825 | def test_search_distance_tanimoto_flat_index(self, connect, tanimoto_collection): |
|
826 | ''' |
|
@@ 741-768 (lines=28) @@ | ||
738 | logging.getLogger().info(result) |
|
739 | assert len(result[0]) == 0 |
|
740 | ||
741 | def test_search_distance_substructure_flat_index_B(self, connect, substructure_collection): |
|
742 | ''' |
|
743 | target: search ip_collection, and check the result: distance |
|
744 | method: compare the return distance value with value computed with SUB |
|
745 | expected: the return distance equals to the computed value |
|
746 | ''' |
|
747 | # from scipy.spatial import distance |
|
748 | top_k = 3 |
|
749 | nprobe = 512 |
|
750 | int_vectors, vectors, ids = self.init_binary_data(connect, substructure_collection, nb=2) |
|
751 | index_type = IndexType.FLAT |
|
752 | index_param = { |
|
753 | "nlist": 16384 |
|
754 | } |
|
755 | connect.create_index(substructure_collection, index_type, index_param) |
|
756 | logging.getLogger().info(connect.get_collection_info(substructure_collection)) |
|
757 | logging.getLogger().info(connect.get_index_info(substructure_collection)) |
|
758 | query_int_vectors, query_vecs = gen_binary_sub_vectors(int_vectors, 2) |
|
759 | search_param = get_search_param(index_type) |
|
760 | status, result = connect.search(substructure_collection, top_k, query_vecs, params=search_param) |
|
761 | logging.getLogger().info(status) |
|
762 | logging.getLogger().info(result) |
|
763 | assert len(result[0]) == 1 |
|
764 | assert len(result[1]) == 1 |
|
765 | assert result[0][0].distance <= epsilon |
|
766 | assert result[0][0].id == ids[0] |
|
767 | assert result[1][0].distance <= epsilon |
|
768 | assert result[1][0].id == ids[1] |
|
769 | ||
770 | def test_search_distance_superstructure_flat_index(self, connect, superstructure_collection): |
|
771 | ''' |