code: def transform(self, X):
      if self._kmeans is None:
          raise AutoMLException("KMeans not fitted")
  
      # scale
      X_scaled = self._scale.transform(X[self._input_columns])
  
      # kmeans
      distances = self._kmeans.transform(X_scaled)
      clusters = self._kmeans.predict(X_scaled)
  
      X[self._new_features[:-1]] = distances
      X[self._new_features[-1]] = clusters
  
      return X
  
file_path: mljar-supervised/supervised/preprocessing/kmeans_transformer.py
imports: import datetime
  import json
  import os
  import time
  import joblib
  import numpy
  import pandas
  from sklearn.cluster import MiniBatchKMeans
  from sklearn.preprocessing import StandardScaler
  from supervised.exceptions import AutoMLException
label_desc: Use image node_id 4 for calling the KMeansTransformer obj's underlying member method code with example usage: obj.transform(X) and returns: X