Skip to content

Instantly share code, notes, and snippets.

@mrafayaleem
Last active March 7, 2019 19:56
Show Gist options
  • Save mrafayaleem/79b23ff3bd9a6c5b6850de7b88fd7373 to your computer and use it in GitHub Desktop.
Save mrafayaleem/79b23ff3bd9a6c5b6850de7b88fd7373 to your computer and use it in GitHub Desktop.
# Train the model and get predictions on the validation set
antbeeModel = pipeline.fit(trainingDF)
predictionDF = antbeeModel.transform(validationDF).cache()
predictionDF.sample(False, 0.1).show()
# Evaluate predictions
evaluator = MulticlassClassificationEvaluator(
labelCol="label", predictionCol="prediction", metricName="accuracy")
accuracy = evaluator.evaluate(predictionDF)
# expected error should be less than 10%
print("The Test Error is = %g " % (1.0 - accuracy))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment