code: def templateMaxAllocatedClusters(
      ccore_flag, amount_clusters, size_cluster, offset, kinitial, kmax
  ):
      input_data = []
      for index in range(amount_clusters):
          for _ in range(size_cluster):
              input_data.append(
                  [
                      random.random() * index * offset,
                      random.random() * index * offset,
                  ]
              )
  
      initial_centers = random_center_initializer(
          input_data, kinitial
      ).initialize()
      xmeans_instance = xmeans(
          input_data,
          initial_centers,
          kmax,
          0.025,
          splitting_type.BAYESIAN_INFORMATION_CRITERION,
          ccore_flag,
      )
      xmeans_instance.process()
  
      clusters = xmeans_instance.get_clusters()
      centers = xmeans_instance.get_centers()
  
      if len(clusters) != len(centers):
          print(input_data)
          print(initial_centers)
  
      assertion.ge(kmax, len(clusters))
      assertion.ge(kmax, len(centers))
      assertion.eq(len(clusters), len(centers))
  
file_path: pyclustering/pyclustering/cluster/tests/xmeans_templates.py
imports: import numpy
  import random
  from pyclustering.cluster.xmeans import xmeans, splitting_type
  from pyclustering.cluster.center_initializer import random_center_initializer
  from pyclustering.samples.definitions import SIMPLE_SAMPLES
  from pyclustering.utils import read_sample, distance_metric, type_metric
  from pyclustering.tests.assertion import assertion
label_desc: Use image node_id 4 for calling the XmeansTestTemplates obj's underlying member method code with example usage: obj.templateMaxAllocatedClusters(ccore_flag, amount_clusters, size_cluster, offset, kinitial, kmax) without return types