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

    https://github.com/apache/spark/pull/13301#discussion_r64717582
  
    --- Diff: 
examples/src/main/scala/org/apache/spark/examples/mllib/NaiveBayesExample.scala 
---
    @@ -31,16 +30,11 @@ object NaiveBayesExample {
         val conf = new SparkConf().setAppName("NaiveBayesExample")
         val sc = new SparkContext(conf)
         // $example on$
    -    val data = sc.textFile("data/mllib/sample_naive_bayes_data.txt")
    -    val parsedData = data.map { line =>
    -      val parts = line.split(',')
    -      LabeledPoint(parts(0).toDouble, Vectors.dense(parts(1).split(' 
').map(_.toDouble)))
    -    }
    +    // Load and parse the data file.
    +    val data = MLUtils.loadLibSVMFile(sc, 
"data/mllib/sample_libsvm_data.txt")
     
         // Split data into training (60%) and test (40%).
    -    val splits = parsedData.randomSplit(Array(0.6, 0.4), seed = 11L)
    -    val training = splits(0)
    -    val test = splits(1)
    +    val Array(training, test) = data.randomSplit(Array(0.6, 0.4))
    --- End diff --
    
    I see you removed the `seed` here, which is not necessary but probably 
makes sense to simplify. In which case, perhaps remove the `seed` arg from the 
Java & Python 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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to