diff options
author | MechCoder <manojkumarsivaraj334@gmail.com> | 2015-06-06 14:52:14 -0700 |
---|---|---|
committer | Xiangrui Meng <meng@databricks.com> | 2015-06-06 14:52:14 -0700 |
commit | 5aa804f3c6485670937a658ce8207c2317c6a506 (patch) | |
tree | 92757d7ad6e2195618d0d597a8be10712817e19f /mllib | |
parent | 16fc49617e1dfcbe9122b224f7f63b7bfddb36ce (diff) | |
download | spark-5aa804f3c6485670937a658ce8207c2317c6a506.tar.gz spark-5aa804f3c6485670937a658ce8207c2317c6a506.tar.bz2 spark-5aa804f3c6485670937a658ce8207c2317c6a506.zip |
[SPARK-7639] [PYSPARK] [MLLIB] Python API for KernelDensity
Python API for KernelDensity
Author: MechCoder <manojkumarsivaraj334@gmail.com>
Closes #6387 from MechCoder/spark-7639 and squashes the following commits:
17abc62 [MechCoder] add tests
2de6540 [MechCoder] style tests
bf4acc0 [MechCoder] Added doctests
84359d5 [MechCoder] [SPARK-7639] Python API for KernelDensity
Diffstat (limited to 'mllib')
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala | 12 |
1 files changed, 11 insertions, 1 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 16f3131796..8f66bc808a 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 @@ -43,7 +43,8 @@ import org.apache.spark.mllib.regression._ import org.apache.spark.mllib.stat.correlation.CorrelationNames import org.apache.spark.mllib.stat.distribution.MultivariateGaussian import org.apache.spark.mllib.stat.test.ChiSqTestResult -import org.apache.spark.mllib.stat.{MultivariateStatisticalSummary, Statistics} +import org.apache.spark.mllib.stat.{ + KernelDensity, MultivariateStatisticalSummary, Statistics} import org.apache.spark.mllib.tree.configuration.{Algo, BoostingStrategy, Strategy} import org.apache.spark.mllib.tree.impurity._ import org.apache.spark.mllib.tree.loss.Losses @@ -945,6 +946,15 @@ private[python] class PythonMLLibAPI extends Serializable { r => (r.getSeq(0).toArray[Any], r.getSeq(1).toArray[Any]))) } + /** + * Java stub for the estimate method of KernelDensity + */ + def estimateKernelDensity( + sample: JavaRDD[Double], + bandwidth: Double, points: java.util.ArrayList[Double]): Array[Double] = { + return new KernelDensity().setSample(sample).setBandwidth(bandwidth).estimate( + points.asScala.toArray) + } } |