You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by jk...@apache.org on 2016/02/02 19:21:26 UTC
spark git commit: [SPARK-12780][ML][PYTHON][BACKPORT] Inconsistency
returning value of ML python models' properties
Repository: spark
Updated Branches:
refs/heads/branch-1.6 99594b213 -> 9a3d1bd09
[SPARK-12780][ML][PYTHON][BACKPORT] Inconsistency returning value of ML python models' properties
Backport of [SPARK-12780] for branch-1.6
Original PR for master: https://github.com/apache/spark/pull/10724
This fixes StringIndexerModel.labels in pyspark.
Author: Xusen Yin <yi...@gmail.com>
Closes #10950 from jkbradley/yinxusen-spark-12780-backport.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/9a3d1bd0
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/9a3d1bd0
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/9a3d1bd0
Branch: refs/heads/branch-1.6
Commit: 9a3d1bd09cdf4a7c2992525c203d4dac764fddb8
Parents: 99594b2
Author: Xusen Yin <yi...@gmail.com>
Authored: Tue Feb 2 10:21:21 2016 -0800
Committer: Joseph K. Bradley <jo...@databricks.com>
Committed: Tue Feb 2 10:21:21 2016 -0800
----------------------------------------------------------------------
python/pyspark/ml/feature.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/9a3d1bd0/python/pyspark/ml/feature.py
----------------------------------------------------------------------
diff --git a/python/pyspark/ml/feature.py b/python/pyspark/ml/feature.py
index b02d41b..ea874dc 100644
--- a/python/pyspark/ml/feature.py
+++ b/python/pyspark/ml/feature.py
@@ -1263,7 +1263,7 @@ class StringIndexer(JavaEstimator, HasInputCol, HasOutputCol, HasHandleInvalid):
>>> sorted(set([(i[0], i[1]) for i in td.select(td.id, td.indexed).collect()]),
... key=lambda x: x[0])
[(0, 0.0), (1, 2.0), (2, 1.0), (3, 0.0), (4, 0.0), (5, 1.0)]
- >>> inverter = IndexToString(inputCol="indexed", outputCol="label2", labels=model.labels())
+ >>> inverter = IndexToString(inputCol="indexed", outputCol="label2", labels=model.labels)
>>> itd = inverter.transform(td)
>>> sorted(set([(i[0], str(i[1])) for i in itd.select(itd.id, itd.label2).collect()]),
... key=lambda x: x[0])
@@ -1305,13 +1305,14 @@ class StringIndexerModel(JavaModel):
.. versionadded:: 1.4.0
"""
+
@property
@since("1.5.0")
def labels(self):
"""
Ordered list of labels, corresponding to indices to be assigned.
"""
- return self._java_obj.labels
+ return self._call_java("labels")
@inherit_doc
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org