You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by devaraj-kavali <gi...@git.apache.org> on 2016/02/09 10:56:30 UTC

[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

GitHub user devaraj-kavali opened a pull request:

    https://github.com/apache/spark/pull/11132

    [SPARK-13016] [Documentation] Replace example code in mllib-dimensionality-reduction.md using include_example

    Replaced example example code in mllib-dimensionality-reduction.md using
    include_example

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/devaraj-kavali/spark SPARK-13016

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/11132.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 #11132
    
----
commit 488f09c06d6623920c0cf841af847a47ccb625c2
Author: Devaraj K <de...@apache.org>
Date:   2016-02-09T09:53:23Z

    [SPARK-13016] [Documentation] Replace example code in
    mllib-dimensionality-reduction.md using include_example
    
    Replaced example example code in mllib-dimensionality-reduction.md using
    include_example

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-186862377
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-183111348
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r53274407
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/SVDExample.scala ---
    @@ -0,0 +1,61 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +// scalastyle:off println
    +package org.apache.spark.examples.mllib
    +
    +// $example on$
    +import org.apache.spark.SparkConf
    +import org.apache.spark.SparkContext
    +import org.apache.spark.mllib.linalg.Matrix
    +import org.apache.spark.mllib.linalg.SingularValueDecomposition
    +import org.apache.spark.mllib.linalg.Vector
    +import org.apache.spark.mllib.linalg.Vectors
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix
    +// $example off$
    +
    +object SVDExample {
    +
    +  def main(args: Array[String]): Unit = {
    +
    +    val conf = new SparkConf().setAppName("SVDExample")
    +    val sc = new SparkContext(conf)
    +
    +    // $example on$
    +    val data = Array(
    +      Vectors.sparse(5, Seq((1, 1.0), (3, 7.0))),
    +      Vectors.dense(2.0, 0.0, 3.0, 4.0, 5.0),
    +      Vectors.dense(4.0, 0.0, 0.0, 6.0, 7.0))
    +
    +    val dataRDD = sc.parallelize(data, 2)
    +
    +    val mat: RowMatrix = new RowMatrix(dataRDD)
    +
    +    // Compute the top 5 singular values and corresponding singular vectors.
    +    val svd: SingularValueDecomposition[RowMatrix, Matrix] = mat.computeSVD(5, computeU = true)
    +    val U: RowMatrix = svd.U // The U factor is a RowMatrix.
    --- End diff --
    
    Use 2-indent spaces for inline comments.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r52945872
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaPCAExample.java ---
    @@ -0,0 +1,61 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +//$example on$
    +import java.util.LinkedList;
    +
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.SparkContext;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.mllib.linalg.Matrix;
    +import org.apache.spark.mllib.linalg.Vector;
    +import org.apache.spark.mllib.linalg.Vectors;
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix;
    +//$example off$
    +
    +/**
    + * Example for compute principal components on a 'RowMatrix'.
    + */
    +public class JavaPCAExample {
    +  public static void main(String[] args) {
    +    SparkConf conf = new SparkConf().setAppName("PCA Example");
    +    SparkContext sc = new SparkContext(conf);
    +
    +    // $example on$
    +    double[][] array = { { 1.12, 2.05, 3.12 }, { 5.56, 6.28, 8.94 },
    +      { 10.2, 8.0, 20.5 } };
    +    LinkedList<Vector> rowsList = new LinkedList<Vector>();
    +    for (int i = 0; i < array.length; i++) {
    +      Vector currentRow = Vectors.dense(array[i]);
    +      rowsList.add(currentRow);
    +    }
    +    JavaRDD<Vector> rows = JavaSparkContext.fromSparkContext(sc).parallelize(
    +      rowsList);
    +
    +    // Create a RowMatrix from JavaRDD<Vector>.
    +    RowMatrix mat = new RowMatrix(rows.rdd());
    +
    +    // Compute the top 3 principal components.
    +    Matrix pc = mat.computePrincipalComponents(3);
    +    RowMatrix projected = mat.multiply(pc);
    --- End diff --
    
    Try to print the `projected` to console.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r53274340
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/PCAOnRowMatrixExample.scala ---
    @@ -0,0 +1,58 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +// scalastyle:off println
    +package org.apache.spark.examples.mllib
    +
    +// $example on$
    +import org.apache.spark.SparkConf
    +import org.apache.spark.SparkContext
    +import org.apache.spark.mllib.linalg.Matrix
    --- End diff --
    
    Move `SparkConf` and `SparkContext` out of `$example on$` and `$example off` since they are not involved in the code lines we trimmed out. See example below.
    
    ```scala
    import org.apache.spark.SparkConf
    import org.apache.spark.SparkContext
    // $example on$
    import org.apache.spark.mllib.linalg.Matrix
    import org.apache.spark.mllib.linalg.SingularValueDecomposition
    import org.apache.spark.mllib.linalg.Vector
    import org.apache.spark.mllib.linalg.Vectors
    import org.apache.spark.mllib.linalg.distributed.RowMatrix
    // $example off$
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-187463122
  
    Merged into master. Thanks!
    
    @yinxusen For really small code snippets, we could either leave them in the user guide, or consider merging SPARK-11399 first. Otherwise, we might end up with too many example files.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-185622535
  
    **[Test build #51479 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/51479/consoleFull)** for PR 11132 at commit [`95d78fe`](https://github.com/apache/spark/commit/95d78fe473eabb278dd5c56577468e52a1ec8e40).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-183111355
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/51141/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r53277815
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaSVDExample.java ---
    @@ -0,0 +1,68 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +//$example on$
    +import java.util.LinkedList;
    +
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.SparkContext;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.mllib.linalg.Matrix;
    +import org.apache.spark.mllib.linalg.SingularValueDecomposition;
    +import org.apache.spark.mllib.linalg.Vector;
    +import org.apache.spark.mllib.linalg.Vectors;
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix;
    +//$example off$
    +
    +/**
    + * Example for SingularValueDecomposition.
    + */
    +public class JavaSVDExample {
    +  public static void main(String[] args) {
    +    SparkConf conf = new SparkConf().setAppName("SVD Example");
    +    SparkContext sc = new SparkContext(conf);
    +
    +    // $example on$
    +    double[][] array = { { 1.12, 2.05, 3.12 }, { 5.56, 6.28, 8.94 }, { 10.2, 8.0, 20.5 } };
    +    LinkedList<Vector> rowsList = new LinkedList<Vector>();
    +    for (int i = 0; i < array.length; i++) {
    +      Vector currentRow = Vectors.dense(array[i]);
    +      rowsList.add(currentRow);
    +    }
    +    JavaRDD<Vector> rows = JavaSparkContext.fromSparkContext(sc).parallelize(rowsList);
    +
    +    // Create a RowMatrix from JavaRDD<Vector>.
    +    RowMatrix mat = new RowMatrix(rows.rdd());
    +
    +    // Compute the top 3 singular values and corresponding singular vectors.
    +    SingularValueDecomposition<RowMatrix, Matrix> svd = mat.computeSVD(3, true, 1.0E-9d);
    +    RowMatrix U = svd.U();
    +    Vector s = svd.s();
    +    Matrix V = svd.V();
    +    Vector[] collectPartitions = (Vector[]) U.rows().collect();
    --- End diff --
    
    Ok let's keep it.
    
    2016年2月17日星期三,Devaraj Kavali <no...@github.com> 写道:
    
    > In
    > examples/src/main/java/org/apache/spark/examples/mllib/JavaSVDExample.java
    > <https://github.com/apache/spark/pull/11132#discussion_r53277719>:
    >
    > > +    LinkedList<Vector> rowsList = new LinkedList<Vector>();
    > > +    for (int i = 0; i < array.length; i++) {
    > > +      Vector currentRow = Vectors.dense(array[i]);
    > > +      rowsList.add(currentRow);
    > > +    }
    > > +    JavaRDD<Vector> rows = JavaSparkContext.fromSparkContext(sc).parallelize(rowsList);
    > > +
    > > +    // Create a RowMatrix from JavaRDD<Vector>.
    > > +    RowMatrix mat = new RowMatrix(rows.rdd());
    > > +
    > > +    // Compute the top 3 singular values and corresponding singular vectors.
    > > +    SingularValueDecomposition<RowMatrix, Matrix> svd = mat.computeSVD(3, true, 1.0E-9d);
    > > +    RowMatrix U = svd.U();
    > > +    Vector s = svd.s();
    > > +    Matrix V = svd.V();
    > > +    Vector[] collectPartitions = (Vector[]) U.rows().collect();
    >
    > It gives compilation error if we remove typecasting here since the return
    > type of collect is Object.
    >
    > —
    > Reply to this email directly or view it on GitHub
    > <https://github.com/apache/spark/pull/11132/files#r53277719>.
    >
    
    
    -- 
    Cheers
    -----------------------------------
    Xusen Yin    (尹绪森)
    LinkedIn: https://cn.linkedin.com/in/xusenyin



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-185052767
  
    **[Test build #51413 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/51413/consoleFull)** for PR 11132 at commit [`2ada7ef`](https://github.com/apache/spark/commit/2ada7ef1859b0338a2613164d261671add1ff227).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r52946153
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/PCAOnRowMatrixExample.scala ---
    @@ -0,0 +1,52 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib
    +
    +import org.apache.spark.SparkConf
    +import org.apache.spark.SparkContext
    +import org.apache.spark.mllib.linalg.Matrix
    +import org.apache.spark.mllib.linalg.Vectors
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix
    +
    +object PCAOnRowMatrixExample {
    +
    +  def main(args: Array[String]): Unit = {
    +
    +    val conf = new SparkConf().setAppName("SVDExample")
    +    val sc = new SparkContext(conf)
    +
    +    // $example on$
    +    val data = Array(
    +      Vectors.sparse(5, Seq((1, 1.0), (3, 7.0))),
    +      Vectors.dense(2.0, 0.0, 3.0, 4.0, 5.0),
    +      Vectors.dense(4.0, 0.0, 0.0, 6.0, 7.0))
    +
    +    val dataRDD = sc.parallelize(data, 2)
    +
    +    val mat: RowMatrix = new RowMatrix(dataRDD)
    +
    +    // Compute the top 10 principal components.
    +    // Principal components are stored in a local dense matrix.
    +    val pc: Matrix = mat.computePrincipalComponents(10)
    +
    +    // Project the rows to the linear space spanned by the top 10 principal components.
    +    val projected: RowMatrix = mat.multiply(pc)
    +
    --- End diff --
    
    remove the blank and print `projected`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by devaraj-kavali <gi...@git.apache.org>.
Github user devaraj-kavali commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-184107504
  
    > ERROR: Error fetching remote repo 'origin'
    hudson.plugins.git.GitException: Failed to fetch from https://github.com/apache/spark.git
    	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:763)
    	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1012)
    	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1043)
    
    Jenkins failed fetch the code, Can you retest it? Thanks


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r52946347
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/SVDExample.scala ---
    @@ -0,0 +1,53 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib
    +
    +import org.apache.spark.SparkConf
    +import org.apache.spark.SparkContext
    +import org.apache.spark.mllib.linalg.Matrix
    --- End diff --
    
    Add $example on$ $example off$ in imports


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-185628532
  
    **[Test build #51479 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/51479/consoleFull)** for PR 11132 at commit [`95d78fe`](https://github.com/apache/spark/commit/95d78fe473eabb278dd5c56577468e52a1ec8e40).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r53274595
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaSVDExample.java ---
    @@ -0,0 +1,68 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +//$example on$
    +import java.util.LinkedList;
    +
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.SparkContext;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.mllib.linalg.Matrix;
    +import org.apache.spark.mllib.linalg.SingularValueDecomposition;
    +import org.apache.spark.mllib.linalg.Vector;
    +import org.apache.spark.mllib.linalg.Vectors;
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix;
    +//$example off$
    +
    +/**
    + * Example for SingularValueDecomposition.
    + */
    +public class JavaSVDExample {
    +  public static void main(String[] args) {
    +    SparkConf conf = new SparkConf().setAppName("SVD Example");
    +    SparkContext sc = new SparkContext(conf);
    +
    +    // $example on$
    +    double[][] array = { { 1.12, 2.05, 3.12 }, { 5.56, 6.28, 8.94 }, { 10.2, 8.0, 20.5 } };
    +    LinkedList<Vector> rowsList = new LinkedList<Vector>();
    +    for (int i = 0; i < array.length; i++) {
    +      Vector currentRow = Vectors.dense(array[i]);
    +      rowsList.add(currentRow);
    +    }
    +    JavaRDD<Vector> rows = JavaSparkContext.fromSparkContext(sc).parallelize(rowsList);
    +
    +    // Create a RowMatrix from JavaRDD<Vector>.
    +    RowMatrix mat = new RowMatrix(rows.rdd());
    +
    +    // Compute the top 3 singular values and corresponding singular vectors.
    +    SingularValueDecomposition<RowMatrix, Matrix> svd = mat.computeSVD(3, true, 1.0E-9d);
    +    RowMatrix U = svd.U();
    +    Vector s = svd.s();
    +    Matrix V = svd.V();
    +    Vector[] collectPartitions = (Vector[]) U.rows().collect();
    --- End diff --
    
    redundant casting `(Vector[])`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r53274613
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaSVDExample.java ---
    @@ -0,0 +1,68 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +//$example on$
    +import java.util.LinkedList;
    +
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.SparkContext;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.mllib.linalg.Matrix;
    +import org.apache.spark.mllib.linalg.SingularValueDecomposition;
    +import org.apache.spark.mllib.linalg.Vector;
    +import org.apache.spark.mllib.linalg.Vectors;
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix;
    +//$example off$
    +
    +/**
    + * Example for SingularValueDecomposition.
    + */
    +public class JavaSVDExample {
    +  public static void main(String[] args) {
    +    SparkConf conf = new SparkConf().setAppName("SVD Example");
    +    SparkContext sc = new SparkContext(conf);
    +
    +    // $example on$
    +    double[][] array = { { 1.12, 2.05, 3.12 }, { 5.56, 6.28, 8.94 }, { 10.2, 8.0, 20.5 } };
    +    LinkedList<Vector> rowsList = new LinkedList<Vector>();
    +    for (int i = 0; i < array.length; i++) {
    +      Vector currentRow = Vectors.dense(array[i]);
    +      rowsList.add(currentRow);
    +    }
    +    JavaRDD<Vector> rows = JavaSparkContext.fromSparkContext(sc).parallelize(rowsList);
    +
    +    // Create a RowMatrix from JavaRDD<Vector>.
    +    RowMatrix mat = new RowMatrix(rows.rdd());
    +
    +    // Compute the top 3 singular values and corresponding singular vectors.
    +    SingularValueDecomposition<RowMatrix, Matrix> svd = mat.computeSVD(3, true, 1.0E-9d);
    +    RowMatrix U = svd.U();
    +    Vector s = svd.s();
    +    Matrix V = svd.V();
    --- End diff --
    
    Move `// $example off$` here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r53274440
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/SVDExample.scala ---
    @@ -0,0 +1,61 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +// scalastyle:off println
    +package org.apache.spark.examples.mllib
    +
    +// $example on$
    +import org.apache.spark.SparkConf
    +import org.apache.spark.SparkContext
    +import org.apache.spark.mllib.linalg.Matrix
    +import org.apache.spark.mllib.linalg.SingularValueDecomposition
    +import org.apache.spark.mllib.linalg.Vector
    +import org.apache.spark.mllib.linalg.Vectors
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix
    +// $example off$
    +
    +object SVDExample {
    +
    +  def main(args: Array[String]): Unit = {
    +
    +    val conf = new SparkConf().setAppName("SVDExample")
    +    val sc = new SparkContext(conf)
    +
    +    // $example on$
    +    val data = Array(
    +      Vectors.sparse(5, Seq((1, 1.0), (3, 7.0))),
    +      Vectors.dense(2.0, 0.0, 3.0, 4.0, 5.0),
    +      Vectors.dense(4.0, 0.0, 0.0, 6.0, 7.0))
    +
    +    val dataRDD = sc.parallelize(data, 2)
    +
    +    val mat: RowMatrix = new RowMatrix(dataRDD)
    +
    +    // Compute the top 5 singular values and corresponding singular vectors.
    +    val svd: SingularValueDecomposition[RowMatrix, Matrix] = mat.computeSVD(5, computeU = true)
    +    val U: RowMatrix = svd.U // The U factor is a RowMatrix.
    +    val s: Vector = svd.s // The singular values are stored in a local dense vector.
    +    val V: Matrix = svd.V // The V factor is a local dense matrix.
    +    val collect = U.rows.collect()
    --- End diff --
    
    It's better to add a blank line here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r52945843
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaPCAExample.java ---
    @@ -0,0 +1,61 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +//$example on$
    +import java.util.LinkedList;
    +
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.SparkContext;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.mllib.linalg.Matrix;
    +import org.apache.spark.mllib.linalg.Vector;
    +import org.apache.spark.mllib.linalg.Vectors;
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix;
    +//$example off$
    +
    +/**
    + * Example for compute principal components on a 'RowMatrix'.
    + */
    +public class JavaPCAExample {
    +  public static void main(String[] args) {
    +    SparkConf conf = new SparkConf().setAppName("PCA Example");
    +    SparkContext sc = new SparkContext(conf);
    +
    +    // $example on$
    +    double[][] array = { { 1.12, 2.05, 3.12 }, { 5.56, 6.28, 8.94 },
    +      { 10.2, 8.0, 20.5 } };
    +    LinkedList<Vector> rowsList = new LinkedList<Vector>();
    +    for (int i = 0; i < array.length; i++) {
    +      Vector currentRow = Vectors.dense(array[i]);
    +      rowsList.add(currentRow);
    +    }
    +    JavaRDD<Vector> rows = JavaSparkContext.fromSparkContext(sc).parallelize(
    +      rowsList);
    +
    +    // Create a RowMatrix from JavaRDD<Vector>.
    +    RowMatrix mat = new RowMatrix(rows.rdd());
    +
    +    // Compute the top 3 principal components.
    +    Matrix pc = mat.computePrincipalComponents(3);
    +    RowMatrix projected = mat.multiply(pc);
    +
    --- End diff --
    
    remove the blank line


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-187472318
  
    @mengxr, do you have time to make a pass of SPARK-11399?
    
    2016年2月22日星期一,asfgit <no...@github.com> 写道:
    
    > Closed #11132 <https://github.com/apache/spark/pull/11132> via 9f41087
    > <https://github.com/apache/spark/commit/9f410871ca03f4c04bd965b2e4f80167ce543139>
    > .
    >
    > —
    > Reply to this email directly or view it on GitHub
    > <https://github.com/apache/spark/pull/11132#event-560750238>.
    >
    
    
    -- 
    Cheers
    -----------------------------------
    Xusen Yin    (尹绪森)
    LinkedIn: https://cn.linkedin.com/in/xusenyin



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-185628776
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r52946225
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/PCAOnSourceVectorExample.scala ---
    @@ -0,0 +1,51 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib
    +
    +import org.apache.spark.SparkConf
    +import org.apache.spark.SparkContext
    +import org.apache.spark.mllib.feature.PCA
    +import org.apache.spark.mllib.linalg.Vectors
    +import org.apache.spark.mllib.regression.LabeledPoint
    +import org.apache.spark.rdd.RDD
    +
    +object PCAOnSourceVectorExample {
    +
    +  def main(args: Array[String]): Unit = {
    +
    +    val conf = new SparkConf().setAppName("PCAOnSourceVectorExample")
    +    val sc = new SparkContext(conf)
    +
    +    // $example on$
    +    val data: RDD[LabeledPoint] = sc.parallelize(Seq(
    +      new LabeledPoint(0, Vectors.dense(1, 0, 0, 0, 1)),
    +      new LabeledPoint(1, Vectors.dense(1, 1, 0, 1, 0)),
    +      new LabeledPoint(1, Vectors.dense(1, 1, 0, 0, 0)),
    +      new LabeledPoint(0, Vectors.dense(1, 0, 0, 0, 0)),
    +      new LabeledPoint(1, Vectors.dense(1, 1, 0, 0, 0))))
    +
    +    // Compute the top 10 principal components.
    +    val pca = new PCA(10).fit(data.map(_.features))
    +
    +    // Project vectors to the linear space spanned by the top 10 principal
    +    // components, keeping the label
    +    val projected = data.map(p => p.copy(features = pca.transform(p.features)))
    +
    --- End diff --
    
    remove the blank and print `projected`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r52946033
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaSVDExample.java ---
    @@ -0,0 +1,65 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +//$example on$
    +import java.util.LinkedList;
    +
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.SparkContext;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.mllib.linalg.Matrix;
    +import org.apache.spark.mllib.linalg.SingularValueDecomposition;
    +import org.apache.spark.mllib.linalg.Vector;
    +import org.apache.spark.mllib.linalg.Vectors;
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix;
    +//$example off$
    +
    +/**
    + * Example for SingularValueDecomposition.
    + */
    +public class JavaSVDExample {
    +  public static void main(String[] args) {
    +    SparkConf conf = new SparkConf().setAppName("SVD Example");
    +    SparkContext sc = new SparkContext(conf);
    +
    +    // $example on$
    +    double[][] array = { { 1.12, 2.05, 3.12 }, { 5.56, 6.28, 8.94 },
    +      { 10.2, 8.0, 20.5 } };
    +    LinkedList<Vector> rowsList = new LinkedList<Vector>();
    +    for (int i = 0; i < array.length; i++) {
    +      Vector currentRow = Vectors.dense(array[i]);
    +      rowsList.add(currentRow);
    +    }
    +    JavaRDD<Vector> rows = JavaSparkContext.fromSparkContext(sc).parallelize(
    +      rowsList);
    +
    +    // Create a RowMatrix from JavaRDD<Vector>.
    +    RowMatrix mat = new RowMatrix(rows.rdd());
    +
    +    // Compute the top 4 singular values and corresponding singular vectors.
    +    SingularValueDecomposition<RowMatrix, Matrix> svd = mat.computeSVD(4, true,
    +      1.0E-9d);
    +    RowMatrix U = svd.U();
    +    Vector s = svd.s();
    +    Matrix V = svd.V();
    +
    --- End diff --
    
    remove blank here and try to print U, s, and V.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-186862379
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/51641/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-185944471
  
    @devaraj-kavali All look good except those minors.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r53390121
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaPCAExample.java ---
    @@ -0,0 +1,65 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +// $example on$
    +import java.util.LinkedList;
    +// $example off$
    +
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.SparkContext;
    +// $example on$
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.mllib.linalg.Matrix;
    +import org.apache.spark.mllib.linalg.Vector;
    +import org.apache.spark.mllib.linalg.Vectors;
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix;
    +// $example off$
    +
    +/**
    + * Example for compute principal components on a 'RowMatrix'.
    + */
    +public class JavaPCAExample {
    +  public static void main(String[] args) {
    +    SparkConf conf = new SparkConf().setAppName("PCA Example");
    +    SparkContext sc = new SparkContext(conf);
    +
    +    // $example on$
    +    double[][] array = {{1.12, 2.05, 3.12}, {5.56, 6.28, 8.94}, {10.2, 8.0, 20.5}};
    +    LinkedList<Vector> rowsList = new LinkedList<Vector>();
    +    for (int i = 0; i < array.length; i++) {
    +      Vector currentRow = Vectors.dense(array[i]);
    +      rowsList.add(currentRow);
    +    }
    +    JavaRDD<Vector> rows = JavaSparkContext.fromSparkContext(sc).parallelize(rowsList);
    +
    +    // Create a RowMatrix from JavaRDD<Vector>.
    +    RowMatrix mat = new RowMatrix(rows.rdd());
    +
    +    // Compute the top 3 principal components.
    +    Matrix pc = mat.computePrincipalComponents(3);
    +    RowMatrix projected = mat.multiply(pc);
    --- End diff --
    
    Move the // $example off$ here


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r53558806
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/SVDExample.scala ---
    @@ -0,0 +1,61 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +// scalastyle:off println
    +package org.apache.spark.examples.mllib
    +
    +import org.apache.spark.SparkConf
    +import org.apache.spark.SparkContext
    +// $example on$
    +import org.apache.spark.mllib.linalg.Matrix
    +import org.apache.spark.mllib.linalg.SingularValueDecomposition
    +import org.apache.spark.mllib.linalg.Vector
    +import org.apache.spark.mllib.linalg.Vectors
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix
    +// $example off$
    +
    +object SVDExample {
    +
    +  def main(args: Array[String]): Unit = {
    +
    +    val conf = new SparkConf().setAppName("SVDExample")
    +    val sc = new SparkContext(conf)
    +
    +    // $example on$
    +    val data = Array(
    +      Vectors.sparse(5, Seq((1, 1.0), (3, 7.0))),
    +      Vectors.dense(2.0, 0.0, 3.0, 4.0, 5.0),
    +      Vectors.dense(4.0, 0.0, 0.0, 6.0, 7.0))
    +
    +    val dataRDD = sc.parallelize(data, 2)
    +
    +    val mat: RowMatrix = new RowMatrix(dataRDD)
    +
    +    // Compute the top 5 singular values and corresponding singular vectors.
    +    val svd: SingularValueDecomposition[RowMatrix, Matrix] = mat.computeSVD(5, computeU = true)
    +    val U: RowMatrix = svd.U  // The U factor is a RowMatrix.
    +    val s: Vector = svd.s  // The singular values are stored in a local dense vector.
    +    val V: Matrix = svd.V  // The V factor is a local dense matrix.
    +    // $example off$
    +    val collect = U.rows.collect()
    +    println("U factor is:")
    +    collect.foreach { vector => println(vector) }
    +    println(s"Singular values are: $s")
    +    println(s"V factor is: $V")
    --- End diff --
    
    `s"V factor is\n: $V"`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r53390563
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/SVDExample.scala ---
    @@ -0,0 +1,61 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +// scalastyle:off println
    +package org.apache.spark.examples.mllib
    +
    +import org.apache.spark.SparkConf
    +import org.apache.spark.SparkContext
    +// $example on$
    +import org.apache.spark.mllib.linalg.Matrix
    +import org.apache.spark.mllib.linalg.SingularValueDecomposition
    +import org.apache.spark.mllib.linalg.Vector
    +import org.apache.spark.mllib.linalg.Vectors
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix
    +// $example off$
    +
    +object SVDExample {
    +
    +  def main(args: Array[String]): Unit = {
    +
    +    val conf = new SparkConf().setAppName("SVDExample")
    +    val sc = new SparkContext(conf)
    +
    +    // $example on$
    +    val data = Array(
    +      Vectors.sparse(5, Seq((1, 1.0), (3, 7.0))),
    +      Vectors.dense(2.0, 0.0, 3.0, 4.0, 5.0),
    +      Vectors.dense(4.0, 0.0, 0.0, 6.0, 7.0))
    +
    +    val dataRDD = sc.parallelize(data, 2)
    +
    +    val mat: RowMatrix = new RowMatrix(dataRDD)
    +
    +    // Compute the top 5 singular values and corresponding singular vectors.
    +    val svd: SingularValueDecomposition[RowMatrix, Matrix] = mat.computeSVD(5, computeU = true)
    +    val U: RowMatrix = svd.U  // The U factor is a RowMatrix.
    +    val s: Vector = svd.s  // The singular values are stored in a local dense vector.
    +    val V: Matrix = svd.V  // The V factor is a local dense matrix.
    --- End diff --
    
    Move // $example off$ here, since lines below are what we added intent to output.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r52945822
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaPCAExample.java ---
    @@ -0,0 +1,61 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +//$example on$
    +import java.util.LinkedList;
    +
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.SparkContext;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.mllib.linalg.Matrix;
    +import org.apache.spark.mllib.linalg.Vector;
    +import org.apache.spark.mllib.linalg.Vectors;
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix;
    +//$example off$
    +
    +/**
    + * Example for compute principal components on a 'RowMatrix'.
    + */
    +public class JavaPCAExample {
    +  public static void main(String[] args) {
    +    SparkConf conf = new SparkConf().setAppName("PCA Example");
    +    SparkContext sc = new SparkContext(conf);
    +
    +    // $example on$
    +    double[][] array = { { 1.12, 2.05, 3.12 }, { 5.56, 6.28, 8.94 },
    +      { 10.2, 8.0, 20.5 } };
    +    LinkedList<Vector> rowsList = new LinkedList<Vector>();
    +    for (int i = 0; i < array.length; i++) {
    +      Vector currentRow = Vectors.dense(array[i]);
    +      rowsList.add(currentRow);
    +    }
    +    JavaRDD<Vector> rows = JavaSparkContext.fromSparkContext(sc).parallelize(
    +      rowsList);
    --- End diff --
    
    Merge this line with previous one


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r52945995
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaSVDExample.java ---
    @@ -0,0 +1,65 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +//$example on$
    +import java.util.LinkedList;
    +
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.SparkContext;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.mllib.linalg.Matrix;
    +import org.apache.spark.mllib.linalg.SingularValueDecomposition;
    +import org.apache.spark.mllib.linalg.Vector;
    +import org.apache.spark.mllib.linalg.Vectors;
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix;
    +//$example off$
    +
    +/**
    + * Example for SingularValueDecomposition.
    + */
    +public class JavaSVDExample {
    +  public static void main(String[] args) {
    +    SparkConf conf = new SparkConf().setAppName("SVD Example");
    +    SparkContext sc = new SparkContext(conf);
    +
    +    // $example on$
    +    double[][] array = { { 1.12, 2.05, 3.12 }, { 5.56, 6.28, 8.94 },
    +      { 10.2, 8.0, 20.5 } };
    +    LinkedList<Vector> rowsList = new LinkedList<Vector>();
    +    for (int i = 0; i < array.length; i++) {
    +      Vector currentRow = Vectors.dense(array[i]);
    +      rowsList.add(currentRow);
    +    }
    +    JavaRDD<Vector> rows = JavaSparkContext.fromSparkContext(sc).parallelize(
    +      rowsList);
    --- End diff --
    
    merge this line with previous one


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-186067906
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-186067677
  
    **[Test build #51521 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/51521/consoleFull)** for PR 11132 at commit [`acd88f2`](https://github.com/apache/spark/commit/acd88f2dc87f8579be438dc60f0b4cccd1eba3ad).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r53274678
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/PCAOnRowMatrixExample.scala ---
    @@ -0,0 +1,58 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +// scalastyle:off println
    +package org.apache.spark.examples.mllib
    +
    +// $example on$
    +import org.apache.spark.SparkConf
    +import org.apache.spark.SparkContext
    +import org.apache.spark.mllib.linalg.Matrix
    +import org.apache.spark.mllib.linalg.Vectors
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix
    +// $example off$
    +
    +object PCAOnRowMatrixExample {
    +
    +  def main(args: Array[String]): Unit = {
    +
    +    val conf = new SparkConf().setAppName("SVDExample")
    +    val sc = new SparkContext(conf)
    +
    +    // $example on$
    +    val data = Array(
    +      Vectors.sparse(5, Seq((1, 1.0), (3, 7.0))),
    +      Vectors.dense(2.0, 0.0, 3.0, 4.0, 5.0),
    +      Vectors.dense(4.0, 0.0, 0.0, 6.0, 7.0))
    +
    +    val dataRDD = sc.parallelize(data, 2)
    +
    +    val mat: RowMatrix = new RowMatrix(dataRDD)
    +
    +    // Compute the top 4 principal components.
    +    // Principal components are stored in a local dense matrix.
    +    val pc: Matrix = mat.computePrincipalComponents(4)
    +
    +    // Project the rows to the linear space spanned by the top 4 principal components.
    +    val projected: RowMatrix = mat.multiply(pc)
    --- End diff --
    
    Move `// $example off$` here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r52946389
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/SVDExample.scala ---
    @@ -0,0 +1,53 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib
    +
    +import org.apache.spark.SparkConf
    +import org.apache.spark.SparkContext
    +import org.apache.spark.mllib.linalg.Matrix
    +import org.apache.spark.mllib.linalg.SingularValueDecomposition
    +import org.apache.spark.mllib.linalg.Vector
    +import org.apache.spark.mllib.linalg.Vectors
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix
    +
    +object SVDExample {
    +
    +  def main(args: Array[String]): Unit = {
    +
    +    val conf = new SparkConf().setAppName("SVDExample")
    +    val sc = new SparkContext(conf)
    +
    +    // $example on$
    +    val data = Array(
    +      Vectors.sparse(5, Seq((1, 1.0), (3, 7.0))),
    +      Vectors.dense(2.0, 0.0, 3.0, 4.0, 5.0),
    +      Vectors.dense(4.0, 0.0, 0.0, 6.0, 7.0))
    +
    +    val dataRDD = sc.parallelize(data, 2)
    +
    +    val mat: RowMatrix = new RowMatrix(dataRDD)
    +
    +    // Compute the top 20 singular values and corresponding singular vectors.
    +    val svd: SingularValueDecomposition[RowMatrix, Matrix] = mat.computeSVD(20, computeU = true)
    +    val U: RowMatrix = svd.U // The U factor is a RowMatrix.
    +    val s: Vector = svd.s // The singular values are stored in a local dense vector.
    +    val V: Matrix = svd.V // The V factor is a local dense matrix.
    +
    --- End diff --
    
    remove the blank and print U, s, and V.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/11132


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-186862336
  
    **[Test build #51641 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/51641/consoleFull)** for PR 11132 at commit [`3b031da`](https://github.com/apache/spark/commit/3b031da55b81b9440539dfe7ee9579fe4c656b9d).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-184130575
  
    **[Test build #51302 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/51302/consoleFull)** for PR 11132 at commit [`488f09c`](https://github.com/apache/spark/commit/488f09c06d6623920c0cf841af847a47ccb625c2).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r52946309
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/PCAOnRowMatrixExample.scala ---
    @@ -0,0 +1,52 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib
    +
    +import org.apache.spark.SparkConf
    +import org.apache.spark.SparkContext
    +import org.apache.spark.mllib.linalg.Matrix
    --- End diff --
    
    Add $example on$ $example off$ in imports


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r53274643
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/PCAOnRowMatrixExample.scala ---
    @@ -0,0 +1,58 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +// scalastyle:off println
    +package org.apache.spark.examples.mllib
    +
    +// $example on$
    +import org.apache.spark.SparkConf
    +import org.apache.spark.SparkContext
    +import org.apache.spark.mllib.linalg.Matrix
    +import org.apache.spark.mllib.linalg.Vectors
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix
    +// $example off$
    +
    +object PCAOnRowMatrixExample {
    +
    +  def main(args: Array[String]): Unit = {
    +
    +    val conf = new SparkConf().setAppName("SVDExample")
    --- End diff --
    
    Wrong name of `SVDExample`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-186067911
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/51521/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r52945988
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaSVDExample.java ---
    @@ -0,0 +1,65 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +//$example on$
    +import java.util.LinkedList;
    +
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.SparkContext;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.mllib.linalg.Matrix;
    +import org.apache.spark.mllib.linalg.SingularValueDecomposition;
    +import org.apache.spark.mllib.linalg.Vector;
    +import org.apache.spark.mllib.linalg.Vectors;
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix;
    +//$example off$
    +
    +/**
    + * Example for SingularValueDecomposition.
    + */
    +public class JavaSVDExample {
    +  public static void main(String[] args) {
    +    SparkConf conf = new SparkConf().setAppName("SVD Example");
    +    SparkContext sc = new SparkContext(conf);
    +
    +    // $example on$
    +    double[][] array = { { 1.12, 2.05, 3.12 }, { 5.56, 6.28, 8.94 },
    +      { 10.2, 8.0, 20.5 } };
    --- End diff --
    
    merge this line with previous one


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-184178872
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/51302/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-185061329
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/51413/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-186694521
  
    @mengxr LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by devaraj-kavali <gi...@git.apache.org>.
Github user devaraj-kavali commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r53277719
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaSVDExample.java ---
    @@ -0,0 +1,68 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +//$example on$
    +import java.util.LinkedList;
    +
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.SparkContext;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.mllib.linalg.Matrix;
    +import org.apache.spark.mllib.linalg.SingularValueDecomposition;
    +import org.apache.spark.mllib.linalg.Vector;
    +import org.apache.spark.mllib.linalg.Vectors;
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix;
    +//$example off$
    +
    +/**
    + * Example for SingularValueDecomposition.
    + */
    +public class JavaSVDExample {
    +  public static void main(String[] args) {
    +    SparkConf conf = new SparkConf().setAppName("SVD Example");
    +    SparkContext sc = new SparkContext(conf);
    +
    +    // $example on$
    +    double[][] array = { { 1.12, 2.05, 3.12 }, { 5.56, 6.28, 8.94 }, { 10.2, 8.0, 20.5 } };
    +    LinkedList<Vector> rowsList = new LinkedList<Vector>();
    +    for (int i = 0; i < array.length; i++) {
    +      Vector currentRow = Vectors.dense(array[i]);
    +      rowsList.add(currentRow);
    +    }
    +    JavaRDD<Vector> rows = JavaSparkContext.fromSparkContext(sc).parallelize(rowsList);
    +
    +    // Create a RowMatrix from JavaRDD<Vector>.
    +    RowMatrix mat = new RowMatrix(rows.rdd());
    +
    +    // Compute the top 3 singular values and corresponding singular vectors.
    +    SingularValueDecomposition<RowMatrix, Matrix> svd = mat.computeSVD(3, true, 1.0E-9d);
    +    RowMatrix U = svd.U();
    +    Vector s = svd.s();
    +    Matrix V = svd.V();
    +    Vector[] collectPartitions = (Vector[]) U.rows().collect();
    --- End diff --
    
    It gives compilation error if we remove typecasting here since the return type of collect is Object.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-184178618
  
    **[Test build #51302 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/51302/consoleFull)** for PR 11132 at commit [`488f09c`](https://github.com/apache/spark/commit/488f09c06d6623920c0cf841af847a47ccb625c2).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `public class JavaPCAExample `
      * `public class JavaSVDExample `


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-186859997
  
    **[Test build #51641 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/51641/consoleFull)** for PR 11132 at commit [`3b031da`](https://github.com/apache/spark/commit/3b031da55b81b9440539dfe7ee9579fe4c656b9d).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by devaraj-kavali <gi...@git.apache.org>.
Github user devaraj-kavali commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-185629805
  
    Thanks @yinxusen for the review, I have addressed them.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-185061002
  
    **[Test build #51413 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/51413/consoleFull)** for PR 11132 at commit [`2ada7ef`](https://github.com/apache/spark/commit/2ada7ef1859b0338a2613164d261671add1ff227).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-181790006
  
    Can one of the admins verify this patch?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-183099286
  
    ok to test


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-185628781
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/51479/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by mengxr <gi...@git.apache.org>.
Github user mengxr commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-183099445
  
    @yinxusen Could you help review this PR? Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by devaraj-kavali <gi...@git.apache.org>.
Github user devaraj-kavali commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-185064091
  
    @yinxusen Thanks for reviewing, I have addressed the comments, Please have a look into this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by devaraj-kavali <gi...@git.apache.org>.
Github user devaraj-kavali commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-186070514
  
    Thanks again @yinxusen for the review, I have addressed them.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-184127201
  
    Jenkins, retest this please


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r53274854
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/PCAOnRowMatrixExample.scala ---
    @@ -0,0 +1,58 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +// scalastyle:off println
    +package org.apache.spark.examples.mllib
    +
    +// $example on$
    +import org.apache.spark.SparkConf
    +import org.apache.spark.SparkContext
    +import org.apache.spark.mllib.linalg.Matrix
    +import org.apache.spark.mllib.linalg.Vectors
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix
    +// $example off$
    +
    +object PCAOnRowMatrixExample {
    +
    +  def main(args: Array[String]): Unit = {
    +
    +    val conf = new SparkConf().setAppName("SVDExample")
    +    val sc = new SparkContext(conf)
    +
    +    // $example on$
    +    val data = Array(
    +      Vectors.sparse(5, Seq((1, 1.0), (3, 7.0))),
    +      Vectors.dense(2.0, 0.0, 3.0, 4.0, 5.0),
    +      Vectors.dense(4.0, 0.0, 0.0, 6.0, 7.0))
    +
    +    val dataRDD = sc.parallelize(data, 2)
    +
    +    val mat: RowMatrix = new RowMatrix(dataRDD)
    +
    +    // Compute the top 4 principal components.
    +    // Principal components are stored in a local dense matrix.
    +    val pc: Matrix = mat.computePrincipalComponents(4)
    +
    +    // Project the rows to the linear space spanned by the top 4 principal components.
    +    val projected: RowMatrix = mat.multiply(pc)
    +    val collect = projected.rows.collect
    --- End diff --
    
    It's better to add parenthesis to empty-parenthesis method if the method has side effect. I.e. use `projected.rows.collect()`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-184178870
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r52945814
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/mllib/JavaPCAExample.java ---
    @@ -0,0 +1,61 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib;
    +
    +//$example on$
    +import java.util.LinkedList;
    +
    +import org.apache.spark.SparkConf;
    +import org.apache.spark.SparkContext;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.JavaSparkContext;
    +import org.apache.spark.mllib.linalg.Matrix;
    +import org.apache.spark.mllib.linalg.Vector;
    +import org.apache.spark.mllib.linalg.Vectors;
    +import org.apache.spark.mllib.linalg.distributed.RowMatrix;
    +//$example off$
    +
    +/**
    + * Example for compute principal components on a 'RowMatrix'.
    + */
    +public class JavaPCAExample {
    +  public static void main(String[] args) {
    +    SparkConf conf = new SparkConf().setAppName("PCA Example");
    +    SparkContext sc = new SparkContext(conf);
    +
    +    // $example on$
    +    double[][] array = { { 1.12, 2.05, 3.12 }, { 5.56, 6.28, 8.94 },
    +      { 10.2, 8.0, 20.5 } };
    --- End diff --
    
    Merge this line with previous one.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r53390371
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/PCAOnSourceVectorExample.scala ---
    @@ -0,0 +1,57 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    --- End diff --
    
    Move // scalastyle:off println here like other examples


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-186063429
  
    **[Test build #51521 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/51521/consoleFull)** for PR 11132 at commit [`acd88f2`](https://github.com/apache/spark/commit/acd88f2dc87f8579be438dc60f0b4cccd1eba3ad).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11132#issuecomment-185061326
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13016] [Documentation] Replace example ...

Posted by yinxusen <gi...@git.apache.org>.
Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11132#discussion_r52946289
  
    --- Diff: examples/src/main/scala/org/apache/spark/examples/mllib/PCAOnSourceVectorExample.scala ---
    @@ -0,0 +1,51 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.examples.mllib
    +
    +import org.apache.spark.SparkConf
    +import org.apache.spark.SparkContext
    +import org.apache.spark.mllib.feature.PCA
    --- End diff --
    
    Add `$example on$` `$example off$` in imports


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org