Re: Python to Java object conversion of numpy array

2015-01-13 Thread Davies Liu
On Mon, Jan 12, 2015 at 8:14 PM, Meethu Mathew meethu.mat...@flytxt.com wrote: Hi, This is the function defined in PythonMLLibAPI.scala def findPredict( data: JavaRDD[Vector], wt: Object, mu: Array[Object], si: Array[Object]): RDD[Array[Double]] = { } So the

Re: Python to Java object conversion of numpy array

2015-01-12 Thread Meethu Mathew
Hi, This is the function defined in PythonMLLibAPI.scala def findPredict( data: JavaRDD[Vector], wt: Object, mu: Array[Object], si: Array[Object]): RDD[Array[Double]] = { } So the parameter mu should be converted to Array[object]. mu = (Vectors.dense([0.8786,

Re: Python to Java object conversion of numpy array

2015-01-12 Thread Davies Liu
On Sun, Jan 11, 2015 at 10:21 PM, Meethu Mathew meethu.mat...@flytxt.com wrote: Hi, This is the code I am running. mu = (Vectors.dense([0.8786, -0.7855]),Vectors.dense([-0.1863, 0.7799])) membershipMatrix = callMLlibFunc(findPredict, rdd.map(_convert_to_vector), mu) What's the Java API

Re: Python to Java object conversion of numpy array

2015-01-11 Thread Meethu Mathew
Hi, This is the code I am running. mu = (Vectors.dense([0.8786, -0.7855]),Vectors.dense([-0.1863, 0.7799])) membershipMatrix = callMLlibFunc(findPredict, rdd.map(_convert_to_vector), mu) Regards, Meethu On Monday 12 January 2015 11:46 AM, Davies Liu wrote: Could you post a piece of code

Re: Python to Java object conversion of numpy array

2015-01-11 Thread Davies Liu
Could you post a piece of code here? On Sun, Jan 11, 2015 at 9:28 PM, Meethu Mathew meethu.mat...@flytxt.com wrote: Hi, Thanks Davies . I added a new class GaussianMixtureModel in clustering.py and the method predict in it and trying to pass numpy array from this method.I converted it to

Re: Python to Java object conversion of numpy array

2015-01-11 Thread Meethu Mathew
Hi, Thanks Davies . I added a new class GaussianMixtureModel in clustering.py and the method predict in it and trying to pass numpy array from this method.I converted it to DenseVector and its solved now. Similarly I tried passing a List of more than one dimension to the function _py2java

Re: Python to Java object conversion of numpy array

2015-01-09 Thread Davies Liu
Hey Meethu, The Java API accepts only Vector, so you should convert the numpy array into pyspark.mllib.linalg.DenseVector. BTW, which class are you using? the KMeansModel.predict() accept numpy.array, it will do the conversion for you. Davies On Fri, Jan 9, 2015 at 4:45 AM, Meethu Mathew