aboutsummaryrefslogtreecommitdiff
path: root/examples/src/main/python/ml/naive_bayes_example.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/src/main/python/ml/naive_bayes_example.py')
-rw-r--r--examples/src/main/python/ml/naive_bayes_example.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/src/main/python/ml/naive_bayes_example.py b/examples/src/main/python/ml/naive_bayes_example.py
index 89255a2bae..8bc32222fe 100644
--- a/examples/src/main/python/ml/naive_bayes_example.py
+++ b/examples/src/main/python/ml/naive_bayes_example.py
@@ -43,11 +43,11 @@ if __name__ == "__main__":
# train the model
model = nb.fit(train)
- # compute precision on the test set
+ # compute accuracy on the test set
result = model.transform(test)
predictionAndLabels = result.select("prediction", "label")
- evaluator = MulticlassClassificationEvaluator(metricName="precision")
- print("Precision:" + str(evaluator.evaluate(predictionAndLabels)))
+ evaluator = MulticlassClassificationEvaluator(metricName="accuracy")
+ print("Accuracy: " + str(evaluator.evaluate(predictionAndLabels)))
# $example off$
spark.stop()