[ 
https://issues.apache.org/jira/browse/SPARK-11581?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joseph K. Bradley resolved SPARK-11581.
---------------------------------------
       Resolution: Fixed
    Fix Version/s: 1.4.2
                   1.6.0
                   1.5.3

Issue resolved by pull request 9560
[https://github.com/apache/spark/pull/9560]

> Example mllib code in documentation incorrectly computes MSE
> ------------------------------------------------------------
>
>                 Key: SPARK-11581
>                 URL: https://issues.apache.org/jira/browse/SPARK-11581
>             Project: Spark
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 1.3.1, 1.4.1, 1.5.1, 1.6.0
>            Reporter: Brian Webb
>            Priority: Trivial
>              Labels: starter
>             Fix For: 1.5.3, 1.6.0, 1.4.2
>
>
> The example Java code at the bottom of the mllib-decision-tree web page shows 
> how to compute MSE on the test data. However, there is a bug in the code. The 
> code currently divides by data.count(), but it should instead divide by the 
> count of testData, testData.count().
> http://spark.apache.org/docs/latest/mllib-decision-tree.html
> Double testMSE =
>   predictionAndLabel.map(new Function<Tuple2<Double, Double>, Double>() {
>     @Override
>     public Double call(Tuple2<Double, Double> pl) {
>       Double diff = pl._1() - pl._2();
>       return diff * diff;
>     }
>   }).reduce(new Function2<Double, Double, Double>() {
>     @Override
>     public Double call(Double a, Double b) {
>       return a + b;
>     }
>   }) / data.count();
> System.out.println("Test Mean Squared Error: " + testMSE);



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to