code: def test_progressive_dim(self):
      d = 32
      n = 10000
      k = 50
      xt, _, _ = get_dataset_2(d, n, 0, 0)
  
      # basic kmeans
      kmeans = faiss.Kmeans(d, k)
      kmeans.train(xt)
  
      clus = faiss.ProgressiveDimClustering(d, k)
      clus.verbose
      clus.verbose = True
      clus.progressive_dim_steps
      clus.progressive_dim_steps = 5
      fac = faiss.ProgressiveDimIndexFactory()
      clus.train(n, faiss.swig_ptr(xt), fac)
  
      stats = clus.iteration_stats
      stats = [stats.at(i) for i in range(stats.size())]
      obj = np.array([st.obj for st in stats])
      # clustering objective should be a tad better
      self.assertLess(obj[-1], kmeans.obj[-1])
  
      # same test w/ Kmeans wrapper
      kmeans2 = faiss.Kmeans(d, k, progressive_dim_steps=5)
      kmeans2.train(xt)
      self.assertLess(kmeans2.obj[-1], kmeans.obj[-1])
  
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 3 for calling the TestCompositeClustering obj's underlying member method code with example usage: obj.test_progressive_dim() without return types