huaxingao commented on a change in pull request #27245:
[SPARK-29212][ML][PYSPARK] Add common classes without using JVM backend
URL: https://github.com/apache/spark/pull/27245#discussion_r380975660
##########
File path: python/pyspark/ml/classification.py
##########
@@ -74,52 +78,56 @@ def setRawPredictionCol(self, value):
@inherit_doc
-class JavaClassificationModel(JavaPredictionModel, _JavaClassifierParams):
+class ClassificationModel(PredictionModel, _ClassifierParams):
"""
- Java Model produced by a ``Classifier``.
+ Model produced by a ``Classifier``.
Classes are indexed {0, 1, ..., numClasses - 1}.
- To be mixed in with class:`pyspark.ml.JavaModel`
"""
+ __metaclass__ = ABCMeta
+
@since("3.0.0")
def setRawPredictionCol(self, value):
"""
Sets the value of :py:attr:`rawPredictionCol`.
"""
return self._set(rawPredictionCol=value)
- @property
+ @abstractproperty
@since("2.1.0")
def numClasses(self):
"""
Number of classes (values which the label can take).
"""
- return self._call_java("numClasses")
+ raise NotImplementedError()
+ @abstractmethod
@since("3.0.0")
def predictRaw(self, value):
"""
Raw prediction for each possible label.
"""
- return self._call_java("predictRaw", value)
+ raise NotImplementedError()
-class _JavaProbabilisticClassifierParams(HasProbabilityCol, HasThresholds,
_JavaClassifierParams):
+class _ProbabilisticClassifierParams(HasProbabilityCol, HasThresholds,
_ClassifierParams):
"""
- Params for :py:class:`JavaProbabilisticClassifier` and
- :py:class:`JavaProbabilisticClassificationModel`.
+ Params for :py:class:`_JavaProbabilisticClassifier` and
+ :py:class:`_JavaProbabilisticClassificationModel`.
Review comment:
should these be ```ProbabilisticClassifier``` and
```ProbabilisticClassificationModel```?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]