GitHub user huangweizhe123 opened a pull request:
https://github.com/apache/spark/pull/21612
[SPARK-24628][MLlib]If you want to create a dense matrix ((1.0, 2.0), (3.0,
4.0), (5.0, 6â¦
â¦.0)), the list should be [1, 3, 5, 2, 4, 6].
## What changes were proposed in this pull request?
The example wants to create a dense matrix ((1.0, 2.0), (3.0, 4.0), (5.0,
6.0)), but the list is given as [1, 2, 3, 4, 5, 6]. Now it is changed as [1, 3,
5, 2, 4, 6].
## How was this patch tested?
This can be simply tested by running the code below using pyspark.
from pyspark.mllib.linalg import Matrix, Matrices
dm2 = Matrices.dense(3, 2, [1, 3, 5, 2, 4, 6])
dm2.toArray()
The result is like
array([[ 1., 2.],
[ 3., 4.],
[ 5., 6.]])
Author: Weizhe Huang <[email protected]>
Please review http://spark.apache.org/contributing.html before opening a
pull request.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/huangweizhe123/spark my_change
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/21612.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #21612
----
commit 9ecd7a897fc53f84e18c35ca605962ee54a8a554
Author: Huangweizhe <huangweizhe@...>
Date: 2018-06-22T08:42:11Z
If you want to create a dense matrix ((1.0, 2.0), (3.0, 4.0), (5.0, 6.0)),
the list should be [1, 3, 5, 2, 4, 6].
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]