From 085d0e4ce68ce76555517d31f8e78bc23f2d570f Mon Sep 17 00:00:00 2001 From: Yuhao Yang Date: Wed, 26 Aug 2015 11:29:28 -0400 Subject: [PATCH 1/2] add qr to Rowmatrix doc example --- docs/mllib-data-types.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/mllib-data-types.md b/docs/mllib-data-types.md index f0e8d5495675d..0aecc2c29dbb4 100644 --- a/docs/mllib-data-types.md +++ b/docs/mllib-data-types.md @@ -350,6 +350,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 %} @@ -370,6 +373,9 @@ RowMatrix mat = new RowMatrix(rows.rdd()); // Get its size. long m = mat.numRows(); long n = mat.numCols(); + +// QR decomposition +QRDecomposition result = mat.tallSkinnyQR(true); {% endhighlight %} From d1e2e2bf86dc6b95b86d5563f74827b1adab7d42 Mon Sep 17 00:00:00 2001 From: Yuhao Yang Date: Thu, 27 Aug 2015 11:47:39 -0400 Subject: [PATCH 2/2] add description for qr --- docs/mllib-data-types.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/mllib-data-types.md b/docs/mllib-data-types.md index 0aecc2c29dbb4..065bf4727624f 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.
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