apply function to all the elements of a rowMatrix

2015-02-12 Thread Donbeo
Hi,
I need to apply a function to all the elements of a rowMatrix. 

How can I do that?
Here there is a more detailed question 
http://stackoverflow.com/questions/28438908/spark-mllib-apply-function-to-all-the-elements-of-a-rowmatrix


Thanks a lot!



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/apply-function-to-all-the-elements-of-a-rowMatrix-tp21622.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org



spark mllib error when predict on linear regression model

2015-02-12 Thread Donbeo
Hi,
I have a model and I am trying to predict regPoints.  Here is the code that
I have used. 
A more detailed question is available at 
http://stackoverflow.com/questions/28482476/spark-mllib-predict-error-with-map

scala model
res26: org.apache.spark.mllib.regression.LinearRegressionModel =
(weights=[-4.00245512323736E-15,-7.110058964543731E-15,2.0790436644401968E-15,1.7497510523275056E-15,6.593638326021273E-15],
intercept=0.0)

scala regPoints
res27:
org.apache.spark.rdd.RDD[org.apache.spark.mllib.regression.LabeledPoint] =
MappedRDD[32] at map at console:54

//ERROR
scala val y_predicted = regPoints map (point =
model.predict(point.features))
15/02/12 16:14:45 INFO BlockManager: Removing broadcast 285
15/02/12 16:14:45 INFO BlockManager: Removing block broadcast_285_piece0
15/..


Thanks a lot,
Luca



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/spark-mllib-error-when-predict-on-linear-regression-model-tp21629.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org



apply function to all elements of a row matrix

2015-02-11 Thread Donbeo
HI,
I have a row matrix x

scala x
res3: org.apache.spark.mllib.linalg.distributed.RowMatrix =
org.apache.spark.mllib.linalg.distributed.RowMatrix@63949747

and I would like to apply a function to each element of this matrix. I was
looking for something like:
x map (e = exp(-e*e))   

How can I do that?

Thanks!!



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/apply-function-to-all-elements-of-a-row-matrix-tp21596.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org



map distribuited matrix (rowMatrix)

2015-02-10 Thread Donbeo
I have a rowMatrix x and I would like to apply a function to each element of
x. 

I was thinking something likex map(u=exp(-u*u)) . How can I do
something like that?



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/map-distribuited-matrix-rowMatrix-tp21571.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org



sum of columns in rowMatrix and linear regression

2015-02-09 Thread Donbeo
I have a matrix X of type: 
res39: org.apache.spark.mllib.linalg.distributed.RowMatrix =
org.apache.spark.mllib.linalg.distributed.RowMatrix@6cfff1d3
with n rows and p columns

I would like to obtain an array S of size n*1 defined as the sum of the
columns of X. 

S will then be replaced by 
val s2 = s map (x= sin(x)/x) 

Finally I would like to fit a linear regression between X and s2.   How can
I do that?

Thanks a lot!



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/sum-of-columns-in-rowMatrix-and-linear-regression-tp21563.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org



generate a random matrix with uniform distribution

2015-02-06 Thread Donbeo
Hi
I would like to know how can I generate a random matrix where each element
come from a uniform distribution in -1, 1 .  

In particular I would like the matrix be a distributed row matrix with
dimension n x p 

Is this possible with mllib? Should I use another library?



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/generate-a-random-matrix-with-uniform-distribution-tp21538.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org