zero323 commented on a change in pull request #29591:
URL: https://github.com/apache/spark/pull/29591#discussion_r489402579



##########
File path: python/pyspark/ml/evaluation.pyi
##########
@@ -0,0 +1,283 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import abc
+from typing import Optional, Type
+from pyspark.ml._typing import (
+    ParamMap,
+    BinaryClassificationEvaluatorMetricType,
+    ClusteringEvaluatorMetricType,
+    MulticlassClassificationEvaluatorMetricType,
+    MultilabelClassificationEvaluatorMetricType,
+    RankingEvaluatorMetricType,
+    RegressionEvaluatorMetricType,
+)
+
+from pyspark.ml.wrapper import JavaParams
+from pyspark.ml.param import Param, Params
+from pyspark.ml.param.shared import (
+    HasFeaturesCol,
+    HasLabelCol,
+    HasPredictionCol,
+    HasProbabilityCol,
+    HasRawPredictionCol,
+    HasWeightCol,
+)
+from pyspark.ml.util import JavaMLReadable, JavaMLWritable
+
+class Evaluator(Params):
+    __metaclass__: Type[abc.ABCMeta]
+    def evaluate(self, dataset, params: Optional[ParamMap] = ...) -> float: ...
+    def isLargerBetter(self) -> bool: ...
+
+class JavaEvaluator(JavaParams, Evaluator):
+    __metaclass__: Type[abc.ABCMeta]
+    def isLargerBetter(self) -> bool: ...
+
+class BinaryClassificationEvaluator(
+    JavaEvaluator,
+    HasLabelCol,
+    HasRawPredictionCol,
+    HasWeightCol,
+    JavaMLReadable[BinaryClassificationEvaluator],
+    JavaMLWritable,
+):
+    metricName: Param[BinaryClassificationEvaluatorMetricType]
+    numBins: Param[int]
+    def __init__(
+        self,
+        *,

Review comment:
       > and remove `keyword_only`.
   
   I was actually looking at this problem this week, but I am not sure if it 
makes sense to remove it completely.  Having keyword only arguments would be 
great, but we'll still have to do something to capture arguments.
   
   Also, `keyword_only` has been used in the wild, though maybe not at the 
large scale.
   
   Overall I was thinking about:
   
   - Marking `__init__` and `setParams` with keyword only, primarily to make 
things explicit.
   - Preserving `keyword_only` for the time being.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to