Repository: spark Updated Branches: refs/heads/master 99386fe39 -> e594b4928
[SPARK-15788][PYSPARK][ML] PySpark IDFModel missing "idf" property ## What changes were proposed in this pull request? add method idf to IDF in pyspark ## How was this patch tested? add unit test Author: Jeff Zhang <zjf...@apache.org> Closes #13540 from zjffdu/SPARK-15788. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/e594b492 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/e594b492 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/e594b492 Branch: refs/heads/master Commit: e594b492836988ef3d9487b511368c70169d1ecd Parents: 99386fe Author: Jeff Zhang <zjf...@apache.org> Authored: Thu Jun 9 09:54:38 2016 -0700 Committer: Nick Pentreath <ni...@za.ibm.com> Committed: Thu Jun 9 09:54:38 2016 -0700 ---------------------------------------------------------------------- python/pyspark/ml/feature.py | 10 ++++++++++ 1 file changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/e594b492/python/pyspark/ml/feature.py ---------------------------------------------------------------------- diff --git a/python/pyspark/ml/feature.py b/python/pyspark/ml/feature.py index 1aff2e5..ebe1300 100755 --- a/python/pyspark/ml/feature.py +++ b/python/pyspark/ml/feature.py @@ -585,6 +585,8 @@ class IDF(JavaEstimator, HasInputCol, HasOutputCol, JavaMLReadable, JavaMLWritab ... (DenseVector([0.0, 1.0]),), (DenseVector([3.0, 0.2]),)], ["tf"]) >>> idf = IDF(minDocFreq=3, inputCol="tf", outputCol="idf") >>> model = idf.fit(df) + >>> model.idf + DenseVector([0.0, 0.0]) >>> model.transform(df).head().idf DenseVector([0.0, 0.0]) >>> idf.setParams(outputCol="freqs").fit(df).transform(df).collect()[1].freqs @@ -658,6 +660,14 @@ class IDFModel(JavaModel, JavaMLReadable, JavaMLWritable): .. versionadded:: 1.4.0 """ + @property + @since("2.0.0") + def idf(self): + """ + Returns the IDF vector. + """ + return self._call_java("idf") + @inherit_doc class MaxAbsScaler(JavaEstimator, HasInputCol, HasOutputCol, JavaMLReadable, JavaMLWritable): --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org