code: def run_integrity_checks(
      vectors_magnitude, vectors_gensim, small_n=10, big_n=1000
  ):
      def _floats_equal(a, b):
          return abs(a - b) < 0.00001
  
      seed(0)  # Reproducible results
      small_i = [
          randint(0, len(vectors_magnitude) - 1) for i in range(small_n)
      ]
      big_i = [
          randint(0, len(vectors_magnitude) - 1) for i in range(big_n)
      ]
      small_keys = [vectors_magnitude[i][0] for i in small_i]
      big_keys = [vectors_magnitude[i][0] for i in big_i]
      print("==================================")
      print("Running integrity checks to make sure file is valid...")
      print("----------------------------------")
      print("Checking lengths are equal...")
      print(
          len(vectors_magnitude) == len(vectors_gensim.index2word),
          len(vectors_magnitude),
          len(vectors_gensim.index2word),
      )
      print("Checking dimensions are equal...")
      shape_1 = next(iter(vectors_magnitude))[1].shape
      shape_2 = vectors_gensim.vectors[0].shape
      print(shape_1 == shape_2, shape_1, shape_2)
      print("Checking %d random similarity calls..." % big_n)
      big_key_it = iter(big_keys)
      for i, key1 in enumerate(big_key_it):
          if i % 10 == 0:
              print("Progress: %d/%d" % (i, len(big_keys) / 2))
          key2 = next(big_key_it)
          result_1 = vectors_magnitude.similarity(key1, key2)
          result_2 = vectors_gensim.similarity(key1, key2)
          if not _floats_equal(result_1, result_2):
              print(
                  "Mismatched similarities (%f, %f) for keys: (%s, %s)"
                  % (result_1, result_2, key1, key2)
              )
      print("Checking analogy...")
      results_1 = vectors_magnitude.most_similar(
          positive=["king", "woman"], negative=["man"]
      )
      results_2 = vectors_gensim.most_similar(
          positive=["king", "woman"], negative=["man"]
      )
      print(results_1)
      print(results_2)
      print("Checking 3cosmul analogy...")
      results_1 = vectors_magnitude.most_similar_cosmul(
          positive=["king", "woman"], negative=["man"]
      )
      results_2 = vectors_gensim.most_similar_cosmul(
          positive=["king", "woman"], negative=["man"]
      )
      print(results_1)
      print(results_2)
      print("Checking %d random most_similar calls..." % small_n)
      for key in small_keys:
          results_1 = vectors_magnitude.most_similar(key)
          results_2 = vectors_gensim.most_similar(key)
          if len(results_1) == len(results_2):
              broken = False
              for result_1, result_2 in zip(results_1, results_2):
                  if result_1[0] != result_2[0] or not _floats_equal(
                      result_1[1], result_2[1]
                  ):
                      broken = True
              if broken:
                  print("--------------------------------")
                  print("Mismatched results for key: %s" % key)
                  print(results_1)
                  print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
                  print(results_2)
                  print("--------------------------------")
              else:
                  print(not broken)
          else:
              print(
                  "Lengths (%d, %d) not equal for key %s.",
                  len(results_1),
                  len(results_2),
                  key,
              )
      print("==================================")
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import gc
  import random
  import sys
  import time
  import tempfile
  from functools import partial
  from sys import platform
  from random import seed, randint
  from itertools import islice
  from gensim.models import KeyedVectors
  from pymagnitude import Magnitude
label_desc: Use image node_id 6 for calling a global function with example usage: run_integrity_checks(vectors_magnitude, vectors_gensim, small_n, big_n) and returns: unknown