spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BryanCutler <...@git.apache.org>
Subject [GitHub] spark pull request #14308: [SPARK-16421][EXAMPLES][ML] Improve ML Example Ou...
Date Fri, 29 Jul 2016 17:52:12 GMT
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14308#discussion_r72833265
  
    --- Diff: examples/src/main/java/org/apache/spark/examples/ml/JavaMaxAbsScalerExample.java
---
    @@ -34,10 +44,17 @@ public static void main(String[] args) {
           .getOrCreate();
     
         // $example on$
    -    Dataset<Row> dataFrame = spark
    -      .read()
    -      .format("libsvm")
    -      .load("data/mllib/sample_libsvm_data.txt");
    +    List<Row> data = Arrays.asList(
    --- End diff --
    
    The data in the file is fine, but uses sparse vectors so that when the result is output,
it doesn't really show anything.  Using just a small sample dataset, you can see what it is
doing from the output
    
    before
    ```
    +-----+--------------------+--------------------+
    |label|            features|      scaledFeatures|
    +-----+--------------------+--------------------+
    |  0.0|(692,[127,128,129...|(692,[127,128,129...|
    |  1.0|(692,[158,159,160...|(692,[158,159,160...|
    |  1.0|(692,[124,125,126...|(692,[124,125,126...|
    ```
    after
    ```
    +--------------+----------------+                                               
    |      features|  scaledFeatures|
    +--------------+----------------+
    |[1.0,0.1,-8.0]|[0.25,0.01,-1.0]|
    |[2.0,1.0,-4.0]|  [0.5,0.1,-0.5]|
    |[4.0,10.0,8.0]|   [1.0,1.0,1.0]|
    ```


---
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


Mime
View raw message