Skip to content

Instantly share code, notes, and snippets.

@pedroduartecosta
Created January 29, 2019 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedroduartecosta/5645e78a4c2281d53f46cb33e2dd6c58 to your computer and use it in GitHub Desktop.
Save pedroduartecosta/5645e78a4c2281d53f46cb33e2dd6c58 to your computer and use it in GitHub Desktop.
val holdout = model.transform(test).select("prediction", "DelayOutputVar")
val rm = new RegressionMetrics(holdout.rdd.map(x =>
(x(0).asInstanceOf[Double], x(1).asInstanceOf[Double])))
println("sqrt(MSE): " + Math.sqrt(rm.meanSquaredError))
println("mean absolute error: " + rm.meanAbsoluteError)
println("R Squared: " + rm.r2)
println("Explained Variance: " + rm.explainedVariance + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment