docstr: Tests the case where we use (multiple rounds of) LSH bucketing.
docstr_tok: ["Tests","the","case","where","we","use","(","multiple","rounds","of",")","LSH","bucketing","."]
code: def testBuildGraphWithThresholdWithLSHSufficientLSHRounds(self):
      """Tests the case where we use (multiple rounds of) LSH bucketing."""
      # Construct the embeddings and write them to a file.
      num_points = 20
      (embeddings, adjacent_similarity) = self._build_test_embeddings(
          num_points
      )
      embedding_path = self._create_embedding_file()
      write_embeddings(embeddings, embedding_path)
  
      # Build the graph, and read the results into a dictionary.
      graph_path = self._create_graph_file()
      build_graph_lib.build_graph(
          [embedding_path],
          graph_path,
          similarity_threshold=0.9,
          lsh_splits=2,
          lsh_rounds=4,
          random_seed=12345,
      )
      self.assertEqual(self._num_file_lines(graph_path), num_points * 2)
      g_actual = graph_utils.read_tsv_graph(graph_path)
  
      # Constuct the expected graph: each point should be a neighbor of the
      # point before it and the point after it in the 'embeddings' sequence.
      # That's because the cosine similarity of adjacent points is ~0.951057,
      # while between every other point it is ~0.809017 (which is below the
      # similarity threshold of 0.9).
      g_expected = {}
      for node_id in range(num_points):
          t_dict = g_expected.setdefault("id_{}".format(node_id), {})
          t_dict[
              "id_{}".format((node_id - 1) % num_points)
          ] = adjacent_similarity
          t_dict[
              "id_{}".format((node_id + 1) % num_points)
          ] = adjacent_similarity
      self.assertDictEqual(g_actual, g_expected)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import cmath
  from absl.testing import absltest
  from neural_structured_learning.tools import build_graph
  from neural_structured_learning.tools import graph_utils
  import six
  import tensorflow
  from google.protobuf import text_format
label_desc: Use image node_id 10 for calling the BuildGraphTest obj's underlying member method code with example usage: obj.testBuildGraphWithThresholdWithLSHSufficientLSHRounds() without return types