1

I have the following code, and getting the SyntaxError: invalid syntax for lambda (v, p): v == p:

predictions = tree_model.predict(test_data.map(lambda p: p.features))
labels_and_preds = test_data.map(lambda p: p.label).zip(predictions)

t0 = time()
test_accuracy = labels_and_preds.filter(lambda (v, p): v == p).count() / float(test_data.count())
tt = time() - t0

What’s the correct syntax?

Sami
  • 1,473
  • 1
  • 17
  • 37

0 Answers0