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

    https://github.com/apache/spark/pull/4834#discussion_r25569774
  
    --- Diff: docs/mllib-naive-bayes.md ---
    @@ -115,22 +115,31 @@ used for evaluation and prediction.
     
     Note that the Python API does not yet support model save/load but will in 
the future.
     
    -<!-- TODO: Make Python's example consistent with Scala's and Java's. -->
     {% highlight python %}
    -from pyspark.mllib.regression import LabeledPoint
     from pyspark.mllib.classification import NaiveBayes
    +from pyspark.mllib.linalg import Vectors
    +from pyspark.mllib.regression import LabeledPoint
    +
    +data = sc.textFile("data/mllib/sample_naive_bayes_data.txt")
    +
    +# Preprocessing
    +splitData = data.map(lambda line: line.split(','))
    +parsedData = splitData.map(
    +  lambda parts: LabeledPoint(
    +    float(parts[0]),
    +    Vectors.dense(map(lambda x: float(x), parts[1].split(' ')))
    +    )
    +  )
     
    -# an RDD of LabeledPoint
    -data = sc.parallelize([
    -  LabeledPoint(0.0, [0.0, 0.0])
    -  ... # more labeled points
    -])
    +# Split data into training (60%) and test (40%)
    --- End diff --
    
    `data into` -> `data approximately into`.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to