Created
April 2, 2019 17:42
-
-
Save bfraiche/7c807ced9a5d5a1c3034018201a8f236 to your computer and use it in GitHub Desktop.
This gist contains code snippets for my blogpost: 'Random Forest with Python and Spark ML'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
evaluator = RegressionEvaluator(labelCol="label", predictionCol="prediction", metricName="rmse") | |
rmse = evaluator.evaluate(predictions) | |
rfPred = model.transform(df) | |
rfResult = rfPred.toPandas() | |
plt.plot(rfResult.label, rfResult.prediction, 'bo') | |
plt.xlabel('Price') | |
plt.ylabel('Prediction') | |
plt.suptitle("Model Performance RMSE: %f" % rmse) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment