diff options
author | Yuhao Yang <hhbyyh@gmail.com> | 2015-08-27 13:57:20 -0700 |
---|---|---|
committer | Xiangrui Meng <meng@databricks.com> | 2015-08-27 13:57:20 -0700 |
commit | 6185cdd2afcd492b77ff225b477b3624e3bc7bb2 (patch) | |
tree | 7531c492b5f683f26ef7b3be3e15bc15d1d4443a /docs/mllib-data-types.md | |
parent | 84baa5e9b5edc8c55871fbed5057324450bf097f (diff) | |
download | spark-6185cdd2afcd492b77ff225b477b3624e3bc7bb2.tar.gz spark-6185cdd2afcd492b77ff225b477b3624e3bc7bb2.tar.bz2 spark-6185cdd2afcd492b77ff225b477b3624e3bc7bb2.zip |
[SPARK-9901] User guide for RowMatrix Tall-and-skinny QR
jira: https://issues.apache.org/jira/browse/SPARK-9901
The jira covers only the document update. I can further provide example code for QR (like the ones for SVD and PCA) in a separate PR.
Author: Yuhao Yang <hhbyyh@gmail.com>
Closes #8462 from hhbyyh/qrDoc.
Diffstat (limited to 'docs/mllib-data-types.md')
-rw-r--r-- | docs/mllib-data-types.md | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/docs/mllib-data-types.md b/docs/mllib-data-types.md index f0e8d54956..065bf47276 100644 --- a/docs/mllib-data-types.md +++ b/docs/mllib-data-types.md @@ -337,7 +337,10 @@ limited by the integer range but it should be much smaller in practice. <div data-lang="scala" markdown="1"> A [`RowMatrix`](api/scala/index.html#org.apache.spark.mllib.linalg.distributed.RowMatrix) can be -created from an `RDD[Vector]` instance. Then we can compute its column summary statistics. +created from an `RDD[Vector]` instance. Then we can compute its column summary statistics and decompositions. +[QR decomposition](https://en.wikipedia.org/wiki/QR_decomposition) is of the form A = QR where Q is an orthogonal matrix and R is an upper triangular matrix. +For [singular value decomposition (SVD)](https://en.wikipedia.org/wiki/Singular_value_decomposition) and [principal component analysis (PCA)](https://en.wikipedia.org/wiki/Principal_component_analysis), please refer to [Dimensionality reduction](mllib-dimensionality-reduction.html). + {% highlight scala %} import org.apache.spark.mllib.linalg.Vector @@ -350,6 +353,9 @@ val mat: RowMatrix = new RowMatrix(rows) // Get its size. val m = mat.numRows() val n = mat.numCols() + +// QR decomposition +val qrResult = mat.tallSkinnyQR(true) {% endhighlight %} </div> @@ -370,6 +376,9 @@ RowMatrix mat = new RowMatrix(rows.rdd()); // Get its size. long m = mat.numRows(); long n = mat.numCols(); + +// QR decomposition +QRDecomposition<RowMatrix, Matrix> result = mat.tallSkinnyQR(true); {% endhighlight %} </div> |