aboutsummaryrefslogtreecommitdiff
path: root/examples/src/main/python/mllib/random_forest_classification_example.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/src/main/python/mllib/random_forest_classification_example.py')
-rw-r--r--examples/src/main/python/mllib/random_forest_classification_example.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/src/main/python/mllib/random_forest_classification_example.py b/examples/src/main/python/mllib/random_forest_classification_example.py
index 9e5a8dcaab..5ac67520da 100644
--- a/examples/src/main/python/mllib/random_forest_classification_example.py
+++ b/examples/src/main/python/mllib/random_forest_classification_example.py
@@ -45,7 +45,8 @@ if __name__ == "__main__":
# Evaluate model on test instances and compute test error
predictions = model.predict(testData.map(lambda x: x.features))
labelsAndPredictions = testData.map(lambda lp: lp.label).zip(predictions)
- testErr = labelsAndPredictions.filter(lambda (v, p): v != p).count() / float(testData.count())
+ testErr = labelsAndPredictions.filter(
+ lambda lp: lp[0] != lp[1]).count() / float(testData.count())
print('Test Error = ' + str(testErr))
print('Learned classification forest model:')
print(model.toDebugString())