diff options
author | Yanbo Liang <ybliang8@gmail.com> | 2015-06-21 12:04:20 -0700 |
---|---|---|
committer | Joseph K. Bradley <joseph@databricks.com> | 2015-06-21 12:04:20 -0700 |
commit | 32e3cdaa647722671adcb5068bd5ffbf2f157806 (patch) | |
tree | 9083af7080e560cb1224813a285a69aa4b19becf /mllib/src | |
parent | a1e3649c8775d71ca78796b6544284e942ac1331 (diff) | |
download | spark-32e3cdaa647722671adcb5068bd5ffbf2f157806.tar.gz spark-32e3cdaa647722671adcb5068bd5ffbf2f157806.tar.bz2 spark-32e3cdaa647722671adcb5068bd5ffbf2f157806.zip |
[SPARK-7604] [MLLIB] Python API for PCA and PCAModel
Python API for PCA and PCAModel
Author: Yanbo Liang <ybliang8@gmail.com>
Closes #6315 from yanboliang/spark-7604 and squashes the following commits:
1d58734 [Yanbo Liang] remove transform() in PCAModel, use default behavior
4d9d121 [Yanbo Liang] Python API for PCA and PCAModel
Diffstat (limited to 'mllib/src')
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala | 10 |
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 2897865af6..634d56d08d 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 @@ -520,6 +520,16 @@ private[python] class PythonMLLibAPI extends Serializable { } /** + * Java stub for PCA.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 fitPCA(k: Int, data: JavaRDD[Vector]): PCAModel = { + new PCA(k).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 |