You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by OBones <ob...@free.fr> on 2017/12/18 16:35:18 UTC

Getting multiple regression metrics at once

Hello,

I'm working with the ML package for regression purposes and I get good 
results on my data.
I'm now trying to get multiple metrics at once, as right now, I'm doing 
what is suggested by the examples here:
https://spark.apache.org/docs/2.1.0/ml-classification-regression.html

Basically the code in the examples is this:

val  evaluator  =  new  RegressionEvaluator()
   .setLabelCol("label")
   .setPredictionCol("prediction")
   .setMetricName("rmse")
val  rmse  =  evaluator.evaluate(predictions)

This gives me the RMSE for my test data which is fine, but I'm also 
interested in MSE, MAE, MAPE, Rsquare and Qsquare
I thus looked at the documentation here:
https://spark.apache.org/docs/2.1.0/api/java/org/apache/spark/ml/evaluation/RegressionEvaluator.html#metricName%28%29

where I see that I can get RMSE, MSE, MAE and Rsquare but it does not 
appear that I can get them computed all at once, going over the data 
rows only once and not 5 times as the example code would suggest it is 
needed to do so.

How can I achieve that single pass computation?

Then, there are MAPE and Qsquare missing, how can I get those computed 
as well, ideally while computing the 4 others?

Regards

---------------------------------------------------------------------
To unsubscribe e-mail: user-unsubscribe@spark.apache.org