print('Silhouette with squared euclidean distance:') pdt = model.transform(final_data) from pyspark.ml.evaluation import ClusteringEvaluator evaluator = ClusteringEvaluator() silhouette = evaluator.evaluate(pdt) print(silhouette)