aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuhao Yang <hhbyyh@gmail.com>2015-08-27 13:57:20 -0700
committerXiangrui Meng <meng@databricks.com>2015-08-27 13:57:37 -0700
commit66db9cdc6ad3367ddf8d49d4d48c7506a4459675 (patch)
tree801984f6c78fd090c91b992c4fc9216b6c88ad47
parentdb197150102c5ecb829dbbc64fc28b88fcc9c493 (diff)
downloadspark-66db9cdc6ad3367ddf8d49d4d48c7506a4459675.tar.gz
spark-66db9cdc6ad3367ddf8d49d4d48c7506a4459675.tar.bz2
spark-66db9cdc6ad3367ddf8d49d4d48c7506a4459675.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. (cherry picked from commit 6185cdd2afcd492b77ff225b477b3624e3bc7bb2) Signed-off-by: Xiangrui Meng <meng@databricks.com>
-rw-r--r--docs/mllib-data-types.md11
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>