Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/11125#discussion_r52684376
--- Diff: examples/src/main/python/mllib/naive_bayes_example.py ---
@@ -50,8 +61,17 @@ def parseLine(line):
# Make prediction and test accuracy.
predictionAndLabel = test.map(lambda p: (model.predict(p.features),
p.label))
accuracy = 1.0 * predictionAndLabel.filter(lambda (x, v): x ==
v).count() / test.count()
+ print('\n\tmodel accuracy %.4f\n' % accuracy)
# Save and load model
- model.save(sc, "target/tmp/myNaiveBayesModel")
- sameModel = NaiveBayesModel.load(sc, "target/tmp/myNaiveBayesModel")
+ output_dir = '/tmp/myNaiveBayesModel'
--- End diff --
This doesn't work because `/tmp` is not always available, which is why we
used `target/tmp`. Let's just assume that users run this example code under the
`spark/` folder, or we can document it in the usage.
---
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]