Github user yanboliang commented on a diff in the pull request:
https://github.com/apache/spark/pull/19204#discussion_r139312388
--- Diff: python/pyspark/ml/evaluation.py ---
@@ -328,6 +329,86 @@ def setParams(self, predictionCol="prediction",
labelCol="label",
kwargs = self._input_kwargs
return self._set(**kwargs)
+
+@inherit_doc
+class ClusteringEvaluator(JavaEvaluator, HasPredictionCol, HasFeaturesCol,
+ JavaMLReadable, JavaMLWritable):
+ """
+ .. note:: Experimental
+
+ Evaluator for Clustering results, which expects two input
+ columns: prediction and features.
+
+ >>> from sklearn import datasets
+ >>> from pyspark.sql.types import *
+ >>> from pyspark.ml.linalg import Vectors, VectorUDT
+ >>> from pyspark.ml.evaluation import ClusteringEvaluator
+ ...
+ >>> iris = datasets.load_iris()
+ >>> iris_rows = [(Vectors.dense(x), int(iris.target[i]))
+ ... for i, x in enumerate(iris.data)]
+ >>> schema = StructType([
+ ... StructField("features", VectorUDT(), True),
+ ... StructField("cluster_id", IntegerType(), True)])
--- End diff --
```cluster_id``` -> ```prediction``` to emphasize this is the prediction
value, not ground truth.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]