Skip to content

Commit

Permalink
[SPARK-9901] User guide for RowMatrix Tall-and-skinny QR
Browse files Browse the repository at this point in the history
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 <[email protected]>

Closes apache#8462 from hhbyyh/qrDoc.
  • Loading branch information
hhbyyh authored and mengxr committed Aug 27, 2015
1 parent 84baa5e commit 6185cdd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docs/mllib-data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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>

Expand All @@ -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>

Expand Down

0 comments on commit 6185cdd

Please sign in to comment.