diff options
author | Holden Karau <holden@us.ibm.com> | 2016-08-22 12:21:22 +0200 |
---|---|---|
committer | Nick Pentreath <nickp@za.ibm.com> | 2016-08-22 12:21:22 +0200 |
commit | b264cbb16fb97116e630fb593adf5898a5a0e8fa (patch) | |
tree | 056d664ec1ea34ee88489b2b8c6bbc0dc43b8c03 /python/pyspark/ml/util.py | |
parent | bd9655063bdba8836b4ec96ed115e5653e246b65 (diff) | |
download | spark-b264cbb16fb97116e630fb593adf5898a5a0e8fa.tar.gz spark-b264cbb16fb97116e630fb593adf5898a5a0e8fa.tar.bz2 spark-b264cbb16fb97116e630fb593adf5898a5a0e8fa.zip |
[SPARK-15113][PYSPARK][ML] Add missing num features num classes
## What changes were proposed in this pull request?
Add missing `numFeatures` and `numClasses` to the wrapped Java models in PySpark ML pipelines. Also tag `DecisionTreeClassificationModel` as Expiremental to match Scala doc.
## How was this patch tested?
Extended doctests
Author: Holden Karau <holden@us.ibm.com>
Closes #12889 from holdenk/SPARK-15113-add-missing-numFeatures-numClasses.
Diffstat (limited to 'python/pyspark/ml/util.py')
-rw-r--r-- | python/pyspark/ml/util.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/python/pyspark/ml/util.py b/python/pyspark/ml/util.py index 4a31a29809..7d39c30122 100644 --- a/python/pyspark/ml/util.py +++ b/python/pyspark/ml/util.py @@ -238,3 +238,19 @@ class JavaMLReadable(MLReadable): def read(cls): """Returns an MLReader instance for this class.""" return JavaMLReader(cls) + + +@inherit_doc +class JavaPredictionModel(): + """ + (Private) Java Model for prediction tasks (regression and classification). + To be mixed in with class:`pyspark.ml.JavaModel` + """ + + @property + @since("2.1.0") + def numFeatures(self): + """ + Returns the number of features the model was trained on. If unknown, returns -1 + """ + return self._call_java("numFeatures") |