code: def test_clustering(self):
      d = 64
      n = 1000
      rs = np.random.RandomState(123)
      x = rs.uniform(size=(n, d)).astype("float32")
  
      x *= 10
  
      km = faiss.Kmeans(d, 32, niter=10)
      err32 = km.train(x)
  
      # check that objective is decreasing
      prev = 1e50
      for o in km.obj:
          self.assertGreater(prev, o)
          prev = o
  
      km = faiss.Kmeans(d, 64, niter=10)
      err64 = km.train(x)
  
      # check that 64 centroids give a lower quantization error than 32
      self.assertGreater(err32, err64)
  
      km = faiss.Kmeans(d, 32, niter=10, int_centroids=True)
      err_int = km.train(x)
  
      # check that integer centoids are not as good as float ones
      self.assertGreater(err_int, err32)
      self.assertTrue(np.all(km.centroids == np.floor(km.centroids)))
  
imports: from __future__ import absolute_import, division, print_function
  import numpy
  import faiss
  import unittest
  import array
  from common_faiss_tests import get_dataset_2
label_desc: Use image node_id 1 for calling the TestClustering obj's underlying member method code with example usage: obj.test_clustering() without return types