Yes the example given here should have used uniformVectorRDD. Then it's correct.

On Mon, Feb 9, 2015 at 9:56 AM, Luca Puggini <lucapug...@gmail.com> wrote:
> Thanks a lot!
> Can I ask why this code generates a uniform distribution?
>
> If dist is N(0,1) data should be  N(-1, 2).
>
> Let me know.
> Thanks,
> Luca
>
> 2015-02-07 3:00 GMT+00:00 Burak Yavuz <brk...@gmail.com>:
>>
>> Hi,
>>
>> You can do the following:
>> ```
>> import org.apache.spark.mllib.linalg.distributed.RowMatrix
>> import org.apache.spark.mllib.random._
>>
>> // sc is the spark context, numPartitions is the number of partitions you
>> want the RDD to be in
>> val dist: RDD[Vector] = RandomRDDs.normalVectorRDD(sc, n, k,
>> numPartitions, seed)
>> // make the distribution uniform between (-1, 1)
>> val data = dist.map(_ * 2  - 1)
>> val matrix = new RowMatrix(data, n, k)
>>
>> On Feb 6, 2015 11:18 AM, "Donbeo" <lucapug...@gmail.com> wrote:
>>>
>>> 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
>>>
>

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

Reply via email to