aboutsummaryrefslogtreecommitdiff
path: root/mllib/src/main
diff options
context:
space:
mode:
authorYanbo Liang <ybliang8@gmail.com>2015-05-08 15:48:39 -0700
committerJoseph K. Bradley <joseph@databricks.com>2015-05-08 15:48:50 -0700
commitab48df3918c6009cc268abfb74056d86363435d7 (patch)
tree9b06cdce06ab898e57ed4efc167ee0ca0ddd87f6 /mllib/src/main
parent21bd7222e55b9cf684c072141998a0623a69f514 (diff)
downloadspark-ab48df3918c6009cc268abfb74056d86363435d7.tar.gz
spark-ab48df3918c6009cc268abfb74056d86363435d7.tar.bz2
spark-ab48df3918c6009cc268abfb74056d86363435d7.zip
[SPARK-5913] [MLLIB] Python API for ChiSqSelector
Add a Python API for mllib.feature.ChiSqSelector https://issues.apache.org/jira/browse/SPARK-5913 Author: Yanbo Liang <ybliang8@gmail.com> Closes #5939 from yanboliang/spark-5913 and squashes the following commits: cdaac99 [Yanbo Liang] Python API for ChiSqSelector (cherry picked from commit 35c9599b94de759204ed33cdd46d8ee108bccd86) Signed-off-by: Joseph K. Bradley <joseph@databricks.com>
Diffstat (limited to 'mllib/src/main')
-rw-r--r--mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala b/mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala
index 426306d78c..8c30ad4b39 100644
--- a/mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala
+++ b/mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala
@@ -495,6 +495,16 @@ private[python] class PythonMLLibAPI extends Serializable {
}
/**
+ * Java stub for ChiSqSelector.fit(). This stub returns a
+ * handle to the Java object instead of the content of the Java object.
+ * Extra care needs to be taken in the Python code to ensure it gets freed on
+ * exit; see the Py4J documentation.
+ */
+ def fitChiSqSelector(numTopFeatures: Int, data: JavaRDD[LabeledPoint]): ChiSqSelectorModel = {
+ new ChiSqSelector(numTopFeatures).fit(data.rdd)
+ }
+
+ /**
* Java stub for IDF.fit(). This stub returns a
* handle to the Java object instead of the content of the Java object.
* Extra care needs to be taken in the Python code to ensure it gets freed on