Create an Indexed Row Matrix in Scala - Spark having random values in the vector.

We are going to create an Indexed Row Matrix in Scala - Spark having random values in the vector.
We have successfully created a local array using below given code but it messes up for large dimensions -
import org.apache.spark.mllib.random.RandomRDDs._
import scala.util.Random
var r = scala.util.Random
var ps = 20
var csl = 6
var rp = Array.fill(ps,csl{r.nextFloat}
This should yield something like this
[1, [random vector of length 6]
2 , [random vector of length 6] ....20 [random vector of length 6] ]
Which is an Indexed Row Matrix?

Tagged:
Sign In or Register to comment.