code: def k_means_clustering(opytimizer):
      # Gathers params
      n_clusters = int(opytimizer[0][0])
  
      # Instanciating an KMeans class
      kmeans = KMeans(n_clusters=n_clusters, random_state=1).fit(X)
  
      # Gathers predicitions
      preds = kmeans.labels_
  
      # Calculates adjusted rand index
      ari = metrics.adjusted_rand_score(Y, preds)
  
      return 1 - ari
  
file_path: opytimizer/examples/integrations/sklearn/k_means_clustering.py
imports: import numpy
  from sklearn import metrics
  from sklearn.cluster import KMeans
  from sklearn.datasets import load_digits
  from opytimizer import Opytimizer
  from opytimizer.core import Function
  from opytimizer.optimizers.swarm import PSO
  from opytimizer.spaces import SearchSpace
label_desc: Use image node_id 1 for calling a global function with example usage: k_means_clustering(opytimizer) and returns: unknown