Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/653#discussion_r12348662
  
    --- Diff: docs/mllib-naive-bayes.md ---
    @@ -58,29 +67,36 @@ optionally smoothing parameter `lambda` as input, and 
output a
     can be used for evaluation and prediction.
     
     {% highlight java %}
    +import org.apache.spark.api.java.JavaPairRDD;
    +import org.apache.spark.api.java.JavaRDD;
    +import org.apache.spark.api.java.function.Function;
     import org.apache.spark.mllib.classification.NaiveBayes;
    +import org.apache.spark.mllib.classification.NaiveBayesModel;
    +import org.apache.spark.mllib.regression.LabeledPoint;
    +import scala.Tuple2;
     
     JavaRDD<LabeledPoint> training = ... // training set
     JavaRDD<LabeledPoint> test = ... // test set
     
    -NaiveBayesModel model = NaiveBayes.train(training.rdd(), 1.0);
    +final NaiveBayesModel model = NaiveBayes.train(training.rdd(), 1.0);
     
    -JavaRDD<Double> prediction = model.predict(test.map(new 
Function<LabeledPoint, Vector>() {
    --- End diff --
    
    Hehe :) Yes that should compile and likely works at runtime. I'm not sure 
whether all this becomes too distracting given the purpose of this 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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to